diff --git a/.github/workflows/smoke_tests.yaml b/.github/workflows/smoke_tests.yaml new file mode 100644 index 0000000..eb7d27b --- /dev/null +++ b/.github/workflows/smoke_tests.yaml @@ -0,0 +1,19 @@ +name: Smoke Tests + +on: [push, pull_request] + +jobs: + git-url: + # see the following for valid dependency specifiers + # https://packaging.python.org/en/latest/specifications/dependency-specifiers/#dependency-specifiers + # we construct from the GitHub Actions context + name: Install and import from git url + runs-on: ubuntu-latest + steps: + - uses: astral-sh/setup-uv@v7 + with: + ignore-empty-workdir: "true" # resolve warning about "Empty workdir detected. This may cause unexpected behavior. You can enable ignore-empty-workdir to mute this warning." + cache-dependency-glob: "" # resolve warning about "No file matched to ... The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly." + - run: uv init --bare --name smoke-test + - run: uv add "scheil @ git+https://github.com/${{ github.repository }}.git@${{ github.sha }}" + - run: uv run python -c "import scheil; print(scheil.__version__)" \ No newline at end of file diff --git a/scheil/__init__.py b/scheil/__init__.py index 62ce14b..4475e1d 100644 --- a/scheil/__init__.py +++ b/scheil/__init__.py @@ -20,12 +20,10 @@ # source control management system at the project root. __version__ = get_version(root='..', relative_to=__file__) del get_version -except ImportError: +except (ImportError, LookupError): # Fall back on the metadata of the installed package - try: - from importlib.metadata import version - except ImportError: - # backport for Python<3.8 - from importlib_metadata import version + # ImportError occurs if there's no ._dev + # LookupError occurs if get_version fails + from importlib.metadata import version __version__ = version("scheil") del version \ No newline at end of file