Skip to content

Commit

Permalink
Updating version fetching. RE:natcap#100
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed Nov 4, 2023
1 parent 47267e2 commit 3dfb378
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
TaskGraph Release History
=========================

Unreleased Changes
------------------
* Using ``importlib.metadata`` or ``importlib_metadata``, depending on the
python version, to read the version from package metadata. This is in
response to ``pkg_resources`` being deprecated.
(`#100 <https://github.com/natcap/taskgraph/issues/100>`_)

0.11.1 (2023-10-27)
-------------------
* Adding ``pyproject.toml`` for our build definitions.
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
# taskgraph to work as expected.

retrying>=1.3.0
importlib_metadata # technically only required on python < 3.8; easier to install with conda across all versions
14 changes: 12 additions & 2 deletions taskgraph/Task.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Task graph framework."""
from pkg_resources import get_distribution
import collections
import hashlib
import inspect
Expand All @@ -15,10 +14,21 @@
import sqlite3
import threading
import time
try:
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version
except ImportError:
# importlib.metadata added to stdlib in 3.8
from importlib_metadata import PackageNotFoundError
from importlib_metadata import version

import retrying

__version__ = get_distribution('taskgraph').version
try:
__version__ = version('taskgraph')
except PackageNotFoundError:
# package is not installed; no metadata available
pass


_VALID_PATH_TYPES = (str, pathlib.PurePath)
Expand Down

0 comments on commit 3dfb378

Please sign in to comment.