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

Remove remnants of hatch and use setuptools_scm #30

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading