Skip to content

Commit

Permalink
Use setuptools_scm for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed May 15, 2020
1 parent db87ffe commit 4ec45a1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 184 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__

# ignore version cache file (generated automatically when setup.py is run)
ctapipe/_version_cache.py
ctapipe/version.py

# Ignore .c files by default to avoid including generated code. If you want to
# add a non-generated .c extension, use `git add -f filename.c`.
Expand Down
4 changes: 0 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ include CHANGES.rst

include setup.cfg

recursive-include *.pyx *.c *.pxd
recursive-include docs *
recursive-include licenses *
recursive-include cextern *
recursive-include scripts *

prune build
prune docs/_build
Expand Down
5 changes: 3 additions & 2 deletions ctapipe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
ctapipe - CTA Python pipeline experimental version
"""

from . import version
__version__ = version.get_version(pep440=False)
from .version import __version__

__all__ = ['__version__']
1 change: 0 additions & 1 deletion ctapipe/tools/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
'ctapipe_resources',
'pytest',
'graphviz',
'targetio',
'matplotlib'
])

Expand Down
167 changes: 0 additions & 167 deletions ctapipe/version.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 40.6.0", "wheel"]
requires = ["setuptools >= 40.6.0", "wheel", "setuptools_scm[toml]>=3.4"]
build-backend = "setuptools.build_meta"

[tool.black]
Expand Down
26 changes: 17 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@

# import ah_bootstrap
from setuptools import setup, find_packages

import sys
import os
# pep 517 builds do not have cwd in PATH by default
sys.path.insert(0, os.path.dirname(__file__))
# Get the long and version description from the package's docstring
import ctapipe # noqa


# Define entry points for command-line scripts
Expand Down Expand Up @@ -39,11 +33,21 @@
'jupyter', 'notebook', 'travis-sphinx', 'graphviz',
]

ctapipe.version.update_release_version()

VERSION_TEMPLATE = """
# DO NOT MANUALLY EDIT THIS FILE, IT IS AUTOGENERATED BY SETUP
# Note that we need to fall back to the hard-coded version if either
# setuptools_scm can't be imported or setuptools_scm can't determine the
# version, so we catch the generic 'Exception'.
try:
from setuptools_scm import get_version
__version__ = get_version(root='..', relative_to=__file__)
except Exception:
__version__ = '{version}'
""".lstrip()

setup(
packages=find_packages(),
version=ctapipe.version.get_version(pep440=True),
python_requires='>=3.6',
install_requires=[
'astropy>=3,<5',
Expand All @@ -69,8 +73,12 @@
'tests': tests_require,
'docs': docs_require,
},
use_scm_version={
'write_to': os.path.join('ctapipe', 'version.py'),
'write_to_template': VERSION_TEMPLATE,
},
tests_require=tests_require,
setup_requires=['pytest_runner'],
setup_requires=['pytest_runner', 'setuptools_scm'],
classifiers=[
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
Expand Down

0 comments on commit 4ec45a1

Please sign in to comment.