Allow installing an sdist with latest setuptools_scm#276
Merged
Conversation
Recent changes in `setuptools_scm` broke installing `pyerfa` from a source distribution also built with recent `setuptools_scm`. Recent versions now try to check whether ERFA and `pyerfa` versions are compatible even when installing from a source distribution, but the source distribution does not allow inspecting the `liberfa/erfa/` tags. The tags might also not be available if `pyerfa` is being built from its repository that was cloned without submodules, but that would cause an error before any `setuptools_scm`-specific code is executed. Therefore it is safe to assume that if `setuptools_scm` cannot inspect the tags then `pyerfa` is being installed from a source distribution, so the version does not need to be checked because that should have been done when the source distribution was built. Building and installing a source distribution with `setuptools_scm` 9.2.2 works both with and without this patch.
eerovaher
commented
Jun 22, 2026
Comment on lines
134
to
+138
| erfa_version = git.parse(LIBERFADIR, config=Configuration(root=LIBERFADIR)) | ||
| if erfa_version is None: | ||
| raise RuntimeError("unable to determine liberfa/erfa version") | ||
| # Must be installing from an sdist. Any warnings should have been dealt with | ||
| # when the sdist was built, so we can assume version_string is correct. | ||
| return version_string |
Contributor
Author
There was a problem hiding this comment.
The other reason I can imagine why inspecting liberfa/erfa/ tags might fail is if the submodule has not been initialized properly, but all the different ways of having an uninitialized submodule I've tried have caused an error before this code is called.
avalentino
approved these changes
Jun 22, 2026
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.
If the build requirements in
pyproject.tomlare modifiedto force using
setuptools_scm==9.2.2then building a source distribution of currentmainwithand installing it (outside the
pyerfarepository) succeeds. But without the aforementioned change inpyproject.tomlthe latestsetuptools_scmis used, in which case building a source distribution of currentmainseems to succeed, but trying to install it fails. This PR allows building and installing a source distribution with the latestsetuptools_scmwithout causing (obvious) problems withsetuptools_scm==9.2.2.EDIT:
Apparently the change is not directly caused by
setuptools_scmbut instead by the newvcs-versioningrelease, which was not a dependency forsetuptools_scm<10, but is a dependency now.