Skip to content

Commit

Permalink
fix: set package version
Browse files Browse the repository at this point in the history
Update version in package and make it readable via importlib
  • Loading branch information
boidolr committed Feb 11, 2024
1 parent 1f4d162 commit 84c8ee4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ endif
.PHONY: release
release: test version
@echo "Next version: ${NEXT_VERSION}"
@sed -E -e "s/rev: v${CURRENT}/rev: v${NEXT_VERSION}/" -i '' README.md
@sed -E -e "s/VERSION = \"${CURRENT}\"/VERSION = \"${NEXT_VERSION}\"/" -i '' pre_commit_images/__init__.py
@git add README.md pre_commit_images/__init__.py
@sed -E -e "s/${CURRENT}/${NEXT_VERSION}/" -i '' README.md pyproject.toml
@git add README.md pyproject.toml
git commit -m "chore: release version ${NEXT_VERSION}" && git tag "v${NEXT_VERSION}"


Expand Down
5 changes: 4 additions & 1 deletion pre_commit_images/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
VERSION = "1.5.2"
import importlib.metadata

__version__ = importlib.metadata.version("pre_commit_images")
VERSION = __version__
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
urls = {"Respository" = "https://github.com/boidolr/pre-commit-images"}
license = {file = "LICENSE"}
readme = "README.md"
dynamic = ["version"]
version = "1.5.2"
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
Expand Down Expand Up @@ -51,9 +51,6 @@ optimize-png = "pre_commit_images.optimize_png:main"
optimize-svg = "pre_commit_images.optimize_svg:main"
optimize-webp = "pre_commit_images.optimize_webp:main"

[tool.setuptools.dynamic]
version = {attr = "pre_commit_images.VERSION"}

[tool.setuptools]
packages = ["pre_commit_images"]

Expand Down

0 comments on commit 84c8ee4

Please sign in to comment.