Skip to content

add version number#203

Merged
singjc merged 2 commits intoPyProphet:masterfrom
Roestlab:add_version
Mar 26, 2026
Merged

add version number#203
singjc merged 2 commits intoPyProphet:masterfrom
Roestlab:add_version

Conversation

@jcharkow
Copy link
Copy Markdown
Contributor

add version number to init as version variable. This allows for displaying the version in the interactive contexts e.g. jupyter notebook.

add version number to __init__ as __version__ variable. This allows for
displaying the version in the interactive contexts e.g. jupyter
notebook.
Copy link
Copy Markdown
Contributor

@singjc singjc left a comment

Choose a reason for hiding this comment

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

Thanks. Can you change it to use importlib instead to derive the version number automatically? Otherwise I have to always changes two files when bumping the version number, which I may forget.

Something like

from importlib.metadata import PackageNotFoundError, version

def _detect_version() -> str:
    """Return the installed package version for redeem_properties."""
    try:
        return version("pyprophet")
    except PackageNotFoundError:
        continue
        return "0+unknown"


__version__ = _detect_version()

@jcharkow
Copy link
Copy Markdown
Contributor Author

Yes good call. Knew there was a way to do it automatically but thought it was a github action. This approach is a lot cleaner.

@singjc singjc merged commit 95f58f6 into PyProphet:master Mar 26, 2026
1 check passed
@singjc singjc deleted the add_version branch March 26, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants