Skip to content

Commit

Permalink
Merge pull request #2 from ammounce/version_fix
Browse files Browse the repository at this point in the history
fix: fixed version upload and autochange
  • Loading branch information
ammounce authored Sep 15, 2024
2 parents c158b44 + 000ae2c commit 9c978ad
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 61.0"]
requires = ["setuptools >= 61.0", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -11,8 +11,14 @@ requires-python = ">= 3.7"
authors = [{name = "Andy Mounce", email = "[email protected]"}]
description = "Python class that allows dict item syntax for attribute access"
readme = {file = "README.txt", content-type = "text/markdown"}
license = {file = "LICENSE"}
license = { file = "LICENSE" }

[project.urls]
Homepage = "https://github.com/ammounce/itemattribute"
Issues = "https://github.com/ammounce/itemattribute/issues"

[tools.setuptools]
packages = ["itemattribute"]

[tool.setuptools.dynamic]
version = {attr = "itemattribute.__version__"}
14 changes: 14 additions & 0 deletions src/itemattribute/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
from .item_attribute import ItemAttribute

import importlib.resources
import json
import os

dir = os.path.dirname(os.path.abspath(__file__))
# with importlib.resources.open_text("itemattribute", "version.json") as file:
# __version__ = json.load(file)['version']
try:
with open(dir + '/version.json') as file:
__version__ = json.load(file)
except FileNotFoundError:
with importlib.resources.open_text("itemattribute", "version.json") as file:
__version__ = json.load(file)['version']
4 changes: 1 addition & 3 deletions src/itemattribute/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
"version": "0.0.2"
}
"0.0.2"

0 comments on commit 9c978ad

Please sign in to comment.