diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c36d9ee..512993d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -29,12 +29,11 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - run: | - python -m pip install -r dev-requirements.txt - python -m pip install --no-deps -e . + python -m pip install -e .[dev] python -m pip list - name: Running Tests run: | - py.test --verbose --cov=. --cov-report=xml + pytest --verbose --cov=. --cov-report=xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.1.1 if: ${{ matrix.python-version }} == 3.9 @@ -62,11 +61,10 @@ jobs: restore-keys: | ${{ runner.os }}-pip- - run: | - python -m pip install -r dev-requirements.txt + python -m pip install -e .[dev] python -m pip install --no-deps --upgrade \ git+https://github.com/dask/dask \ git+https://github.com/pydata/xarray - python -m pip install --no-deps -e . python -m pip list - name: Running Tests run: | diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index 109677f..0000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -pytest -tensorflow -torch -coverage -pytest-cov -adlfs -asv --r requirements.txt diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..630e4dd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,65 @@ +[build-system] +requires = [ + "setuptools>=61", + "setuptools-scm" +] +build-backend = "setuptools.build_meta" + +[project] +name = 'xbatcher' +description = 'Batch generation from Xarray objects' +license = {text = "Apache"} +authors = [{name = "xbatcher Developers", email = "rpa@ldeo.columbia.edu"}] +classifiers = [ + 'Development Status :: 4 - Beta', + "License :: OSI Approved :: Apache Software License", + 'Operating System :: OS Independent', + 'Intended Audience :: Science/Research', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Topic :: Scientific/Engineering', +] +dynamic = ["version"] +dependencies = [ + "dask", + "numpy", + "xarray", +] +[project.optional-dependencies] +torch = [ + "torch", +] +tensorflow = [ + "tensorflow", +] +dev = [ + "adlfs", + "asv", + "coverage", + "pytest", + "pytest-cov", + "tensorflow", + "torch", +] +[project.urls] +documentation = "https://xbatcher.readthedocs.io/en/latest/" +repository = "https://github.com/xarray-contrib/xbatcher" + +[tool.setuptools.packages.find] +include = ["xbatcher*"] + +[tool.setuptools_scm] +version_scheme = 'post-release' +local_scheme = 'dirty-tag' +fallback_version = "999" + +[tool.isort] +profile = 'black' +known_third_party = ["numpy", "pytest", "setuptools", "sphinx_autosummary_accessors", "tensorflow", "torch", "xarray"] + +[tool.pytest.ini_options] +log_cli = true +log_level = "INFO" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9484f45..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -dask -numpy -xarray diff --git a/setup.cfg b/setup.cfg index e74bfda..3a24eb3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,19 +4,3 @@ ignore = E203,E266,E501,W503,E722,E402,C901 max-line-length = 80 max-complexity = 18 select = B,C,E,F,W,T4,B9 - -[isort] -known_first_party=xbatcher -known_third_party=numpy,pytest,setuptools,sphinx_autosummary_accessors,tensorflow,torch,xarray -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -combine_as_imports=True -line_length=80 -skip= - doc/conf.py - setup.py - -[tool:pytest] -log_cli = True -log_level = INFO diff --git a/setup.py b/setup.py index 9a9f618..088d7e4 100644 --- a/setup.py +++ b/setup.py @@ -1,57 +1,4 @@ #!/usr/bin/env python -# type: ignore -import os +from setuptools import setup -from setuptools import find_packages, setup - -DISTNAME = "xbatcher" -LICENSE = "Apache" -AUTHOR = "xbatcher Developers" -AUTHOR_EMAIL = "rpa@ldeo.columbia.edu" -URL = "https://github.com/xarray-contrib/xbatcher" -CLASSIFIERS = [ - "Development Status :: 4 - Beta", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - "Intended Audience :: Science/Research", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Topic :: Scientific/Engineering", -] - -DESCRIPTION = "Batch generation from xarray dataset" - -with open("requirements.txt") as f: - install_requires = f.read().strip().split("\n") - -with open("dev-requirements.txt") as f: - test_requires = f.read().strip().split("\n") - -if os.path.exists("README.rst"): - with open("README.rst") as f: - long_description = f.read() -else: - long_description = "" - - -setup( - name=DISTNAME, - license=LICENSE, - author=AUTHOR, - author_email=AUTHOR_EMAIL, - classifiers=CLASSIFIERS, - description=DESCRIPTION, - long_description=long_description, - python_requires=">=3.8", - install_requires=install_requires, - url=URL, - packages=find_packages(), - use_scm_version={ - "version_scheme": "post-release", - "local_scheme": "dirty-tag", - }, - setup_requires=["setuptools_scm", "setuptools>=30.3.0"], -) +setup(use_scm_version={"fallback_version": "999"}) diff --git a/xbatcher/__init__.py b/xbatcher/__init__.py index 01c062a..b7bd073 100644 --- a/xbatcher/__init__.py +++ b/xbatcher/__init__.py @@ -1,7 +1,5 @@ -from importlib.metadata import ( - PackageNotFoundError as _PackageNotFoundError, - version as _version, -) +from importlib.metadata import PackageNotFoundError as _PackageNotFoundError +from importlib.metadata import version as _version from .accessors import BatchAccessor # noqa: F401 from .generators import BatchGenerator # noqa: F401