Skip to content

Commit

Permalink
use pyproject.toml [build-system] and setuptools_scm (#188)
Browse files Browse the repository at this point in the history
* use pyproject.toml [build-system] and setuptools_scm

* fix __version__ in __init__

* fall back to pkg_resources

* linting

* fix docs

* CHANGELOG entry
  • Loading branch information
mathause committed Aug 12, 2022
1 parent f5f7be1 commit 3a881ab
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 2,448 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -67,7 +67,9 @@ Internal Changes
By `Mathias Hauser <https://github.com/mathause>`_.
- Move contents of setup.py to setup.cfg (`#169 <https://github.com/MESMER-group/mesmer/pull/169>`_).
By `Mathias Hauser <https://github.com/mathause>`_.

- Use pyproject.toml for the build-system and setuptools_scm for the `__version__`
(`#188 <https://github.com/MESMER-group/mesmer/pull/188>`_).
By `Mathias Hauser <https://github.com/mathause>`_.

v0.8.3 - 2021-12-23
-------------------
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in
@@ -1,6 +1,3 @@
include README.md
include LICENSE
include CHANGELOG.rst

include versioneer.py
include mesmer/_version.py
12 changes: 7 additions & 5 deletions docs/source/conf.py
Expand Up @@ -8,22 +8,24 @@

import datetime

from mesmer._version import get_versions
import mesmer

# -- Project information -----------------------------------------------------

project = "mesmer"
copyright_year = datetime.date.today().year
copyright = "(c) 2021-{} ETH Zurich (Land-climate dynamics group, Prof. S.I. Seneviratne), MESMER contributors listed in AUTHORS".format(
copyright_year
copyright = (
f"(c) 2021-{copyright_year} ETH Zurich (Land-climate dynamics group, Prof. S.I. "
"Seneviratne), MESMER contributors listed in AUTHORS"
)

authors = "Authors, see AUTHORS"
author = authors

# The short X.Y version
version = get_versions()["version"].split("+")[0]
version = mesmer.__version__.split("+")[0]
# The full version, including alpha/beta/rc tags
release = get_versions()["version"]
release = mesmer.__version__


# -- General configuration ---------------------------------------------------
Expand Down
20 changes: 15 additions & 5 deletions mesmer/__init__.py
Expand Up @@ -6,11 +6,21 @@
The mesmer package provides tools to train the MESMER emulator, create emulations, and
analyze the results.
"""
from ._version import get_versions

__version__ = get_versions()["version"]
del get_versions

# flake8: noqa

from . import calibrate_mesmer, create_emulations, io, utils

try:
from importlib.metadata import version as _get_version
except ImportError:
# importlib.metadata not available in python 3.7
import pkg_resources

_get_version = lambda pkg: pkg_resources.get_distribution(pkg).version

try:
__version__ = _get_version("mesmer-emulator")
except Exception:
# Local copy or not installed with setuptools.
# Disable minimum version checks on downstream libraries.
__version__ = "999"

0 comments on commit 3a881ab

Please sign in to comment.