forked from google/flax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
192 lines (175 loc) · 6.01 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
[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.22",
"numpy>=1.23.2; python_version>='3.11'",
"numpy>=1.26.0; python_version>='3.12'",
"jax>=0.4.27", # keep in sync with jax-version in .github/workflows/build.yml
"msgpack",
"optax",
"orbax-checkpoint",
"tensorstore",
"rich>=11.1",
"typing_extensions>=4.2",
"PyYAML>=5.4.1",
]
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", # All examples.
"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",
"sentencepiece", # WMT/LM1B examples
"tensorflow_text>=2.11.0", # WMT/LM1B examples
"tensorflow_datasets",
"tensorflow>=2.12.0", # to fix Numpy np.bool8 deprecation error
"torch",
"nbstripout",
"black[jupyter]==23.7.0",
# "pyink==23.5.0", # disabling pyink fow now
"penzai>=0.1.2; python_version>='3.10'",
]
[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",
# FutureWarning: The key path API is deprecated and will be removed in a future version
"ignore:.*The key path API is deprecated and will be removed in a future version.*:FutureWarning",
]
[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"