Skip to content

Commit 3b8751f

Browse files
oschwaldclaude
andcommitted
Use single source of truth for version from pyproject.toml
The version is now retrieved from package metadata at runtime using importlib.metadata. This reduces the chance of version inconsistencies during releases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4bbf06c commit 3b8751f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

HISTORY.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
History
55
-------
66

7+
5.3.0
8+
++++++++++++++++++
9+
10+
* The version is now retrieved from package metadata at runtime using
11+
``importlib.metadata``. This reduces the chance of version inconsistencies
12+
during releases.
13+
714
5.2.0 (2025-11-20)
815
++++++++++++++++++
916

dev-bin/release.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ if [ -n "$(git status --porcelain)" ]; then
4141
exit 1
4242
fi
4343

44-
perl -pi -e "s/(?<=__version__ = \").+?(?=\")/$version/gsm" src/geoip2/__init__.py
4544
perl -pi -e "s/(?<=^version = \").+?(?=\")/$version/gsm" pyproject.toml
4645

4746
echo $"Test results:"

src/geoip2/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""geoip2 client library."""
22

3-
__title__ = "geoip2"
4-
__version__ = "5.2.0"
5-
__author__ = "Gregory Oschwald"
6-
__license__ = "Apache License, Version 2.0"
7-
__copyright__ = "Copyright (c) 2013-2025 MaxMind, Inc."
3+
from importlib.metadata import version
4+
5+
__version__ = version("geoip2")

0 commit comments

Comments
 (0)