Skip to content

Commit 46a878f

Browse files
tomvdwThe TensorFlow Datasets Authors
authored andcommitted
Migrate from pkg_resources to packaging for version parsing.
Update build dependencies and version parsing logic in setup.py to use the `packaging` library instead of the deprecated `pkg_resources`. PiperOrigin-RevId: 911244969
1 parent aa6bbf9 commit 46a878f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[build-system]
22
# PEP 508 specs
3-
requires = ["setuptools", "wheel"]
3+
requires = ["setuptools", "wheel", "packaging"]
44
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import os
3030
import sys
3131

32-
import pkg_resources
32+
from packaging.version import Version
3333
import setuptools
3434

3535
# To enable importing version.py directly, we add its path to sys.path.
@@ -40,7 +40,7 @@
4040
if datestring := os.environ.get('TFDS_NIGHTLY_TIMESTAMP'):
4141
project_name = 'tfds-nightly'
4242
# Version as `X.Y.Z.dev199912312459`
43-
curr_version = pkg_resources.parse_version(__version__)
43+
curr_version = Version(__version__)
4444
__version__ = f'{curr_version.base_version}.dev{datestring}'
4545
else:
4646
project_name = 'tensorflow-datasets'

0 commit comments

Comments
 (0)