Skip to content

Commit

Permalink
Switching from versioneer to setuptools-scm (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
Takaya Uchida authored Sep 11, 2021
1 parent 744209f commit 491cc24
Show file tree
Hide file tree
Showing 16 changed files with 147 additions and 2,542 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
27 changes: 0 additions & 27 deletions .github/workflows/pythonpublish.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check and Maybe Release Python Package

on: [push, pull_request]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools setuptools-scm wheel twine toml
- name: Build package
run: |
python setup.py sdist bdist_wheel
python setup.py --version
twine check dist/*
- name: Publish to pypi
if: startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ target/

# notebook
*/.ipynb_checkpoints/*

# Pyre type checker
.pyre/
_version.py
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

repos:
- repo: https://github.com/python/black

- repo: https://github.com/python/black
rev: 21.6b0
hooks:
- id: black
- id: black

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include versioneer.py
include LICENSE
include xrft/_version.py
5 changes: 4 additions & 1 deletion ci/environment-py3.6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ dependencies:
- numpy
- numpy_groupies
- pytest
- pytest-cov
- pip
- black
- cftime
- setuptools
- pip:
- codecov
- pytest-cov
- pytest-xdist
- setuptools-scm
- toml
5 changes: 4 additions & 1 deletion ci/environment-py3.7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ dependencies:
- numpy
- numpy_groupies
- pytest
- pytest-cov
- pip
- black
- cftime
- setuptools
- pip:
- codecov
- pytest-cov
- pytest-xdist
- setuptools-scm
- toml
5 changes: 4 additions & 1 deletion ci/environment-py3.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ dependencies:
- numpy
- numpy_groupies
- pytest
- pytest-cov
- pip
- black
- cftime
- setuptools
- pip:
- codecov
- pytest-cov
- pytest-xdist
- setuptools-scm
- toml
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ coverage:

ignore:
- "setup.py"
- "versioneer.py"
- "setup.cfg"
- "pyproject.toml"
- "xrft/test/*"
- "xrft/__init__.py"
- "xrft/_version.py"
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# pyproject.toml
[build-system]
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=6.0",
"setuptools_scm_git_archive",
"wheel"
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "xrft/_version.py"
write_to_template = "__version__ = '{version}'"

68 changes: 58 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,19 +1,63 @@
[metadata]
description-file = README.rst
name = xrft
description = Discrete Fourier Transform with xarray
long_description = file: README.rst
long_description_content_type = text/x-rst; charset=UTF-8
url = https://github.com/xgcm/xrft
author = xrft Developers
author_email = [email protected]
license = MIT
license_file = LICENSE
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Scientific/Engineering
project_urls =
Documentation = https://xrft.readthedocs.io/en/latest/
Source = https://github.com/xgcm/xrft
Tracker = https://github.com/xgcm/xrft/issues

[options]
zip_safe = False
packages = find:
platforms = any
include_package_data = True
install_requires =
xarray
dask
numpy
pandas
scipy
setuptools
python_requires = >=3.6
setup_requires =
setuptools_scm
pytest-runner
extra_requires =
cftime
numpy_groupies

[bdist_wheel]
universal = 1

[aliases]
test=pytest

[versioneer]
VCS = git
style = pep440
versionfile_source = xrft/_version.py
versionfile_build = xrft/_version.py
tag_prefix = v
parentdir_prefix = xrft-
[options.extras_require]
test =
pytest >= 6.2.2
pytest-cov
all =
%(test)s

[flake8]
exclude = __init__.py,versioneer.py,.eggs,doc
exclude = __init__.py,pyproject.toml,.eggs,doc
ignore =
# whitespace before ':' - doesn't work well with black
E203
Expand All @@ -23,4 +67,8 @@ ignore =
# do not assign a lambda expression, use a def
E731
# line break before binary operator
W503
W503

[isort]
known_first_party=xrft
known_third_party=dask,numpy,pandas,pytest,pytest_lazyfixture,setuptools,sphinx_book_theme,xarray,zarr
55 changes: 4 additions & 51 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,53 +1,6 @@
import os
import versioneer
from setuptools import setup, find_packages
#!/usr/bin/env python

PACKAGES = find_packages()
import setuptools

DISTNAME = "xrft"
LICENSE = "MIT"
AUTHOR = "xrft Developers"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/xgcm/xrft"
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.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering",
]

INSTALL_REQUIRES = ["xarray", "dask", "numpy", "pandas", "scipy"]
EXTRAS_REQUIRE = ["cftime", "numpy_groupies"]
SETUP_REQUIRES = ["pytest-runner"]
TESTS_REQUIRE = ["pytest >= 2.8", "coverage"]

DESCRIPTION = "Discrete Fourier Transform with xarray"


def readme():
with open("README.rst") as f:
return f.read()


setup(
name=DISTNAME,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
license=LICENSE,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
classifiers=CLASSIFIERS,
description=DESCRIPTION,
long_description=readme(),
install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES,
tests_require=TESTS_REQUIRE,
url=URL,
packages=find_packages(),
)
if __name__ == "__main__":
setuptools.setup()
Loading

0 comments on commit 491cc24

Please sign in to comment.