Skip to content

Commit 172844b

Browse files
authored
Refactor BatchSchema and BatchGenerator for handling of optional parameters (#257)
1 parent d96a2a2 commit 172844b

File tree

2 files changed

+164
-166
lines changed

2 files changed

+164
-166
lines changed

pyproject.toml

Lines changed: 110 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,134 @@
11
[build-system]
2-
requires = [
3-
"setuptools>=64",
4-
"setuptools-scm[toml]>=6.2"
5-
]
6-
build-backend = "setuptools.build_meta"
2+
build-backend = "setuptools.build_meta"
3+
requires = ["setuptools-scm[toml]>=6.2", "setuptools>=64"]
74

85
[project]
9-
name = "xbatcher"
10-
description = "Batch generation from Xarray objects"
11-
readme = "README.rst"
12-
license = {text = "Apache"}
13-
authors = [{name = "xbatcher Developers", email = "[email protected]"}]
14-
requires-python = ">=3.10"
15-
classifiers = [
16-
"Development Status :: 4 - Beta",
17-
"License :: OSI Approved :: Apache Software License",
18-
"Operating System :: OS Independent",
19-
"Intended Audience :: Science/Research",
20-
"Programming Language :: Python",
21-
"Programming Language :: Python :: 3",
22-
"Programming Language :: Python :: 3.10",
23-
"Programming Language :: Python :: 3.11",
24-
"Programming Language :: Python :: 3.12",
25-
"Topic :: Scientific/Engineering",
26-
]
27-
dynamic = ["version"]
28-
dependencies = [
29-
"dask",
30-
"numpy",
31-
"xarray",
32-
]
6+
authors = [
7+
{ name = "xbatcher Developers", email = "[email protected]" },
8+
]
9+
classifiers = [
10+
"Development Status :: 4 - Beta",
11+
"Intended Audience :: Science/Research",
12+
"License :: OSI Approved :: Apache Software License",
13+
"Operating System :: OS Independent",
14+
"Programming Language :: Python :: 3",
15+
"Programming Language :: Python :: 3.10",
16+
"Programming Language :: Python :: 3.11",
17+
"Programming Language :: Python :: 3.12",
18+
"Programming Language :: Python",
19+
"Topic :: Scientific/Engineering",
20+
]
21+
dependencies = ["dask", "numpy", "xarray"]
22+
description = "Batch generation from Xarray objects"
23+
dynamic = ["version"]
24+
license = { text = "Apache" }
25+
name = "xbatcher"
26+
readme = "README.rst"
27+
requires-python = ">=3.10"
3328
[project.optional-dependencies]
34-
torch = [
35-
"torch",
36-
]
37-
tensorflow = [
38-
"tensorflow",
39-
]
40-
dev = [
41-
"adlfs",
42-
"asv",
43-
"coverage",
44-
"pytest",
45-
"pytest-cov",
46-
"tensorflow",
47-
"torch",
48-
"zarr",
49-
]
29+
dev = [
30+
"adlfs",
31+
"asv",
32+
"coverage",
33+
"pytest",
34+
"pytest-cov",
35+
"tensorflow",
36+
"torch",
37+
"zarr<3.0",
38+
]
39+
tensorflow = ["tensorflow"]
40+
torch = ["torch"]
5041
[project.urls]
51-
documentation = "https://xbatcher.readthedocs.io/en/latest/"
52-
repository = "https://github.com/xarray-contrib/xbatcher"
42+
documentation = "https://xbatcher.readthedocs.io/en/latest/"
43+
repository = "https://github.com/xarray-contrib/xbatcher"
5344

5445
[tool.setuptools.packages.find]
55-
include = ["xbatcher*"]
46+
include = ["xbatcher*"]
5647

5748
[tool.setuptools_scm]
58-
local_scheme = "node-and-date"
59-
fallback_version = "999"
60-
61-
49+
fallback_version = "999"
50+
local_scheme = "node-and-date"
6251

6352
[tool.ruff]
64-
target-version = "py310"
65-
extend-include = ["*.ipynb"]
66-
67-
68-
builtins = ["ellipsis"]
69-
# Exclude a variety of commonly ignored directories.
70-
exclude = [
71-
".bzr",
72-
".direnv",
73-
".eggs",
74-
".git",
75-
".git-rewrite",
76-
".hg",
77-
".ipynb_checkpoints",
78-
".mypy_cache",
79-
".nox",
80-
".pants.d",
81-
".pyenv",
82-
".pytest_cache",
83-
".pytype",
84-
".ruff_cache",
85-
".svn",
86-
".tox",
87-
".venv",
88-
".vscode",
89-
"__pypackages__",
90-
"_build",
91-
"buck-out",
92-
"build",
93-
"dist",
94-
"node_modules",
95-
"site-packages",
96-
"venv",
97-
]
53+
extend-include = ["*.ipynb"]
54+
target-version = "py310"
55+
56+
builtins = ["ellipsis"]
57+
# Exclude a variety of commonly ignored directories.
58+
exclude = [
59+
".bzr",
60+
".direnv",
61+
".eggs",
62+
".git",
63+
".git-rewrite",
64+
".hg",
65+
".ipynb_checkpoints",
66+
".mypy_cache",
67+
".nox",
68+
".pants.d",
69+
".pyenv",
70+
".pytest_cache",
71+
".pytype",
72+
".ruff_cache",
73+
".svn",
74+
".tox",
75+
".venv",
76+
".vscode",
77+
"__pypackages__",
78+
"_build",
79+
"buck-out",
80+
"build",
81+
"dist",
82+
"node_modules",
83+
"site-packages",
84+
"venv",
85+
]
9886
[tool.ruff.lint]
99-
per-file-ignores = {}
100-
ignore = [
101-
"E721", # Comparing types instead of isinstance
102-
"E741", # Ambiguous variable names
103-
"E501", # Conflicts with ruff format
104-
]
105-
select = [
106-
# Pyflakes
107-
"F",
108-
# Pycodestyle
109-
"E",
110-
"W",
111-
# isort
112-
"I",
113-
# Pyupgrade
114-
"UP",
115-
]
116-
87+
ignore = [
88+
"E501", # Conflicts with ruff format
89+
"E721", # Comparing types instead of isinstance
90+
"E741", # Ambiguous variable names
91+
]
92+
per-file-ignores = {}
93+
select = [
94+
# Pyflakes
95+
"F",
96+
# Pycodestyle
97+
"E",
98+
"W",
99+
# isort
100+
"I",
101+
# Pyupgrade
102+
"UP",
103+
]
117104

118105
[tool.ruff.lint.mccabe]
119-
max-complexity = 18
106+
max-complexity = 18
120107

121108
[tool.ruff.lint.isort]
122-
known-first-party = ["xbatcher"]
123-
known-third-party = ["numpy", "pandas", "pytest", "sphinx_autosummary_accessors", "torch", "xarray"]
124-
125-
combine-as-imports = true
109+
known-first-party = ["xbatcher"]
110+
known-third-party = [
111+
"numpy",
112+
"pandas",
113+
"pytest",
114+
"sphinx_autosummary_accessors",
115+
"torch",
116+
"xarray",
117+
]
118+
119+
combine-as-imports = true
126120

127121
[tool.ruff.format]
128-
quote-style = "single"
129-
docstring-code-format = true
122+
docstring-code-format = true
123+
quote-style = "single"
130124

131125
[tool.ruff.lint.pydocstyle]
132-
convention = "numpy"
126+
convention = "numpy"
133127

134128
[tool.ruff.lint.pyupgrade]
135-
# Preserve types, even if a file imports `from __future__ import annotations`.
136-
keep-runtime-typing = true
129+
# Preserve types, even if a file imports `from __future__ import annotations`.
130+
keep-runtime-typing = true
137131

138132
[tool.pytest.ini_options]
139-
log_cli = true
140-
log_level = "INFO"
133+
log_cli = true
134+
log_level = "INFO"

0 commit comments

Comments
 (0)