Skip to content

Allow installing an sdist with latest setuptools_scm#276

Merged
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:allow-installing-sdist
Jun 22, 2026
Merged

Allow installing an sdist with latest setuptools_scm#276
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:allow-installing-sdist

Conversation

@eerovaher

@eerovaher eerovaher commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

If the build requirements in pyproject.toml are modified

-    "setuptools_scm>=8.0.0",
+    "setuptools_scm>=8.0.0,<10",

to force using setuptools_scm==9.2.2 then building a source distribution of current main with

python -m build --sdist

and installing it (outside the pyerfa repository) succeeds. But without the aforementioned change in pyproject.toml the latest setuptools_scm is used, in which case building a source distribution of current main seems to succeed, but trying to install it fails. This PR allows building and installing a source distribution with the latest setuptools_scm without causing (obvious) problems with setuptools_scm==9.2.2.

EDIT:

Apparently the change is not directly caused by setuptools_scm but instead by the new vcs-versioning release, which was not a dependency for setuptools_scm<10, but is a dependency now.

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.
Comment thread setup.py
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 avalentino merged commit 8559c21 into liberfa:main Jun 22, 2026
36 of 37 checks passed
@eerovaher eerovaher deleted the allow-installing-sdist branch June 24, 2026 12:53
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