Skip to content

Commit

Permalink
reafactor: Configure for versioning
Browse files Browse the repository at this point in the history
* Use bump-my-version (manage settings at pyproject.toml)
* Write package version into package-root (as dynamic)
* Ref version variable from sphinx-extension
  • Loading branch information
attakei committed Feb 18, 2024
1 parent 8ffb27b commit 296f302
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
21 changes: 20 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[project]
name = "rst-multi-refs"
version = "0.0.0"
description = "reStrucuturedText's custom roles and role builder kit for package registries of any languages."
authors = [
{ name = "Kazuya Takei", email = "[email protected]" }
Expand Down Expand Up @@ -29,6 +28,7 @@ classifiers = [
"Topic :: Software Development :: Documentation",
"Topic :: Text Processing :: Markup :: reStructuredText",
]
dynamic = ["version"]

[project.optional-dependencies]
sphinx = [
Expand Down Expand Up @@ -59,8 +59,27 @@ select = ["C90", "D", "E", "F", "I", "W"]
[tool.ruff.lint.pydocstyle]
convention = "pep257"

[tool.bumpversion]
current_version = "0.0.0"
commit = true
tag = false
message = "release: Bump version {current_version} -> {new_version}"

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[[tool.bumpversion.files]]
filename = "src/rst_multi_refs/__init__.py"
search = "__version__ = \"{current_version}\""
replace = "__version__ = \"{new_version}\""

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/rst_multi_refs"]

[tool.hatch.version]
path = "src/rst_multi_refs/__init__.py"
3 changes: 2 additions & 1 deletion src/rst_multi_refs/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
"""Root of package."""
"""Root of rst-multi-refs."""
__version__ = "0.0.0"
3 changes: 2 additions & 1 deletion src/rst_multi_refs/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from sphinx.application import Sphinx
from sphinx.config import Config

from . import __version__
from .core import configure


Expand All @@ -14,7 +15,7 @@ def setup(app: Sphinx):
"""Entrypoint as Sphinx extension."""
app.connect("config-inited", register_roles)
return {
"version": "0.0.0",
"version": __version__,
"env_version": 1,
"parallel_read_safe": False,
}

0 comments on commit 296f302

Please sign in to comment.