Skip to content

Commit

Permalink
Use setuptools_scm for version numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Dec 13, 2019
1 parent d6cb2ac commit 0fbdae3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ __pycache__
*.c

# Other generated files
*/version.py
*/cython_version.py
htmlcov
.coverage
Expand Down
7 changes: 1 addition & 6 deletions astrowidgets/_astropy_init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

__all__ = ['__version__', '__githash__']
__all__ = ['__version__']

# this indicates whether or not we are in the package's setup.py
try:
Expand All @@ -17,11 +17,6 @@
from .version import version as __version__
except ImportError:
__version__ = ''
try:
from .version import githash as __githash__
except ImportError:
__githash__ = ''


if not _ASTROPY_SETUP_: # noqa
import os
Expand Down
12 changes: 12 additions & 0 deletions astrowidgets/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version = 'unknown.dev'
try:
from importlib_metadata import version as _version, PackageNotFoundError
version = _version('my-package')
except ImportError:
from pkg_resources import get_distribution, DistributionNotFound
try:
version = get_distribution("my-package").version
except DistributionNotFound:
pass
except PackageNotFoundError:
pass
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[build-system]
requires = ["setuptools",
"setuptools_scm",
"wheel"]
build-backend = 'setuptools.build_meta'
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ github_project = astropy/astrowidgets
[options]
zip_safe = False
packages = find:
setup_requires = setuptools_scm
install_requires =
astropy
ginga
Expand Down

0 comments on commit 0fbdae3

Please sign in to comment.