Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard API for version information #1317

Open
flying-sheep opened this issue Jan 18, 2024 · 1 comment · May be fixed by #1318
Open

Use standard API for version information #1317

flying-sheep opened this issue Jan 18, 2024 · 1 comment · May be fixed by #1318

Comments

@flying-sheep
Copy link
Member

flying-sheep commented Jan 18, 2024

Please describe your wishes and possible alternatives to achieve the desired result.

In our code, we access something.__version__ in multiple places.

This is a convention, but a standard API exists for this metadata: importlib.metadata.version('something'). We should use that.

We already do that in scanpy, almost everywhere: https://github.com/scverse/scanpy/blob/e00932b6d5b1694d7706b36a0dc604aa2c27d885/scanpy/_compat.py#L69-L73

@flying-sheep flying-sheep linked a pull request Jan 18, 2024 that will close this issue
3 tasks
@flying-sheep
Copy link
Member Author

OK, summary of @ivirshup’s and my discussion:

There are some rare cases that require jumping around between commits in editable installs so much that .__version__ and version() disagree in a significant way. E.g. @ivirshup sometimes debugs something in both an upstream and then a downstream library with both being editably installed so he can quickly git switch between versions. Then he makes a PR from one of these repos. During this process the discrepancy can get so big that apparently some version checks in some librarly can get affected and result in different code paths.

Since there are projects relying on either (or in case of scanpy, both) APIs for version checks, and packages that don’t have .__version__, the situation is already broken: One can’t rely on anything working, even if all our projects use .__version__ exclusively where possible.

Resolutions:

@ivirshup did I get that all right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant