Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: remove __version__ cargo cult#495

Merged
grst merged 1 commit into
mainscverse/cookiecutter-scverse:mainfrom
pa/remove-versionscverse/cookiecutter-scverse:pa/remove-versionCopy head branch name to clipboard
Apr 18, 2026
Merged

feat: remove __version__ cargo cult#495
grst merged 1 commit into
mainscverse/cookiecutter-scverse:mainfrom
pa/remove-versionscverse/cookiecutter-scverse:pa/remove-versionCopy head branch name to clipboard

Conversation

@flying-sheep

@flying-sheep flying-sheep commented Apr 17, 2026

Copy link
Copy Markdown
Member

__version__ is an old magic spell that has been cargo-culted to modern times without need. Some people even derived more magic from it like __author__, but nothing caught on so tenaciously as __version__.

Much breath has been wasted over purported health benefits such as “performance”. I won’t repeat all that here, just trust me: we shouldn’t propagate this vestige.

People can and should just use importlib.metadata.version('pkgname').

There should be one– and preferably only one –obvious way to do it.

compatibiliy

this is backwards-compatible, as __version__ is neither in the docs nor in __all__ and therefore not a public API.

@github-actions

Copy link
Copy Markdown

A PR has been generated to the instance repo: scverse/cookiecutter-scverse-instance#272

Checks Status Documentation Preview

You can check out the PR to preview your changes in an instance of the cookiecutter template.
It will be kept in sync with this PR automatically.

@grst

grst commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

While I agree that people should use importlib, there's still a lot of functionality built around this convention.
I don't think it's wrong providing backwards-compatibility with this approach for such a little cost.

@flying-sheep

flying-sheep commented Apr 17, 2026

Copy link
Copy Markdown
Member Author

There’s only session-info AFAIK, which not only is very old, but also very tenuously maintained (don’t look at its code 😨). I built session-info2 to replace it and it seems to hold up nicely, there has been exactly one bug so far (around .pth handling, was fixed quickly).

@grst

grst commented Apr 18, 2026

Copy link
Copy Markdown
Collaborator

I thought about it again and came to the conclusion that you are right. If at this point anyone relies on version it's a bug on their end.

This was referenced Jul 17, 2026
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.