From 5885839f06113a948ba63486578d147236ef6032 Mon Sep 17 00:00:00 2001 From: disqualifier Date: Fri, 3 Jul 2026 16:15:48 -0400 Subject: [PATCH] fix: __version__ hardcoded to 0.1.0, drifted from pyproject 0.1.1 __init__.py:14 hardcoded "0.1.0" while pyproject.toml, the README install pin, and the README changelog all said 0.1.1 - a consumer gating on __version__ read one release behind the actual tag. Derive __version__ from installed package metadata (importlib.metadata.version("dpy_cache")) so the hardcoded literal can no longer drift from the release tag; keep a fallback literal for the not-installed/editable case, synced to the current pyproject version. Bump 0.1.1 -> 0.1.2. Signed-off-by: disqualifier --- README.md | 10 +++++++++- pyproject.toml | 2 +- src/dpy_cache/__init__.py | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cffa67a..2c39e71 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ bites you. ## Install ``` -dpy_cache @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_cache.git@v0.1.1 +dpy_cache @ git+ssh://git@git.rethinkstudios.io/rethink-public/dpy_cache.git@v0.1.2 ``` ## Usage @@ -103,6 +103,14 @@ one, a `discord.File` source that can't be safely rebuilt for a repeat send). Un Tagged `vX.Y.Z`; pin a tag in your install line. Targets `discord.py>=2.0` (not `discord.py-self`). +### v0.1.2 + +- `__version__` is now derived from installed package metadata + (`importlib.metadata.version("dpy_cache")`) instead of a hardcoded string, so it can + no longer drift from the `pyproject.toml` version that the release tag is cut from. A + not-installed/editable checkout falls back to a literal that is kept in sync with the + current `pyproject.toml` version at each release. + ### v0.1.1 - `cache()` now rejects a duplicate filename in a **list** input with `DPYCacheError` diff --git a/pyproject.toml b/pyproject.toml index b4e0ad5..7ee8e63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "dpy_cache" -version = "0.1.1" +version = "0.1.2" description = "Persist images/files to a Discord storage channel and get durable, re-resolvable CDN references — config-free, injectable, installable." requires-python = ">=3.10" dependencies = [ diff --git a/src/dpy_cache/__init__.py b/src/dpy_cache/__init__.py index ac390cc..75c1e48 100644 --- a/src/dpy_cache/__init__.py +++ b/src/dpy_cache/__init__.py @@ -2,6 +2,8 @@ see :mod:`dpy_cache.dpy_cache` for the full module docstring, api, and error contract """ +from importlib.metadata import PackageNotFoundError, version + from .dpy_cache import ( MAX_ATTACHMENTS_PER_MESSAGE, CacheResult, @@ -11,7 +13,10 @@ from .dpy_cache import ( FileRef, ) -__version__ = "0.1.0" +try: + __version__ = version("dpy_cache") +except PackageNotFoundError: + __version__ = "0.1.2" __all__ = [ "DPYCache",