Skip to content

Commit c29dfc1

Browse files
committed
Use importlib to set __version__; bump to 0.4.0b1
Replace the hardcoded __version__ with importlib.metadata.version("pyDataverse") so the runtime reports the installed distribution version and raise a RuntimeError if the package isn't installed. Also update the project version to 0.4.0b1 in pyproject.toml to mark a pre-release.
1 parent 30b4db3 commit c29dfc1

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

pyDataverse/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from __future__ import absolute_import
99

1010
import warnings
11+
from importlib.metadata import PackageNotFoundError, version
1112

1213
import nest_asyncio
1314

@@ -30,11 +31,16 @@
3031
__email__ = "stefan.kasberger@univie.ac.at"
3132
__copyright__ = "Copyright (c) 2019 Stefan Kasberger"
3233
__license__ = "MIT License"
33-
__version__ = "0.3.5"
34+
3435
__url__ = "https://github.com/GDCC/pyDataverse"
3536
__download_url__ = "https://pypi.python.org/pypi/pyDataverse"
3637
__description__ = "A Python module for Dataverse."
3738

39+
try:
40+
__version__ = version("pyDataverse")
41+
except PackageNotFoundError:
42+
raise RuntimeError("pyDataverse is not installed")
43+
3844
__all__ = [
3945
"Dataset",
4046
"Dataverse",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pyDataverse"
3-
version = "0.4.0"
3+
version = "0.4.0b1"
44
description = "A Python module for Dataverse."
55
readme = "README.md"
66
license = { text = "MIT" }

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)