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

Enforce target and interpreter requires-python versions #532

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

charliermarsh
Copy link
Member

Summary

This PR modifies the behavior of our --python-version override in two ways:

  1. First, we always use the "real" interpreter in the source distribution builder. I think this is correct. We don't need to use the fake markers for recursive builds, because all we care about is the top-level resolution, and we already assume that a single source distribution will always return the same metadata regardless of its build environment.
  2. Second, we require that source distributions are compatible with both the "real" interpreter version and the marker environment. This ensures that we don't try to build source distributions that are compatible with our interpreter, but incompatible with the target version.

Closes #407.

@charliermarsh charliermarsh changed the title Enforce target and interpreter requires-python versions Enforce target and interpreter requires-python versions Dec 4, 2023
@charliermarsh charliermarsh requested a review from konstin December 4, 2023 03:16
@charliermarsh charliermarsh added the enhancement New feature or improvement to existing functionality label Dec 4, 2023
@charliermarsh charliermarsh force-pushed the charlie/target-version branch from e8ea37f to ad772e1 Compare December 4, 2023 03:39
Comment on lines +49 to +50
if !requires_python.contains(interpreter_version)
|| !requires_python.contains(marker_version)
Copy link
Member

Choose a reason for hiding this comment

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

This is good, but i will make it harder having python as a dependency. I think we need separate python and python$build (or something else that's banned on any index) dependencies. CC @zanieb

Comment on lines -101 to -103
pub fn patch_markers(self, markers: MarkerEnvironment) -> Self {
Self { markers, ..self }
}
Copy link
Member

Choose a reason for hiding this comment

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

Happy to see this gone

@konstin konstin merged commit 0ac4254 into main Dec 4, 2023
3 checks passed
@konstin konstin deleted the charlie/target-version branch December 4, 2023 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Injecting a python version when building source distributions
2 participants