-
Notifications
You must be signed in to change notification settings - Fork 653
/
pyproject.toml
231 lines (212 loc) · 7.02 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
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
name = "flax"
requires-python = ">=3.10"
description = "Flax: A neural network library for JAX designed for flexibility"
keywords = []
authors = [
{name = "Flax team", email = "[email protected]"},
]
dependencies = [
"numpy>=1.23.2; python_version>='3.11'",
"numpy>=1.26.0; python_version>='3.12'",
# keep in sync with jax-version in .github/workflows/build.yml
"jax>=0.4.27",
"msgpack",
"optax",
"orbax-checkpoint",
"tensorstore",
"rich>=11.1",
"typing_extensions>=4.2",
"PyYAML>=5.4.1",
"treescope>=0.1.2",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dynamic = ["version", "readme"]
[project.optional-dependencies]
all = [
"matplotlib", # only needed for tensorboard export
]
testing = [
"clu",
"clu<=0.0.9; python_version<'3.10'",
"einops",
"gymnasium[atari, accept-rom-license]",
"jaxlib",
"jaxtyping",
"jraph>=0.0.6dev0",
"ml-collections",
"mypy",
"opencv-python",
"pytest",
"pytest-cov",
"pytest-custom_exit_code",
"pytest-xdist",
"pytype",
# WMT/LM1B examples
"sentencepiece",
"tensorflow_text>=2.11.0; platform_system!='Darwin'",
"tensorflow_datasets",
"tensorflow>=2.12.0", # to fix Numpy np.bool8 deprecation error
"torch",
"treescope>=0.1.1; python_version>='3.10'",
"cloudpickle>=3.0.0",
]
docs = [
"sphinx>=3.3.1",
"sphinx-book-theme",
"Pygments>=2.6.1",
"ipykernel",
"myst_nb",
"nbstripout",
"recommonmark",
"ipython_genutils",
"sphinx-design",
"jupytext==1.13.8",
"dm-haiku",
# Need to pin docutils to 0.16 to make bulleted lists appear correctly on
# ReadTheDocs: https://stackoverflow.com/a/68008428
"docutils==0.16",
# The next packages are for notebooks.
"matplotlib",
"scikit-learn",
# The next packages are used in testcode blocks.
"ml_collections",
# notebooks
"einops",
"kagglehub>=0.3.3",
"ipywidgets>=8.1.5",
]
dev = [
"pre-commit>=3.8.0",
]
[project.urls]
homepage = "https://github.com/google/flax"
[tool.setuptools.dynamic]
readme = {file = ["README.md"], content-type = "text/markdown"}
version = {attr = "flax.version.__version__"}
[tool.setuptools.packages.find]
include = ["flax*"]
[tool.setuptools.package-data]
flax = ["*py.typed"]
[tool.yapf]
based_on_style = "yapf"
[tool.pytype]
# TODO(levskaya): figure out why we get pyi-error from flax's root __init__.py
# could be a pytype bug.
disable = "pyi-error"
[tool.mypy]
show_error_codes = true
no_implicit_optional = true
disable_error_code = "attr-defined"
[[tool.mypy.overrides]]
module = [
"tensorflow.*",
"tensorboard.*",
"absl.*",
"jax.*",
"rich.*",
"flax.*",
"jaxlib.cuda.*",
"jaxlib.cpu.*",
"msgpack",
"numpy.*",
"optax.*",
"orbax.*",
"opt_einsum.*",
"scipy.*",
"libtpu.*",
"jaxlib.mlir.*",
"yaml",
]
ignore_missing_imports = true
disable_error_code = "annotation-unchecked"
# exclude nnx examples
[[tool.mypy.overrides]]
module = "flax.nnx.examples.*"
ignore_errors = true
[tool.pytest.ini_options]
filterwarnings = [
# By default error out on any warnings.
"error",
# Jax warning when no gpu/tpu found.
"ignore:No GPU/TPU found, falling back to CPU.*:UserWarning",
# traverse_util.Traversal will be removed soon.
"ignore:`flax.traverse_util.Traversal` will be deprecated.*:DeprecationWarning",
# Deprecated legacy checkpoint - just want to keep the tests running for a while
"ignore:Flax Checkpointing will soon be deprecated in favor of Orbax.*:DeprecationWarning",
# DeprecationWarning: The inputs_kv arg will be deprecated soon. Use inputs_k and inputs_v instead.
"ignore:.*The inputs_kv arg will be deprecated soon. Use inputs_k and inputs_v instead.*:DeprecationWarning",
# DeprecationWarning: the function signature of MultiHeadDotProductAttention's `__call__` method has changed
"ignore:.*the function signature of MultiHeadDotProductAttention's `__call__` method has changed.*:DeprecationWarning",
# DeprecationWarning: ml_dtypes.float8_e4m3b11 is deprecated.
"ignore:.*ml_dtypes.float8_e4m3b11 is deprecated.*:DeprecationWarning",
# DeprecationWarning: jax.config.define_bool_state is deprecated. Please use other libraries for configuration instead.
"ignore:.*jax.config.define_bool_state is deprecated.:DeprecationWarning",
# pytest-cov uses a deprecated feature of pytest-xdist. (2023-11-06)
"ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning",
# DeprecationWarning: jax.random.KeyArray is deprecated.
"ignore:.*jax.random.KeyArray is deprecated.*:DeprecationWarning",
# DeprecationWarning: jax.core.Shape is deprecated.
"ignore:.*jax.core.Shape is deprecated.*:DeprecationWarning",
# DeprecationWarning: pkg_resources is deprecated as an API.
"ignore:.*pkg_resources is deprecated as an API.*:DeprecationWarning",
# DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
"ignore:.*Deprecated call to.*pkg_resources.declare_namespace.*:DeprecationWarning",
# jax.xla_computation is deprecated but TF still uses it.
"ignore:.*jax.xla_computation is deprecated.*:DeprecationWarning",
# Orbax warnings inside deprecated `flax.training` package.
"ignore:.*Couldn't find sharding info under RestoreArgs.*:UserWarning",
# RuntimeWarning: invalid value encountered in cast
"ignore:.*invalid value encountered in cast.*:RuntimeWarning",
# RuntimeWarning: divide by zero encountered in equal/not_equal
"ignore:.*divide by zero encountered in.*:RuntimeWarning",
# DeprecationWarning: numpy.core is deprecated
"ignore:.*numpy.core is deprecated.*:DeprecationWarning",
]
[tool.coverage.report]
exclude_lines = [
"@abc.abstractmethod",
"raise NotImplementedError",
]
[tool.pyink]
pyink-indentation = 2
pyink-use-majority-quotes = true
line-length = 80
preview = true
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
"__init__.py",
"activation.py",
"partitioning.py",
"flax/core/variables.py",
"examples/",
]
line-length = 80
indent-width = 2
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["F401"]
ignore = []
# Allow fix for all enabled rules (when `--fix`) is provided.
# Full list of rules: https://docs.astral.sh/ruff/rules/
fixable = ["ALL"]
unfixable = []
[tool.ruff.format]
indent-style = "space"
quote-style = "single"
[tool.uv]
# Ignore uv.lock and always upgrade the package to the latest
upgrade-package = ["jax", "jaxlib", "orbax-checkpoint"]