Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify build backend and project metadata in pyproject.toml #100

Merged
merged 9 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
if: ${{ matrix.python-version }} == 3.9
Expand Down Expand Up @@ -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: |
Expand Down
8 changes: 0 additions & 8 deletions dev-requirements.txt

This file was deleted.

65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"}]
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"
Comment on lines +54 to +57
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note that this might need to change if/when a 'Publish to PyPI' GitHub Actions is created, but ok as is for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks!


[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"
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

16 changes: 0 additions & 16 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
57 changes: 2 additions & 55 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"
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"})
6 changes: 2 additions & 4 deletions xbatcher/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down