-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
242 lines (226 loc) · 5.52 KB
/
pyproject.toml
File metadata and controls
242 lines (226 loc) · 5.52 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
# Build system requirements.
[build-system]
requires = ["flit_core >=3.11,<4"]
build-backend = "flit_core.buildapi"
[project]
name = "ray_utilities"
version = "1.0.0.rc2"
readme = "README.md"
description = "Utilities for Ray RLlib and related workflows. Includes experiment setup, callbacks, and JAX model utilities."
license = { file = "LICENSE" }
requires-python = ">=3.10"
authors = [
{ name = "Daniel Sperber", email = "github.ray_utilities.blurry@9ox.net" }
]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
"ray[tune,rllib] < 2.50.0",
"click!=8.3.0",
"typed-argument-parser",
"tqdm",
"colorlog",
"opencv-python",
"python-dotenv",
"frozenlist",
"frozendict",
"torch", # maybe optional
"comet_ml", # remove later -> optional
"wandb", # remove later -> optional
"optuna", # remove later -> optional
"jax", # remove later -> optional
"exceptiongroup; python_version < '3.11'",
"pybase62==1.0.0",
"typing_extensions >= 4.13",
]
[project.optional-dependencies]
test = [
"pytest",
"pytest-timeout",
"pytest-subtests",
"debugpy",
"testfixtures",
"flaky",
]
wandb = [
"wandb>=0.16.5",
"selenium>=4.15.0", # wandb server limitation; for fork uploading
]
comet = [
"comet_ml",
]
optuna = [
"optuna",
]
jax = [
"jax",
"chex",
"distrax",
"flax",
]
argcomplete = [
"argcomplete",
]
[tool.black]
line-length = 120
target-version = ['py39', 'py310', 'py311']
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
[tool.ruff]
line-length = 120
[tool.ruff.lint]
#preview=true
select = [
"ARG",
"B",
"BLE",
"C4",
"COM818",
"D20",
"E",
"FA102",
"FBT",
"F",
"FIX", # todo, xxx, fixme
"FURB",
"G", # Log formatting
"ICN", # Import Conventions
"ISC", # Implicit String Concat
"LOG", # logging
"N",
"NPY", # numpy
"PD", # Pandas
"PERF",
"PIE",
"PLC",
"PLE",
"PLR",
"PLR0402", # import A.B as B; from A import B
"PLR2044", # empty comment
"PLW",
"PYI",
"Q003", "Q004",
"RET",
"RUF",
"SLOT", # Reduce memory when using __slots__
"TC",
"T100",
"TID", # relative | slow imports
"TID251", # banned API, options see below, avoid import from downstream packages
"TRY",
"W",
"YTT", # sys.version_info comparison
]
ignore = [
"D203", "D205",
"RET504", # assignment before return
"RUF100", # Unused noqa
"SIM108", # Use ternary assignments instead of if blocks
"SIM300", # Yoda triggers on GYM_VERSION >= Version("1.0.0")
"N806", "N812", # Upercase variables
"PLR09", # Too many
"TRY003", "TRY400", # To long error messages, use logging.exception over error
"PLR2004", # Magic Values
"NPY002", # Use random generator
"PYI051", # str | Literal in type hint
]
exclude = [
".git",
".mypy_cache",
".tox",
".venv",
"build",
"dist",
]
[tool.ruff.format]
docstring-code-format = true
exclude = [
".git",
]
[tool.ruff.lint.isort]
force-single-line = false # default: false
[tool.ruff.lint.pyflakes]
# Avoid F401 error when Generic is not detected
extend-generics = [
"ray_utilities.setup.experiment_base.ExperimentSetupBase",
"ray_utilities.setup.scheduled_tuner_setup.PBTSetup",
"ray_utilities.setup.scheduled_tuner_setup.MLPPBTSetup",
"ray_utilities.jax.jax_model.FlaxRLModel",
"ray_utilities.setup.ppo_mlp_setup.MLPSetup",
"ray_utilities.setup.ppo_mlp_setup.PPOMLPSetup",
"ray_utilities.config.DefaultArgumentParser",
"ray_utilities.config.parser.default_argument_parser.DefaultArgumentParser",
]
allowed-unused-imports = ["hvplot.pandas", "default_arguments.PYTHON_ARGCOMPLETE_OK"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
# during dev/refactoring phase make sure not to import from downstream packages
"SYMPOL".msg = "Import from downstream packages; missing refactoring."
"rllib_port".msg = "Import from downstream packages; missing refactoring."
"docs".msg = "Importing from docs is not allowed."
[tool.ruff.lint.per-file-ignores]
"test/**/*.py" = ["ARG", "D", "SIM117", "PLC0415"]
"ray_utilities/testing_utils.py" = ["D"]
"ray_utilities/callbacks/**/*.py" = ["ARG"]
"ray_utilities/jax/ppo/jax_ppo_learner.py" = ["B018"] # blank expression for IDE references for now
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-builtins]
ignorelist = ["copyright"]
[tool.isort]
split_on_trailing_comma = true
include_trailing_comma = true
profile = "black"
known_third_party = [
"default_arguments", # This is a a lie, default_arguments should be at the top as it applies mocking
"wandb",
"jax",
]
line_length = 120
extraPaths = ["sympol"]
[tool.pyright]
reportDeprecated = "warning"
reportUnnecessaryComparison = "warning"
reportUnnecessaryCast = "warning"
defineConstant = {IS_PYDANTIC_V2 = true}
exclude = [
"**/node_modules",
"**/__pycache__",
"build",
"dist",
".venv",
"**/outputs/**",
".git/*",
".vscode/*"
]
[tool.pytest.ini_options]
console_output_style = "count"
timeout = 240
session_timeout = 1200
markers = [
"tuner",
"basic: Mark tests that should be tested first - if they fail others likely fail",
"env_runner_cases",
"length: Mark tests that are fast/medium/slow to execute",
"flaky: Mark tests as flaky to automatically rerun them on failure",
]
testpaths = [
"test"
]