From 8bee64c9764599c9b30f28f25d155759e003bdf4 Mon Sep 17 00:00:00 2001 From: zssherman Date: Mon, 11 Mar 2024 12:23:22 -0500 Subject: [PATCH 1/3] FIX: Update version checking to importlib to remove pkg_resources. --- open_radar_data/__init__.py | 6 +++--- open_radar_data/dataset.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/open_radar_data/__init__.py b/open_radar_data/__init__.py index 1f8a4be..8def243 100644 --- a/open_radar_data/__init__.py +++ b/open_radar_data/__init__.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 # flake8: noqa """Top-level module for pythia-datasets .""" -from pkg_resources import DistributionNotFound, get_distribution +import importlib.metadata as _importlib_metadata from .dataset import DATASETS, locate try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: # pragma: no cover + __version__ = _importlib_metadata.version("open-radar-data") +except _importlib_metadata.PackageNotFoundError: # pragma: no cover # package is not installed __version__ = 'unknown' # pragma: no cover diff --git a/open_radar_data/dataset.py b/open_radar_data/dataset.py index 2118477..c016ee7 100644 --- a/open_radar_data/dataset.py +++ b/open_radar_data/dataset.py @@ -1,4 +1,4 @@ -import pkg_resources +import importlib.resources import pooch DATASETS = pooch.create( @@ -7,7 +7,7 @@ env='OPEN_RADAR_DATA_DIR', ) -with pkg_resources.resource_stream('open_radar_data', 'registry.txt') as registry_file: +with open(importlib.resources.files('open_radar_data') / 'registry.txt') as registry_file: DATASETS.load_registry(registry_file) From 350ed0e3d05283a5c1ad537fb6b78610fe014e93 Mon Sep 17 00:00:00 2001 From: zssherman Date: Mon, 11 Mar 2024 13:17:10 -0500 Subject: [PATCH 2/3] CI: Update environment to include setptools. --- ci/environment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/environment.yml b/ci/environment.yml index 3a03ba2..8fa3b6c 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -7,3 +7,5 @@ dependencies: - pooch - pre-commit - pytest-cov + - setuptools + - setuptools-scm From 4de455e2fbbc507726f6a050ca8970848148a328 Mon Sep 17 00:00:00 2001 From: zssherman Date: Mon, 11 Mar 2024 13:26:38 -0500 Subject: [PATCH 3/3] FIX: Fetch tags so setuptools_scm finds it. --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 77d9bc3..1145586 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,6 +46,9 @@ jobs: create-args: >- python=${{matrix.python-version}} conda + - name: Fetch all history for all tags and branches + run: | + git fetch --prune --unshallow - name: Set up conda environment run: | python -m pip install -e .