Skip to content

Commit

Permalink
use manual version for now (#2156)
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian authored Dec 9, 2024
1 parent 343a4d8 commit 0c25bc0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ jobs:
- name: Run tests
run: |
pytest -n8 --dist loadfile --ignore=tests/e2e/ --ignore=tests/patched/ tests/
pytest tests/patched/
pytest -v -n8 --dist loadfile --ignore=tests/e2e/ --ignore=tests/patched/ tests/
pytest -v tests/patched/
- name: cleanup pip cache
run: |
Expand Down Expand Up @@ -141,8 +141,8 @@ jobs:
- name: Run tests
run: |
pytest -n8 --dist loadfile --ignore=tests/e2e/ --ignore=tests/patched/ tests/
pytest tests/patched/
pytest -v -n8 --dist loadfile --ignore=tests/e2e/ --ignore=tests/patched/ tests/
pytest -v tests/patched/
- name: cleanup pip cache
run: |
Expand Down
18 changes: 18 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""setup.py for axolotl"""
import ast
import os
import platform
import re
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path

from setuptools import find_packages, setup

Expand Down Expand Up @@ -90,9 +93,24 @@ def parse_requirements():
return _install_requires, _dependency_links


def get_package_version():
with open(
Path(os.path.dirname(os.path.abspath(__file__)))
/ "src"
/ "axolotl"
/ "__init__.py",
"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))
return version_


install_requires, dependency_links = parse_requirements()

setup(
version=get_package_version(),
package_dir={"": "src"},
packages=find_packages("src"),
install_requires=install_requires,
Expand Down
7 changes: 1 addition & 6 deletions src/axolotl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
"""Axolotl - Train and fine-tune large language models"""

try:
from importlib.metadata import version

__version__ = version("axolotl")
except ImportError:
__version__ = "unknown"
__version__ = "0.5.3.dev0"
10 changes: 10 additions & 0 deletions tests/cli/test_cli_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""pytest tests for axolotl CLI --version"""
from axolotl.cli.main import cli


def test_print_version(cli_runner):
"""Test that version is printed when --version is used."""

result = cli_runner.invoke(cli, ["--version"])
assert result.exit_code == 0
assert "axolotl, version " in result.output

0 comments on commit 0c25bc0

Please sign in to comment.