Skip to content

Commit

Permalink
Update setuptools_scm configuration to save a file (#91)
Browse files Browse the repository at this point in the history
Instead of relying on the package information, have it write to a
`boule/_version.py` file for easier maintenance.
  • Loading branch information
leouieda authored Oct 16, 2021
1 parent cc435cd commit d7a9303
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 23 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ doc/sample_data
MANIFEST
dask-worker-space
.coverage.*
boule/_version.py
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 12 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
11 changes: 7 additions & 4 deletions boule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion env/requirements-style.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Requirements for checking code style
black
flake8
pylint==2.4.*
pylint
pathspec
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d7a9303

Please sign in to comment.