Skip to content

Commit 1f7eb0b

Browse files
committed
Add _version.py file and use it everywhere version is needed.
1 parent 28c2a09 commit 1f7eb0b

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ test: ## run test suite
3636
# RELEASE
3737
################################################################################
3838

39+
.PHONY: bump-version
40+
bump-version: ## bump the package version (uses VERSION)
41+
sed -i '' "s/__version__ = \".*\"/__version__ = \"$(VERSION)\"/" $(SRC)/dependency_injection/_version.py
42+
3943
.PHONY: build
4044
build: ## build the python package
4145
pipenv run python setup.py sdist bdist_wheel

docs/conf.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
sys.path.insert(0, os.path.abspath("../src/"))
1717

18+
from dependency_injection._version import __version__ # noqa: E402
19+
1820

1921
# -- Auto doc generation -----
2022

@@ -31,11 +33,11 @@
3133
copyright = "2025, David Runemalm"
3234
author = "David Runemalm"
3335

34-
# The version
35-
version = "1.0"
36+
# Short X.Y version
37+
version = __version__.split("-")[0]
3638

37-
# The full version, including alpha/beta/rc tags
38-
release = "1.0.0-beta.3"
39+
# Full version string
40+
release = __version__
3941

4042

4143
# -- General configuration ---------------------------------------------------

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
import os
2+
13
from setuptools import find_packages
24
from setuptools import setup
35

6+
7+
version = {}
8+
with open(os.path.join("src", "dependency_injection", "_version.py")) as f:
9+
exec(f.read(), version)
10+
411
with open("README.md", "r", encoding="utf-8") as fh:
512
long_description = fh.read()
613

714
setup(
815
name="py-dependency-injection",
9-
version="1.0.0-beta.3",
16+
version=version["__version__"],
1017
author="David Runemalm, 2025",
1118
author_email="david.runemalm@gmail.com",
1219
description="A dependency injection library for Python.",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "1.0.0-beta.3"

0 commit comments

Comments
 (0)