diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index a856225c..2368084a 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -31,10 +31,10 @@ jobs: python-version: '3.9' - name: Install requirements - run: pip install black + run: python -m pip install -r env/requirements-style.txt - name: List installed packages - run: pip freeze + run: python -m pip freeze - name: Check code format run: make black-check @@ -53,10 +53,10 @@ jobs: python-version: '3.9' - name: Install requirements - run: pip install flake8 + run: python -m pip install -r env/requirements-style.txt - name: List installed packages - run: pip freeze + run: python -m pip freeze - name: Check code style run: make flake8 @@ -75,10 +75,10 @@ jobs: python-version: '3.9' - name: Install requirements - run: pip install pylint==2.4.* + run: python -m pip install -r env/requirements-style.txt - name: List installed packages - run: pip freeze + run: python -m pip freeze - name: Linting (pylint) run: make lint @@ -97,10 +97,10 @@ jobs: python-version: '3.9' - name: Install requirements - run: pip install pathspec + run: python -m pip install -r env/requirements-style.txt - name: List installed packages - run: pip freeze + run: python -m pip freeze - name: Check license notice on all source files run: make license-check diff --git a/.gitignore b/.gitignore index 48f09ed9..3b4c9052 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ doc/sample_data MANIFEST dask-worker-space .coverage.* +boule/_version.py diff --git a/.pylintrc b/.pylintrc index 61652d0d..f3194b08 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,7 +7,7 @@ extension-pkg-whitelist=numpy # Add files or directories to the blacklist. They should be base names, not # paths. -ignore=CVS +ignore=CVS,_version.py # Add files or directories matching the regex patterns to the blacklist. The # regex matches against base names, not paths. diff --git a/MANIFEST.in b/MANIFEST.in index c37c1312..60322a31 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,12 @@ -include README.rst -include LICENSE.txt -include CODE_OF_CONDUCT.md -include CONTRIBUTING.md -include AUTHORS.md -include requirements.txt +# Exclude these files from source distributions. +# setuptools_scm includes everything else by default. +prune .github +prune env +prune doc +exclude .*.yml +exclude .*rc +exclude requirements*.txt +exclude Makefile +exclude .gitignore +exclude .gitattributes +exclude environment.yml diff --git a/boule/__init__.py b/boule/__init__.py index 84882ea1..b0de5fcb 100644 --- a/boule/__init__.py +++ b/boule/__init__.py @@ -4,18 +4,21 @@ # # This code is part of the Fatiando a Terra project (https://www.fatiando.org) # -# pylint: disable=missing-docstring,import-outside-toplevel +# pylint: disable=missing-docstring,import-outside-toplevel,import-self +# # Import functions/classes to make the public API -from . import version from .ellipsoid import Ellipsoid from .sphere import Sphere from .realizations import WGS84, GRS80, MARS, VENUS, MOON, MERCURY +# This file is generated automatically by setuptools_scm +from . import _version + ELLIPSOIDS = [WGS84, GRS80, MARS, VENUS, MOON, MERCURY] -# Get the version number through setuptools-scm -__version__ = version.version +# Add a "v" to the version number +__version__ = f"v{_version.version}" def test(doctest=True, verbose=True): diff --git a/env/requirements-style.txt b/env/requirements-style.txt index 74e7ae4c..20de0ec3 100644 --- a/env/requirements-style.txt +++ b/env/requirements-style.txt @@ -1,4 +1,5 @@ # Requirements for checking code style black flake8 -pylint==2.4.* +pylint +pathspec diff --git a/setup.py b/setup.py index 9a9db404..d38914a4 100644 --- a/setup.py +++ b/setup.py @@ -48,15 +48,15 @@ with open("requirements.txt", encoding="utf-8") as f: INSTALL_REQUIRES = f.readlines() PYTHON_REQUIRES = ">=3.6" - -# Configuration for setuptools-scm SETUP_REQUIRES = ["setuptools_scm"] +# Configuration for setuptools-scm USE_SCM_VERSION = { "relative_to": __file__, + "version_scheme": "post-release", "local_scheme": "node-and-date", + "write_to": f"{NAME}/_version.py", } - if __name__ == "__main__": setup( name=NAME,