Skip to content

Commit

Permalink
Switch to BumpVer for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmaxwell committed Nov 15, 2024
1 parent 098d972 commit 09e6c35
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 55 deletions.
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,7 @@ pc-run:
# Use Sphinx to build and view the documentation
docs:
uv run sphinx-autobuild -b html "{{SOURCEDIR}}" "{{BUILDDIR}}" {{SPHINXOPTS}}

# Use BumpVer to increase the version number
@bump *ARGS:
uv run bumpver update {{ ARGS }}
21 changes: 16 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ description = "A blog application for Django sites, inspired by classic WordPres
readme = "README.md"
requires-python = ">=3.10"
authors = [{ name = "Stuart Maxwell", email = "[email protected]" }]
dependencies = [
"django>=4.2.0",
"markdown>=3.7",
"tomli>=2.1.0 ; python_full_version < '3.11'",
]
dependencies = ["django>=4.2.0", "markdown>=3.7"]
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down Expand Up @@ -44,6 +40,9 @@ Documentation = "https://stuartmaxwell.github.io/djpress/"
Repository = "https://github.com/stuartmaxwell/djpress"
Issues = "https://github.com/stuartmaxwell/djpress/issues"

[dependency-groups]
dev = ["bumpver>=2024.1130"]

[project.optional-dependencies]
test = [
"pytest>=8.3.3",
Expand Down Expand Up @@ -94,3 +93,15 @@ python_files = "tests.py test_*.py *_tests.py"
branch = true
include = ["src/djpress/*"]
omit = ["*/tests/*", "*/migrations/*"]

[tool.bumpver]
current_version = "0.11.2"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = ":bookmark: bump version {old_version} -> {new_version}"
commit = true
push = true
tag = true

[tool.bumpver.file_patterns]
"pyproject.toml" = ['version = "{version}"']
"src/djpress/__init__.py" = ['^__version__ = "{version}"$']
21 changes: 1 addition & 20 deletions src/djpress/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
"""djpress module."""

from pathlib import Path

try:
import tomllib
except ImportError:
import tomli as tomllib # Alias tomli as tomllib for compatibility with Python versions < 3.11


def load_version() -> str:
"""Load the version from pyproject.toml."""
# Define the path to pyproject.toml
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"

# Read the version from pyproject.toml
with pyproject_path.open("rb") as f:
pyproject_data = tomllib.load(f)
return pyproject_data["project"]["version"]


__version__ = load_version()
__version__ = "0.11.2"
28 changes: 0 additions & 28 deletions tests/test_init.py

This file was deleted.

43 changes: 41 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 09e6c35

Please sign in to comment.