Skip to content

Commit

Permalink
Replace versioneer for setuptools-scm (#307)
Browse files Browse the repository at this point in the history
Replace `versioneer` with `setuptools_scm` for getting Semver version of
Verde. `setuptools_scm` doesn't require to store additional files to work,
it can be installed and used through `setup.py`. Remove all `versioneer`
related files and mentions. Add `setuptools_scm` to `requirements.txt` and
`environment.yml`. Replace `setup.cfg` for `.flake8`. 
Related to fatiando/maintenance#4
  • Loading branch information
santisoler committed Mar 16, 2021
1 parent 952e62c commit 375af25
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 2,398 deletions.
7 changes: 0 additions & 7 deletions setup.cfg → .flake8
@@ -1,10 +1,3 @@
[versioneer]
VCS = git
style = pep440
versionfile_source = verde/_version.py
versionfile_build = verde/_version.py
tag_prefix = ''

[flake8]
ignore = E203, E266, E501, W503, F401, E741
max-line-length = 88
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Expand Up @@ -4,7 +4,6 @@ include CODE_OF_CONDUCT.md
include CONTRIBUTING.md
include AUTHORS.md
include requirements.txt
include versioneer.py
include verde/datasets/registry.txt
recursive-include verde/tests/data *
recursive-include verde/tests/baseline *
1 change: 1 addition & 0 deletions environment.yml
Expand Up @@ -5,6 +5,7 @@ channels:
dependencies:
- python=3.7
- pip
- setuptools_scm
- numpy
- scipy
- pandas
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
@@ -1,3 +1,4 @@
setuptools_scm
numpy
scipy
pandas
Expand Down
16 changes: 9 additions & 7 deletions setup.py
@@ -1,12 +1,10 @@
"""
Build and install the project.
Uses versioneer to manage version numbers using git tags.
Uses setuptools-scm to manage version numbers using git tags.
"""
from setuptools import setup, find_packages

import versioneer


NAME = "verde"
FULLNAME = "Verde"
Expand All @@ -20,8 +18,6 @@
KEYWORDS = ""
with open("README.rst") as f:
LONG_DESCRIPTION = "".join(f.readlines())
VERSION = versioneer.get_version()
CMDCLASS = versioneer.get_cmdclass()
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
Expand All @@ -46,14 +42,20 @@
with open("requirements.txt") as f:
INSTALL_REQUIRES = f.readlines()
PYTHON_REQUIRES = ">=3.6"
# Configuration for setuptools-scm
SETUP_REQUIRES = ["setuptools_scm"]
USE_SCM_VERSION = {
"relative_to": __file__,
"local_scheme": "node-and-date",
}

if __name__ == "__main__":
setup(
name=NAME,
fullname=FULLNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
version=VERSION,
use_scm_version=USE_SCM_VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=MAINTAINER,
Expand All @@ -68,5 +70,5 @@
keywords=KEYWORDS,
install_requires=INSTALL_REQUIRES,
python_requires=PYTHON_REQUIRES,
cmdclass=CMDCLASS,
setup_requires=SETUP_REQUIRES,
)
4 changes: 4 additions & 0 deletions verde/__init__.py
Expand Up @@ -33,6 +33,10 @@
from .projections import project_region, project_grid


# Get the version number through setuptools-scm
__version__ = version.version


def test(doctest=True, verbose=True, coverage=False, figures=True):
"""
Run the test suite.
Expand Down

0 comments on commit 375af25

Please sign in to comment.