Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

build: use importlib (pkg_resources is deprecated) #113

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,33 @@ jobs:

- name: Check style
run: python3 -m ruff check . && python3 -m ruff format --check .
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: zsh
version: 1.0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: '**/setup.cfg'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --use-deprecated=legacy-resolver '.[test,postgres,snowflake,queueing]'

- name: Test with pytest
run: pytest tests/storage/test_snowflake.py
9 changes: 3 additions & 6 deletions src/anyvar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
"""Import basic AnyVar objects."""

import logging

import pkg_resources
from importlib.metadata import PackageNotFoundError, version

_logger = logging.getLogger(__name__)

__all__ = ["AnyVar"]


try:
__version__ = pkg_resources.get_distribution(__name__).version
__version__ = version(__name__)
_logger.info("Package %s, version = %s", __name__, __version__)
except pkg_resources.DistributionNotFound:
except PackageNotFoundError:
__version__ = "unknown"
finally:
del pkg_resources


from .anyvar import AnyVar # isort:skip
4 changes: 2 additions & 2 deletions src/anyvar/utils/types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Provide helpful type definitions and references."""

from enum import StrEnum
from enum import Enum

from ga4gh.vrs import models

Expand All @@ -24,7 +24,7 @@
}


class SupportedVariationType(StrEnum):
class SupportedVariationType(str, Enum):
"""Define constraints for supported variation types"""

ALLELE = "Allele"
Expand Down
Loading