Skip to content

Commit 44fd755

Browse files
Max Jonesweiji14andersy005
authored
Specify build backend and project metadata in pyproject.toml (#100)
* Specify build backend and project metadata in pyproject.toml * Update test workflow * Update dev test workflow Co-authored-by: Wei Ji <[email protected]> Co-authored-by: Anderson Banihirwe <[email protected]>
1 parent 54ebaa7 commit 44fd755

File tree

7 files changed

+72
-91
lines changed

7 files changed

+72
-91
lines changed

.github/workflows/main.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ jobs:
2929
restore-keys: |
3030
${{ runner.os }}-pip-
3131
- run: |
32-
python -m pip install -r dev-requirements.txt
33-
python -m pip install --no-deps -e .
32+
python -m pip install -e .[dev]
3433
python -m pip list
3534
- name: Running Tests
3635
run: |
37-
py.test --verbose --cov=. --cov-report=xml
36+
pytest --verbose --cov=. --cov-report=xml
3837
- name: Upload coverage to Codecov
3938
uses: codecov/[email protected]
4039
if: ${{ matrix.python-version }} == 3.9
@@ -62,11 +61,10 @@ jobs:
6261
restore-keys: |
6362
${{ runner.os }}-pip-
6463
- run: |
65-
python -m pip install -r dev-requirements.txt
64+
python -m pip install -e .[dev]
6665
python -m pip install --no-deps --upgrade \
6766
git+https://github.com/dask/dask \
6867
git+https://github.com/pydata/xarray
69-
python -m pip install --no-deps -e .
7068
python -m pip list
7169
- name: Running Tests
7270
run: |

dev-requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

pyproject.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=61",
4+
"setuptools-scm"
5+
]
6+
build-backend = "setuptools.build_meta"
7+
8+
[project]
9+
name = 'xbatcher'
10+
description = 'Batch generation from Xarray objects'
11+
license = {text = "Apache"}
12+
authors = [{name = "xbatcher Developers", email = "[email protected]"}]
13+
classifiers = [
14+
'Development Status :: 4 - Beta',
15+
"License :: OSI Approved :: Apache Software License",
16+
'Operating System :: OS Independent',
17+
'Intended Audience :: Science/Research',
18+
'Programming Language :: Python',
19+
'Programming Language :: Python :: 3',
20+
'Programming Language :: Python :: 3.8',
21+
'Programming Language :: Python :: 3.9',
22+
'Programming Language :: Python :: 3.10',
23+
'Topic :: Scientific/Engineering',
24+
]
25+
dynamic = ["version"]
26+
dependencies = [
27+
"dask",
28+
"numpy",
29+
"xarray",
30+
]
31+
[project.optional-dependencies]
32+
torch = [
33+
"torch",
34+
]
35+
tensorflow = [
36+
"tensorflow",
37+
]
38+
dev = [
39+
"adlfs",
40+
"asv",
41+
"coverage",
42+
"pytest",
43+
"pytest-cov",
44+
"tensorflow",
45+
"torch",
46+
]
47+
[project.urls]
48+
documentation = "https://xbatcher.readthedocs.io/en/latest/"
49+
repository = "https://github.com/xarray-contrib/xbatcher"
50+
51+
[tool.setuptools.packages.find]
52+
include = ["xbatcher*"]
53+
54+
[tool.setuptools_scm]
55+
version_scheme = 'post-release'
56+
local_scheme = 'dirty-tag'
57+
fallback_version = "999"
58+
59+
[tool.isort]
60+
profile = 'black'
61+
known_third_party = ["numpy", "pytest", "setuptools", "sphinx_autosummary_accessors", "tensorflow", "torch", "xarray"]
62+
63+
[tool.pytest.ini_options]
64+
log_cli = true
65+
log_level = "INFO"

requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,3 @@ ignore = E203,E266,E501,W503,E722,E402,C901
44
max-line-length = 80
55
max-complexity = 18
66
select = B,C,E,F,W,T4,B9
7-
8-
[isort]
9-
known_first_party=xbatcher
10-
known_third_party=numpy,pytest,setuptools,sphinx_autosummary_accessors,tensorflow,torch,xarray
11-
multi_line_output=3
12-
include_trailing_comma=True
13-
force_grid_wrap=0
14-
combine_as_imports=True
15-
line_length=80
16-
skip=
17-
doc/conf.py
18-
setup.py
19-
20-
[tool:pytest]
21-
log_cli = True
22-
log_level = INFO

setup.py

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,4 @@
11
#!/usr/bin/env python
2-
# type: ignore
3-
import os
2+
from setuptools import setup
43

5-
from setuptools import find_packages, setup
6-
7-
DISTNAME = "xbatcher"
8-
LICENSE = "Apache"
9-
AUTHOR = "xbatcher Developers"
10-
AUTHOR_EMAIL = "[email protected]"
11-
URL = "https://github.com/xarray-contrib/xbatcher"
12-
CLASSIFIERS = [
13-
"Development Status :: 4 - Beta",
14-
"License :: OSI Approved :: Apache Software License",
15-
"Operating System :: OS Independent",
16-
"Intended Audience :: Science/Research",
17-
"Programming Language :: Python",
18-
"Programming Language :: Python :: 3",
19-
"Programming Language :: Python :: 3.8",
20-
"Programming Language :: Python :: 3.9",
21-
"Programming Language :: Python :: 3.10",
22-
"Topic :: Scientific/Engineering",
23-
]
24-
25-
DESCRIPTION = "Batch generation from xarray dataset"
26-
27-
with open("requirements.txt") as f:
28-
install_requires = f.read().strip().split("\n")
29-
30-
with open("dev-requirements.txt") as f:
31-
test_requires = f.read().strip().split("\n")
32-
33-
if os.path.exists("README.rst"):
34-
with open("README.rst") as f:
35-
long_description = f.read()
36-
else:
37-
long_description = ""
38-
39-
40-
setup(
41-
name=DISTNAME,
42-
license=LICENSE,
43-
author=AUTHOR,
44-
author_email=AUTHOR_EMAIL,
45-
classifiers=CLASSIFIERS,
46-
description=DESCRIPTION,
47-
long_description=long_description,
48-
python_requires=">=3.8",
49-
install_requires=install_requires,
50-
url=URL,
51-
packages=find_packages(),
52-
use_scm_version={
53-
"version_scheme": "post-release",
54-
"local_scheme": "dirty-tag",
55-
},
56-
setup_requires=["setuptools_scm", "setuptools>=30.3.0"],
57-
)
4+
setup(use_scm_version={"fallback_version": "999"})

xbatcher/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
from importlib.metadata import (
2-
PackageNotFoundError as _PackageNotFoundError,
3-
version as _version,
4-
)
1+
from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
2+
from importlib.metadata import version as _version
53

64
from .accessors import BatchAccessor # noqa: F401
75
from .generators import BatchGenerator # noqa: F401

0 commit comments

Comments
 (0)