diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 24e3c497d..2b95dbe3f 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -48,9 +48,9 @@ jobs: id: tag run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3) - - name: Update version in setup.py + - name: Update version in src/axolotl/__init__.py run: | - sed -i -E 's/version="([0-9.]+)",/version="${{ steps.tag.outputs.TAG_NAME }}",/g' setup.py + sed -i -E's/__version__ = "([0-9.]+)"/__version__ = "${{ steps.tag.outputs.TAG_NAME }}"/g' src/axolotl/__init__.py - name: Build a source dist run: | diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..80827deea --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.14.0.dev0 diff --git a/pyproject.toml b/pyproject.toml index 4213bc963..c5b7deb05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,9 @@ Repository = "https://github.com/axolotl-ai-cloud/axolotl.git" py-modules = ["setuptools_axolotl_dynamic_dependencies"] include-package-data = true +[tool.setuptools.dynamic] +version = { file = "VERSION" } + [tool.setuptools.cmdclass] build_py = "setuptools_axolotl_dynamic_dependencies.BuildPyCommand" diff --git a/setup.py b/setup.py index d98c7e19a..101c5b8c4 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ """setup.py for axolotl""" -import ast import os import platform import re @@ -130,15 +129,11 @@ def parse_requirements(extras_require_map): def get_package_version(): with open( - Path(os.path.dirname(os.path.abspath(__file__))) - / "src" - / "axolotl" - / "__init__.py", + Path(os.path.dirname(os.path.abspath(__file__))) / "VERSION", "r", encoding="utf-8", ) as fin: - version_match = re.search(r"^__version__\s*=\s*(.*)$", fin.read(), re.MULTILINE) - version_ = ast.literal_eval(version_match.group(1)) + version_ = fin.read().strip() return version_ diff --git a/src/axolotl/__init__.py b/src/axolotl/__init__.py index 962846302..820642bf0 100644 --- a/src/axolotl/__init__.py +++ b/src/axolotl/__init__.py @@ -3,5 +3,3 @@ import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) # Make this a namespace package - -__version__ = "0.13.1"