Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use setuptools_scm for versioning, fixes #1333 #1334

Merged
merged 5 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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: 2 additions & 3 deletions ctapipe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
ctapipe - CTA Python pipeline experimental version
"""
from .version import __version__

from . import version

__version__ = version.get_version(pep440=False)
__all__ = ['__version__']
172 changes: 0 additions & 172 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
28 changes: 17 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@

# 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
# TODO: this shuold be automated (e.g. look for main functions and
# rename _ to -, and prepend 'ctapipe'
Expand Down Expand Up @@ -48,11 +40,21 @@
"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.7",
install_requires=[
"astropy>=3,<5",
Expand All @@ -79,8 +81,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