Skip to content

Use importlib to set __version__ and bump to 0.4.0beta1#235

Merged
JR-1991 merged 2 commits into
mainfrom
beta-release
Jun 23, 2026
Merged

Use importlib to set __version__ and bump to 0.4.0beta1#235
JR-1991 merged 2 commits into
mainfrom
beta-release

Conversation

@JR-1991

@JR-1991 JR-1991 commented Jun 18, 2026

Copy link
Copy Markdown
Member

This pull request updates the versioning approach for the pyDataverse package and makes related improvements to how the version is managed and reported. Instead of hardcoding the version in the codebase, it now dynamically retrieves the version from the installed package metadata, and the project version is updated to a beta release.

Version management improvements:

  • The __version__ attribute in pyDataverse/__init__.py is now dynamically set using importlib.metadata.version("pyDataverse"), ensuring it always reflects the installed package version. If the package is not installed, a RuntimeError is raised. [1] [2]
  • The hardcoded version string in pyDataverse/__init__.py is removed to avoid inconsistencies with the actual installed version.

Project version update:

  • The project version in pyproject.toml is updated from 0.4.0 to the beta release 0.4.0beta1.

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.
@JR-1991 JR-1991 self-assigned this Jun 18, 2026
@JR-1991 JR-1991 added the pkg:pkg Package related activities label Jun 18, 2026
@JR-1991 JR-1991 added this to the 0.4.0 milestone Jun 18, 2026
Comment thread pyproject.toml Outdated
[project]
name = "pyDataverse"
version = "0.4.0"
version = "0.4.0b1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use...

version = "0.4.0beta1"

... according to https://packaging.python.org/en/latest/specifications/version-specifiers/#pre-release-spelling which says this:

"Pre-releases allow the additional spellings of alpha, beta, c, pre, and preview for a, b, rc, rc, and rc respectively. This allows versions such as 1.1alpha1, 1.1beta2, or 1.1c3 which normalize to 1.1a1, 1.1b2, and 1.1rc3. In every case the additional spelling should be considered equivalent to their normal forms."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just pushed the 0.4.0beta1 change

Update pyproject.toml: change the project version from 0.4.0b1 to 0.4.0beta1 to use an explicit 'beta' prerelease identifier for clarity.
@JR-1991 JR-1991 changed the title Use importlib to set __version__ and bump to 0.4.0b1 Use importlib to set __version__ and bump to 0.4.0beta1 Jun 22, 2026
@JR-1991 JR-1991 merged commit 7f56e21 into main Jun 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:pkg Package related activities

Projects

Development

Successfully merging this pull request may close these issues.

2 participants