Skip to content

Commit

Permalink
Migrate to versioneer (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBoothroyd authored Sep 26, 2023
1 parent c1c9591 commit f67b614
Show file tree
Hide file tree
Showing 5 changed files with 758 additions and 33 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,3 @@ ENV/

# PyCharm
.idea

*/_version.py
2 changes: 1 addition & 1 deletion devtools/envs/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:

- openmm # regression testing energies

- versioningit
- versioneer

- pre-commit
- isort
Expand Down
27 changes: 11 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=61.0", "wheel", "versioningit~=2.0"]
requires = ["setuptools>=61.0", "wheel", "versioneer"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -16,25 +16,20 @@ classifiers = ["Programming Language :: Python :: 3"]
zip-safe = false
include-package-data = true

[tool.setuptools.dynamic]
version = {attr = "smee.__version__"}

[tool.setuptools.packages.find]
namespaces = true
where = ["."]

[tool.versioningit]
default-version = "1+unknown"

[tool.versioningit.format]
distance = "{base_version}+{distance}.{vcs}{rev}"
dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"

[tool.versioningit.vcs]
method = "git"
match = ["*"]
default-tag = "0.0.0"

[tool.versioningit.write]
file = "smee/_version.py"
[tool.versioneer]
VCS = "git"
style = "pep440"
versionfile_source = "smee/_version.py"
versionfile_build = "smee/_version.py"
tag_prefix = ""
parentdir_prefix = "smee-"

[tool.black]
line-length = 88
Expand Down
44 changes: 30 additions & 14 deletions smee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,33 @@
Differentiably evaluate energies of molecules using SMIRNOFF force fields
"""

from ._version import __version__
from .ff import convert_handlers, convert_interchange
from .geometry import add_v_site_coords, compute_v_site_coords
from .potentials import compute_energy, compute_energy_potential

__all__ = [
"__version__",
"add_v_site_coords",
"compute_v_site_coords",
"convert_handlers",
"convert_interchange",
"compute_energy",
"compute_energy_potential",
]
from . import _version

__version__ = _version.get_versions()["version"]

__all__ = ["__version__"]


import inspect

# a hack to prevent pip failing as dependencies are 'not installed' in the build
# environment
if not any(
"setuptools" in record.filename or "pip" in record.filename
for record in inspect.stack()
):
from .ff import convert_handlers, convert_interchange
from .geometry import add_v_site_coords, compute_v_site_coords
from .potentials import compute_energy, compute_energy_potential

__all__ = [
"__version__",
"add_v_site_coords",
"compute_v_site_coords",
"convert_handlers",
"convert_interchange",
"compute_energy",
"compute_energy_potential",
]

del inspect
Loading

0 comments on commit f67b614

Please sign in to comment.