Skip to content

Commit

Permalink
Remove remnants of hatch and use setuptools_scm (#30)
Browse files Browse the repository at this point in the history
* Remove remnants of hatch and use setuptools_scm

* .
  • Loading branch information
basnijholt authored Dec 4, 2024
1 parent a66205c commit 6d6f2d1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ build:
os: ubuntu-22.04
tools:
python: "3.12"
apt_packages:
- libblas-dev
- liblapack-dev

sphinx:
configuration: docs/conf.py
Expand Down
24 changes: 10 additions & 14 deletions pfapack/_version.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#!/usr/bin/env python
from __future__ import annotations
try:
# setuptools_scm is not a runtime dependency. This is used when pip
# installing from a git repository.
from setuptools_scm import get_version

from pathlib import Path
__version__ = get_version(root="..", relative_to=__file__)
except (ImportError, LookupError):
from importlib.metadata import version, PackageNotFoundError

# Is set during `onbuild` if `pip install pfapack` is used
__version__ = ""

if not __version__:
try:
import versioningit
except ImportError: # pragma: no cover
import importlib.metadata

__version__ = importlib.metadata.version("pfapack")
else:
PROJECT_DIR = Path(__file__).parent.parent
__version__ = versioningit.get_version(project_dir=PROJECT_DIR)
__version__ = version("pfapack")
except PackageNotFoundError:
__version__ = "0.0.0+unknown"


if __name__ == "__main__":
Expand Down
25 changes: 1 addition & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "mesonpy"
requires = ["meson-python", "versioningit"]
requires = ["meson-python", "setuptools_scm"]

[project]
name = "pfapack"
Expand Down Expand Up @@ -44,29 +44,6 @@ documentation = "https://pfapack.readthedocs.io"
content-type = "text/markdown"
file = "README.md"

[tool.hatch.version]
source = "versioningit"

[tool.hatch.build.targets.wheel]
packages = ["pfapack"]

[tool.hatch.build.hooks.versioningit-onbuild]
build-file = "pfapack/_version.py"
source-file = "pfapack/_version.py"

[tool.versioningit]
default-version = "0.0.0"

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

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

[tool.mypy]
python_version = "3.10"
follow_imports = "silent"
Expand Down

0 comments on commit 6d6f2d1

Please sign in to comment.