Skip to content

Commit

Permalink
Implement better versioning scheme
Browse files Browse the repository at this point in the history
Closes #444
  • Loading branch information
Johannes Ernst committed Dec 28, 2024
1 parent bfda1f7 commit 7860089
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ release :
[[ -d venv.release ]] && rm -rf venv.release || true
[[ -d dist ]] && rm -rf dist || true
$(PYTHON) -mvenv venv.release
venv.release/bin/pip install twine
venv.release/bin/pip install --upgrade build
venv.release/bin/python -m build
FEDITEST_RELEASE_VERSION=y venv.release/bin/pip install twine
FEDITEST_RELEASE_VERSION=y venv.release/bin/pip install --upgrade build
FEDITEST_RELEASE_VERSION=y venv.release/bin/python -m build
@echo WARNING: YOU ARE NOT DONE YET
@echo The actual push to pypi.org you need to do manually. Enter:
@echo venv.release/bin/twine upload dist/*
Expand Down
17 changes: 17 additions & 0 deletions hatch_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Set a dynamic version number, see https://hatch.pypa.io/dev/how-to/config/dynamic-metadata/
# At release time, override with env var: FEDITEST_RELEASE_VERSION=y
#

from datetime import datetime
import os

from hatchling.metadata.plugin.interface import MetadataHookInterface


class JSONMetaDataHook(MetadataHookInterface):
def update(self, metadata):
if 'FEDITEST_RELEASE_VERSION' in os.environ and os.environ['FEDITEST_RELEASE_VERSION'].lower() == 'y':
metadata['version'] = metadata['base_version']
else:
metadata['version'] = metadata['base_version'] + '.dev' + datetime.now().strftime("%Y%m%d%H%M%S")
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ build-backend = "hatchling.build"

[project]
name = "feditest"
version = "0.5"
base_version = "0.6"
dynamic = ["version"]
authors = [
{ name="Johannes Ernst", email="[email protected]" },
{ name="Steve Bate", email="[email protected]" }
Expand Down Expand Up @@ -62,6 +63,9 @@ exclude = [
"docs/"
]

[tool.hatch.metadata.hooks.custom]
# Empty: https://hatch.pypa.io/dev/how-to/config/dynamic-metadata/

[tool.pylint."MESSAGES CONTROL"]
max-line-length=120
disable="arguments-renamed, empty-docstring, global-variable-not-assigned, line-too-long, missing-class-docstring, missing-function-docstring, too-few-public-methods, too-many-arguments"
Expand Down

0 comments on commit 7860089

Please sign in to comment.