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",