-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyproject.toml
267 lines (229 loc) · 10.5 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
[tool.poetry]
name = "hvac_gym"
version = "0.1.0"
description = "Automated modelling of building HVAC and creation of reinforcement learning gym environments"
authors = ["Sam West <sam.west@csiro.au>"]
packages = [
{ include = "hvac_gym/**/*", from = "src" }, # need to specify the packages for `poetry build` to include
]
[tool.poetry.dependencies]
python = ">3.11.0,<3.13"
loguru = ">=0.5.3"
virtualenv = ">=20.24.2"
pydantic = "2.3.0"
plotly = "^5.20.0"
brickschema = { extras = ["persistence"], version = "^0.7.5" }
panel = "^1.3.8"
tqdm = "^4.66.2"
scikit-learn = "^1.4.2"
optuna = "^3.6.1"
scikit-elm = { git = "https://github.com/akusok/scikit-elm.git" }
dask = { version = "^2024.4.1", extras = ["array", "dataframe", "distributed"] }
py-spy = "^0.3.14"
pysr = "^0.18.4"
polars = "^0.20.25"
gymnasium = "^0.29.1"
joblib = "^1.4.2"
pandas = "^2.2.2"
overrides = "^7.7.0"
pendulum = "^3.0.0"
dch-interface = { path = "lib/dch_interface-0.1.14-py3-none-any.whl", optional = true }
senaps-api-client = { path = "lib/senaps_api_client-2.16.1a0-py3-none-any.whl", optional = true }
pythermalcomfort = "^2.10.0"
simple-pid = "^2.0.1"
[tool.poetry.extras]
# Optional DCH dependencies - only needed to retrain models from raw data via the Data Clearing House (DCH) platform.
# Install with `poetry add hvac_gym --extras dch` or `pip install hvac_gym[dch]`
dch = ["dch-interface"]
[tool.poetry.group.dev.dependencies]
pytest = "^6.2.3"
Sphinx = "^7.3.7"
myst-parser = "^3.0.1"
coverage = "^5.5"
pip-licenses = "^3.5.2"
pylint = "^3.2.3"
pre-commit = "^4.0.1"
pyproject-flake8 = "^0.0.1-alpha.4"
pytest-cov = "^3.0.0"
poethepoet = "^0.20.0"
mypy = "^1.11.1"
ruff = "^0.1.0"
black = "^23.9.1"
nbmake = "^1.4.6"
pytest-timeout = "^2.2.0"
liccheck = { git = "https://github.com/dhatim/python-license-check" }
scalene = "^1.5.40"
flameprof = "^0.4"
snakeviz = "^2.2.0"
pydata-sphinx-theme = ">=0.15.4"
types-python-dateutil = "^2.9.0.20240821"
[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
[[tool.poetry.source]]
name = "csiroenergy"
url = "https://pkgs.dev.azure.com/csiro-energy/csiro-energy/_packaging/csiro-python-packages/pypi/simple/"
priority = "supplemental"
[build-system]
requires = ["setuptools", "poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
# Scripts for the main entrypoints of the package.
# These will be installed into the virtualenv's bin/ directory and run with `poetry run example_script`.
# These also allow you to `pipx install` this project in a sandbox
[tool.poetry.scripts]
example_script = "hvac_gym.example:run()"
# Automation of common build tasks etc. Run with: `poe <target>`, eg. `poe clean`.
# See https://github.com/nat-n/poethepoet for details.
[tool.poe.tasks]
train = { cmd = "poetry run python src/hvac_gym/training/train_site.py ", help = "Train the models" }
example = { cmd = "poetry run python src/tests/test_gym.py", help = "Run the example script" }
init = { shell = "poetry lock --no-update; poetry install --sync; poetry run pre-commit install", help = "(Re)initialise the project, e.g. install updated dependencies (e.g. after a pull/merge)", interpreter = "posix" }
clean = { shell = "rm -rf output/.func_cache .coverage .mypy_cache .pytest_cache dist ./**/__pycache__ docs/build/ dist docs/build docs/source/_static docs/source/wpf.*.rst", help = "Clean up build artifacts", interpreter = "posix" }
clean_outputs = { shell = "rm -rf output/ results/", help = "Cleans output dirs: output/ & results/", interpreter = "posix" }
lint = { cmd = "poetry run git add .pre-commit-config.yaml & poetry run pre-commit run", help = "Run pre-commit hooks" }
unit_tests = { shell = 'poetry run pytest --capture=sys -m "not integration" --cov-report term-missing --cov-report html --cov=src/ --durations=0 --durations-min=5.0 --tb=native --nbmake src/ --nbmake-timeout=5000', help = "Run unit tests", interpreter = "posix" }
int_tests = { shell = "poetry run pytest --capture=sys -m integration --cov-report term-missing --cov-report html --cov=src/ --durations=0 --durations-min=5.0 --tb=native", help = "Run integration tests", interpreter = "posix" }
test = { shell = "poetry run pytest --capture=sys --cov-report term-missing --cov-report html --cov=src/ --durations=0 --durations-min=5.0 --tb=native --nbmake src/ --nbmake-timeout=5000", help = "Run all tests", interpreter = "posix" }
publish = { cmd = "poetry publish --build --remote csiroenergy", help = "Publish the package to private pypi repo" }
docker_build = { cmd = "docker-compose build", help = "Build the docker-compose images" }
docker_run = { cmd = "docker-compose run run", help = "Run the main docker-compose container" }
docker_test = { cmd = "docker-compose run test", help = "Run the test docker-compose container" }
doc.sequence = ["_doc_dir", "_pyreverse", "_apidoc", "_sphinx", "show_doc"]
doc.help = "Build the documentation"
show_doc = { expr = "webbrowser.open('file://' + str(pathlib.Path('docs/build/index.html').resolve()))", imports = ["webbrowser", "pathlib"], help = "Open the documentation in a browser (experimental)." }
# Internal tasks used by other tasks, not callable directly
_doc_dir = { script = "os:makedirs('docs/source/_static', exist_ok=True)" }
_pyreverse = { cmd = "pyreverse --output-directory docs/source/_static/ --output html src/hvac_gym" }
_licenses = { cmd = "pip-licenses -f md --output-file docs/source/licenses.md" }
_apidoc = { cmd = "sphinx-apidoc -f -o docs/source/ src/" }
_sphinx = { cmd = "sphinx-build -b html docs/source docs/build" }
# Config for various pre-commit checks are below
# Ruff linting rules - see https://github.com/charliermarsh/ruff and https://beta.ruff.rs/docs/rules/
[tool.ruff.lint.pydocstyle]
convention = "pep257"
[tool.ruff.lint.pycodestyle]
max-doc-length = 150
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.flake8-type-checking]
strict = true
runtime-evaluated-base-classes = ["pydantic.BaseModel"]
[tool.ruff]
target-version = "py39"
line-length = 150
fix = true
[tool.ruff.lint]
unfixable = ["F841"] # variable not used
exclude = ["src/tests/**/*.py"]
# Option 1: use basic rules only.
select = [
"D", # docstring checks
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"UP", # pyupgrade
"N", # pep8 naming
"I", # isort
"TID", # tidy imports
"UP", # pyupgrade
"PD", # pandas style
"NPY", # numpy style
"C90", # code complexity
"ANN" # missing doc/annotations
# "PL", # pylint
]
# Add specific rule codes/groups here to ignore them, or add a '#noqa' comment to the line of code to skip all checks.
ignore = [
"PLR", # complexity rules
"D104", "D100", "D203", "D213", "D401", "D105", "D205", "D400", "D415",
"ANN101", "ANN002", "ANN003"
]
# Ruff rule-specific options:
[tool.ruff.lint.mccabe]
max-complexity = 14 # increase max function 'complexity'
[tool.ruff.lint.pep8-naming]
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
classmethod-decorators = ["classmethod", "field_validator"]
[tool.mypy]
# Static type-checking. Debug with `pre-commit run mypy`.
# This config will only enforce typing if you choose to add type annotations. It will ignore code without any annotations.
# Cheat sheet: https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html
# Good guide: https://breadcrumbscollector.tech/mypy-how-to-use-it-in-my-project/
# SET TO FALSE TO ENABLE MYPY
# 'false' enables basic checks on optional type hints
ignore_errors = false
warn_unused_configs = true
ignore_missing_imports = true
pretty = false
exclude = "src/tests/**/*.py"
files = ["src/**/*.py"]
implicit_reexport = true
# Uncomment to enable more checks - forcing type hints to be used everywhere.
strict_optional = true
warn_unused_ignores = true
check_untyped_defs = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
warn_redundant_casts = true
# these options are quite restrictive, disabled
disallow_any_generics = true
no_implicit_reexport = true
# See https://bandit.readthedocs.io/en/latest/man/bandit.html?highlight=recursive#options and https://bandit.readthedocs.io/en/latest/config.html?highlight=pyproject.toml#bandit-settings
[tool.bandit]
exclude_dirs = ["tests", ".venv", "scripts"]
skips = ["B101", "B301", "B403", "B404", "B501"]
exclude = ["*_test.py", "test_*.py"]
# Checks that no 'viral' licensed libraries are in use.
[tool.liccheck]
authorized_licenses = [
"bsd",
"new bsd",
"bsd license",
"new bsd license",
"simplified bsd",
"apache",
"apache 2.0",
"apache software license",
"apache software",
"gnu lgpl",
"lgpl with exceptions or zpl",
"isc license",
"isc license (iscl)",
"mit",
"mit license",
"python software foundation license",
"zpl 2.1",
"Mozilla Public License 2.0 (MPL 2.0)",
"The Unlicense (Unlicense)",
"Python Software Foundation",
"BSD 3-Clause",
"Historical Permission Notice and Disclaimer (HPND)",
"W3C",
]
unauthorized_licenses = [
"gpl",
"gpl v2",
"gpl v3",
]
level = "STANDARD"
reporting_txt_file = "docs/source/license-check.txt"
dependencies = true # to load [project.dependencies]
[tool.liccheck.authorized_packages]
uuid = 1.30
# see https://docs.pytest.org/en/6.2.x/customize.html and https://docs.pytest.org/en/6.2.x/reference.html#ini-options-ref
[tool.pytest.ini_options]
filterwarnings = ["ignore::DeprecationWarning"]
markers = ["integration", "manual"]
addopts = "--verbose --capture=sys"
# default pytest args for coverage report to console+html (cov-report), reporting long-running tests (durations-min), native stacktraces (tb=native), and jupyer notebook running (nbmake)
#addopts = '-s --cov-report term-missing --durations=0 --durations-min=5.0 --tb=native --timeout=300 --nbmake --nbmake-timeout=5000 src/'
# Add our private package index. Add via this command in poetry >=1.2: `poetry source add --secondary csiroenergy https://pkgs.dev.azure.com/csiro-energy/csiro-energy/_packaging/csiro-python-packages/pypi/simple/`
# If uncommenting this block, you also need to generate a token at https://dev.azure.com/csiro-energy/_usersSettings/tokens and run these commands for authentication:
# poetry config repositories.csiroenergy https://pkgs.dev.azure.com/csiro-energy/csiro-energy/_packaging/csiro-python-packages/pypi/upload
# poetry config http-basic.csiroenergy <ident> <paste-your-token>
#[[tool.poetry.source]]
#name = "csiroenergy"
#url = "https://pkgs.dev.azure.com/csiro-energy/csiro-energy/_packaging/csiro-python-packages/pypi/simple/"
#secondary = true # if this is true, it will be checked after the main index
#default = false # if true, this index will be checked before other repos declared in pyproject.toml.