forked from thousandbrainsproject/tbp.monty
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
318 lines (291 loc) · 12 KB
/
pyproject.toml
File metadata and controls
318 lines (291 loc) · 12 KB
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
[build-system]
requires = ['setuptools >= 71.0.0']
build-backend = 'setuptools.build_meta'
[project]
authors = [
{ name = 'Thousand Brains Project' }
]
classifiers = [
'Development Status :: 3 - Alpha', # Update to Beta when we start using semver
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Artificial Intelligence'
]
dependencies = [
'eval_type_backport', # Needed to make pydantic work with future annotations, can be removed when we get to python 3.10
'hydra-core>=1.3.2',
'importlib_resources', # imported via conda (conda-forge::importlib_resources)
'matplotlib>=3.7.3', # imported via conda (conda-forge::matplotlib)
'numpy', # imported via conda (conda-forge::numpy)
'opencv-python==4.13.0.92',
'omegaconf>=2.3.0',
'pandas', # imported via conda (conda-forge::pandas)
'pillow', # imported via conda (conda-forge::pillow)
'pydantic>=2.10.6',
'numpy-quaternion==2023.0.3;python_version=="3.8"', # imported via conda (conda-forge::quaternion)
'numpy-quaternion==2024.0.13;python_version=="3.10"',
'scikit-image', # imported via conda (conda-forge::scikit-image)
'scikit-learn==1.3.2;python_version=="3.8"', # imported via conda (conda-forge::scikit-learn)
'scikit-learn;python_version>="3.9"', # for uv environment
'scipy>=1.10.1', # imported via conda (conda-forge::scipy)
'sympy', # imported via conda (conda-forge::sympy)
'torch==1.13.1;python_version=="3.8"', # imported via conda (pytorch::pytorch)
'torch;python_version>="3.9"',
'torch-geometric==2.1.0.post1;python_version=="3.8"', # imported via conda (pyg::pyg)
'torch-sparse==0.6.15;python_version=="3.8"', # imported via conda (pytorch::pytorch-sparse)
'torch-scatter==2.0.9;python_version=="3.8"', # imported via conda (pytorch::pytorch-scatter)
'torch-geometric>=2.1.0.post1;python_version>="3.9"', # for uv environment
'torch-sparse>=0.6.15;python_version>="3.9"', # for uv environment
'torch-scatter>=2.0.9;python_version>="3.9"', # for uv environment
'tqdm', # imported via conda (conda-forge::tqdm)
'typing-extensions',
'wandb', # imported via conda (conda-forge::wandb)
]
description = 'Thousand Brains Project Monty'
dynamic = ['version']
license = { file = 'LICENSE' }
name = 'tbp.monty'
readme = 'README.md'
requires-python = '>=3.8'
[project.optional-dependencies]
simulator_habitat = [
# HabitatSim is only installable via conda. These dependencies are listed here for
# documentation and consistency.
# NOTE: The version constraint is to prevent `uv` from failing trying to check all
# optional dependency sets are valid. This is because there isn't a version of
# HabitatSim on PyPI that works for 3.8, and so it tries to solve for a 3.8 environment
# and fails.
'habitat_sim;python_version=="3.9"', # imported via conda (aihabitat::habitat-sim)
]
simulator_mujoco = [
'mujoco'
]
analysis = [
'ipython',
'seaborn',
]
build = [
'build'
]
dev = [
# Check for undeclared dependencies
'deptry',
# Python static type checker
'mypy==1.11.2',
'types-PyYAML',
# Testing, code style, etc...
'hypothesis==6.113.0',
'parameterized==0.9.0', # Supports Python 3.8
'pytest==7.1.1',
'pytest-xdist==2.5.0',
'pytest-cov==3.0.0',
'unittest-parametrize', # Python >= 3.9
# Python linter and formatter
'ruff==0.14.2',
]
generate_api_docs_tool = [
'docutils>=0.17',
'sphinx',
'sphinx-autobuild',
'sphinx-autodoc-typehints',
'myst-parser',
'pydata_sphinx_theme',
'snowballstemmer<3'
]
github_readme_sync_tool = [
'requests',
'pyyaml',
'python-dotenv',
'colorama',
'markdown2',
'python-slugify',
'nh3'
]
future_work_widget_tool = [
'nh3',
]
print_version_tool = [
'semver'
]
[project.urls]
Homepage = 'https://thousandbrainsproject.org'
Documentation = 'https://thousandbrainsproject.readme.io/docs'
Repository = 'https://github.com/thousandbrainsproject.tbp.monty'
Issues = 'https://github.com/thousandbrainsproject/tbp.monty/issues'
[tool.deptry]
exclude= ['venv', '\.venv', '\.direnv', '\.git', 'setup\.py']
experimental_namespace_package = true # recognize tbp.monty as a namespace package
ignore = ['DEP002']
known_first_party = [
'attr', # transitive dependency bundled with habitat-sim
'magnum', # transitive dependency bundled with habitat-sim
'quaternion', # transitive add-on for numpy installed via conda (conda-forge::quaternion)
'tests',
'tools'
]
[tool.deptry.package_module_name_map]
ipython = 'IPython'
'python-dotenv' = 'dotenv'
'python-slugify' = 'slugify'
[tool.pytest.ini_options]
minversion = '6.0'
addopts = '-ra -n auto --doctest-modules --doctest-continue-on-failure'
testpaths = [
'src', # discover doctests
'tests/conf',
'tests/unit',
]
norecursedirs = [
'src/tbp/monty/frameworks/utils', # ignore where 'seaborn' module is required
'src/tbp/monty/simulators/mujoco', # ignore where 'mujoco' module is required
]
filterwarnings = [
'ignore:.*:DeprecationWarning'
]
junit_family = 'xunit1'
[tool.autoimport.common_statements]
"np" = "import numpy as np"
"npt" = "import numpy.typing as npt"
"nn" = "import torch.nn as nn"
"pd" = "import panda as pd"
"qt" = "import quaternion as qt"
"mn" = "import magnum as mn"
[tool.coverage.run]
branch = true
parallel = true
source = [
'src'
]
[tool.coverage.report]
skip_empty = true
sort = 'Cover'
[tool.coverage.html]
show_contexts = true
[tool.mypy]
explicit_package_bases = true
# TODO: Remove global ignore and handle missing type stubs
ignore_missing_imports = true
mypy_path = "src"
warn_unused_configs = true
[tool.ruff]
line-length = 88
target-version = "py38"
[tool.ruff.format]
indent-style = "space"
line-ending = "auto"
quote-style = "double"
skip-magic-trailing-comma = false
[tool.ruff.lint]
preview = true
explicit-preview-rules = true # comment this out to check all preview rules
select = [
"ALL",
# Explicitly opt-in to preview rules
"CPY001", # CPY001: Missing copyright notice at top of file
"DOC201", # DOC201: return is not documented in docstring
"DOC202", # DOC202: Docstring should not have a returns section because the function doesn't return anything
"DOC402", # DOC402: yield is not documented in docstring
"DOC403", # DOC403: Docstring has a "Yields" section but the function doesn't yield anything
"DOC501", # DOC501: Raised exception {id} missing from docstring
"DOC502", # DOC502: Raised exception is not explicitly raised: {id}
"E261", # E261: Insert at least two spaces before an inline comment
"E262", # E262: Inline comment should start with '# '
"E265", # E265: Block comment should start with '# '
]
# NOTE: Unless stated otherwise, each of the below ignore rules is open to discussion
# and could be addressed to improve code quality. You are welcome to submit a
# pull request to address any of the below. For rules that require extensive
# changes, you may want to open an issue to discuss the change first.
ignore = [
###
# TBP-specific, deliberately ignored rules
"N818", # N818: error-suffix-on-exception-name
"COM812", # COM812: Trailing comma missing
# End of deliberately ignored rules
# Original inherited flake8 ignores
"D1", # D1XX: Missing Docstrings
"ERA001", # ERA001: Found commented out code
"FIX001", # FIX001: Line contains FIXME, consider resolving the issue
"FIX002", # FIX002: Line contains TODO, consider resolving the issue
"N812", # N812: lowercase imported as non lowercase. Allow "import torch.nn.functional as F"
"T201", # T201: print found
"T203", # T203: pprint found
###
# TODO: ruff=0.7.1 migration introduced errors ignored below, resolve these
"ANN001", # ANN001: Missing type annotation for function argument
"ANN002", # ANN002: Missing type annotation for `*args`
"ANN003", # ANN003: Missing type annotation for `**kwargs`
"ANN201", # ANN201: Missing return type annotation for public function
"ANN202", # ANN202: Missing return type annotation for private function
"ANN204", # ANN204: Missing return type annotation for special method
"ANN206", # ANN206: Missing return type annotation for classmethod
"ANN401", # ANN401: Dynamically typed expressions (typing.Any) are disallowed in {name}
"DTZ005", # DTZ005: `datetime.datetime.now()` called without a `tz` argument
"EM101", # EM101: Exception must not use a string literal, assign to variable first
"EM102", # EM102: Exception must not use an f-string literal, assign to variable first
"F403", # F403: from {name} import * used; unable to detect undefined names
"FBT001", # FBT001: Boolean-typed positional argument in function definition
"FBT002", # FBT002: Boolean default positional argument in function definition
"G003", # G003: Logging statement uses `+`
"G004", # G004: Logging statement uses f-string
"N804", # N804: First argument of a class method should be named `cls`
"NPY002", # NPY002: Replace legacy `np.random.normal` call with `np.random.Generator`
"PERF203", # PERF203: `try`-`except` within a loop incurs performance overhead
"PERF401", # PERF401: Use a list comprehension to create a transformed list
"PIE790", # PIE790: Unnecessary pass statement
"PLR0911", # PLR0911: Too many return statements
"PLR0912", # PLR0912: Too many branches
"PLR0913", # PLR0913: Too many arguments in function definition
"PLR0915", # PLR0915: Too many statements
"PLR1730", # PLR1730: Replace `if` statement with {replacement}
"PLR2004", # PLR2004: Magic value used in comparison, consider replacing {value} with a constant variable
"PT009", # PT009: Use a regular `assert` instead of unittest-style `assertEqual`
"PT018", # PT018: Assertion should be broken down into multiple parts
"PT027", # PT027: Use `pytest.raises` instead of unittest-style `assertRaises`
"RET503", # RET503: Missing explicit `return` at the end of function able to return non-`None` value
"RUF005", # RUF005: Consider {expression} instead of concatenation
"S101", # S101: Use of `assert` detected
"SIM108", # SIM108: Use ternary operator {contents} instead of if-else-block
"SIM117", # SIM117: Use a single `with` statement with multiple contexts instead of nested `with` statements
"SLF001", # SLF001: Private member accessed: {access}
"TC001", # TC001: Move application import {} into a type-checking block
"TC002", # TC002: Move third-party import {} into a type-checking block
"TD001", # TD001: Invalid TODO tag: `FIXME`
"TD002", # TD002: Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # TD003: Missing issue link on the line following this TODO
"TD004", # TD004: Missing colon in TODO
"TRY003", # TRY003: Avoid specifying long messages outside the exception class
]
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = [
"tbp.monty.frameworks.agents.AgentID",
"tbp.monty.frameworks.environments.environment.SemanticID"
]
[tool.ruff.lint.flake8-comprehensions]
# Our configurations use this all the time
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.flake8-copyright]
author = "Thousand Brains Project"
[tool.ruff.lint.isort]
# wandb creates a folder called 'wandb' during local runs (not logged in)
# this needs to be added to prevent isort from incorrectly sorting
# It can be removed when a fix for this is released:
# https://github.com/astral-sh/ruff/issues/10519
known-third-party = ["wandb"]
[tool.ruff.lint.mccabe]
max-complexity = 18
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.setuptools.dynamic]
version = { attr = "tbp.monty.__version__" }
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
'tbp.monty.conf' = ['**/*.yaml']
# habitat-sim resources
'tbp.monty.simulators.resources' = ['*.json', '*.yml', '*.txt']
[tool.uv]
no-build-isolation-package = ["torch-scatter", "torch-sparse"]