Catch all exceptions getting version from VCS, fallback to importlib#1972
Merged
flying-sheep merged 2 commits intoApr 29, 2025
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1972 +/- ##
==========================================
- Coverage 87.13% 85.07% -2.07%
==========================================
Files 47 47
Lines 6848 6852 +4
==========================================
- Hits 5967 5829 -138
- Misses 881 1023 +142
🚀 New features to boost your workflow:
|
Contributor
Author
|
@flying-sheep , a gentle poke on this PR. You mentioned you were over the versioning thing; however, not being familiar with how your dev/build process looks like, I didn't feel confident removing the hatchling code. Instead, the code here:
|
Member
|
Hi! Yeah, that looks wonderful and thorough. The decision of keeping or removing the whole thing can happen independently from making it more robust! Thank you |
flying-sheep
added a commit
that referenced
this pull request
Apr 29, 2025
…lback to `importlib` (#1977) Co-authored-by: Rodrigo Goya <rgoya@users.noreply.github.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This closes #1960.
anndatadevelopers are using hatch build tool with a hatchling backend and relying on the hatch project configuration to make sure the version is up to date. However, the chosen approach can generate conflicts when the user has apyproject.tomlfile of their own (see #1960).This PR makes sure to catch all exceptions generated while trying to read the dev configuration and fall back to
importlib. Additionally, as a safeguard, even if hatchling can parse and provide the data from thepyproject.toml, we will fallback toimportlibif the project found does not match the expected project name.The project name is placed as a private constant so that it can be ported to other
scversetools that need it.anndata(v0.11.4) fails to import after trying and failing to get data frompyproject.toml#1960