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

Filter out build requirements that require an extra to be used #11112

Merged
merged 2 commits into from May 12, 2022

Conversation

pradyunsg
Copy link
Member

@pradyunsg pradyunsg commented May 12, 2022

Fixes #11110, I think?

There is no mechanism provided for build requirements to have extras.

It should be acceptable to enforce that any "optional" packages
that are supposed to be conditionally installed based on the presence of
an extra should not be installed in a build environment.
@woodruffw
Copy link
Member

Giving it a try now!

@woodruffw
Copy link
Member

woodruffw commented May 12, 2022

This worked for me:

$ pip install git+https://github.com/pypa/pip.git@611e9253ff74ca5b8ce438c2423373ab0d44c961
$ pip install --editable .[dev]

And confirming that it's a dev version:

$ pip --version
pip 22.2.dev0 from /Users/william/devel/sigstore-python/env/lib/python3.10/site-packages/pip (python 3.10)

@pfmoore
Copy link
Member

pfmoore commented May 12, 2022

IMO, packaging should assume an empty list of extras by default, rather than requiring the caller to specify it explicitly, but that's another matter.

This LGTM, though.

@pradyunsg pradyunsg marked this pull request as ready for review May 12, 2022 20:23
@pradyunsg pradyunsg merged commit 0a982f6 into pypa:main May 12, 2022
@pradyunsg pradyunsg deleted the filter-out-build-env-extras branch May 12, 2022 20:30
@woodruffw
Copy link
Member

Thanks for the rapid fix!

inmantaci pushed a commit to inmanta/inmanta-core that referenced this pull request May 23, 2022
Bumps [pip](https://github.com/pypa/pip) from 22.1 to 22.1.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/pypa/pip/blob/main/NEWS.rst">pip's changelog</a>.</em></p>
<blockquote>
<h1>22.1.1 (2022-05-20)</h1>
<h2>Bug Fixes</h2>
<ul>
<li>Properly filter out optional dependencies (i.e. extras) when checking build environment distributions. (<code>[#11112](pypa/pip#11112) &lt;https://github.com/pypa/pip/issues/11112&gt;</code>_)</li>
<li>Change the build environment dependency checking to be opt-in. (<code>[#11116](pypa/pip#11116) &lt;https://github.com/pypa/pip/issues/11116&gt;</code>_)</li>
<li>Allow using a pre-release version to satisfy a build requirement. This helps
manually populated build environments to more accurately detect build-time
requirement conflicts. (<code>[#11123](pypa/pip#11123) &lt;https://github.com/pypa/pip/issues/11123&gt;</code>_)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/pypa/pip/commit/ca2d9f41931a449b8c1b27d02031199d91af93e7"><code>ca2d9f4</code></a> Bump for release</li>
<li><a href="https://github.com/pypa/pip/commit/f20ab575b930b44ea524b0dbdb162f3cecfdf890"><code>f20ab57</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11124">#11124</a> from uranusjr/use-contain-for-checking</li>
<li><a href="https://github.com/pypa/pip/commit/f7c05a51241e3ea656f94f2d79d0afdcf2b0165f"><code>f7c05a5</code></a> Allow pre-release to satisfy build requirements</li>
<li><a href="https://github.com/pypa/pip/commit/30af8074bf83d41a9dacdcd13fb6ca982856032d"><code>30af807</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11117">#11117</a> from q0w/opt-check</li>
<li><a href="https://github.com/pypa/pip/commit/923cb5a197a742bf83797c2190118bdb0e276753"><code>923cb5a</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11119">#11119</a> from pradyunsg/move-add_requirement-to-legacy-resolver</li>
<li><a href="https://github.com/pypa/pip/commit/d673aa14284788ea12a789b34846353b7cb3d46f"><code>d673aa1</code></a> Move <code>RequirementSet.add_requirement</code> into <code>LegacyResolver</code></li>
<li><a href="https://github.com/pypa/pip/commit/3166157e406eeaa3e4a6e4db586b04122b411fe9"><code>3166157</code></a> Opt to check build dependencies</li>
<li><a href="https://github.com/pypa/pip/commit/0a982f6444a4e08f601d4b0744b25dd19697306a"><code>0a982f6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11112">#11112</a> from pradyunsg/filter-out-build-env-extras</li>
<li><a href="https://github.com/pypa/pip/commit/bf090d37d18f27a60839063d02f607185a8d1164"><code>bf090d3</code></a> 📰</li>
<li><a href="https://github.com/pypa/pip/commit/d0c89a151c82a91161477cc9b385833efc18289a"><code>d0c89a1</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/10865">#10865</a> from pypa/pradyunsg-patch-1</li>
<li>Additional commits viewable in <a href="https://github.com/pypa/pip/compare/22.1...22.1.1">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pip&package-manager=pip&previous-version=22.1&new-version=22.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
inmantaci pushed a commit to inmanta/inmanta-core that referenced this pull request May 23, 2022
Bumps [pip](https://github.com/pypa/pip) from 22.1 to 22.1.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/pypa/pip/blob/main/NEWS.rst">pip's changelog</a>.</em></p>
<blockquote>
<h1>22.1.1 (2022-05-20)</h1>
<h2>Bug Fixes</h2>
<ul>
<li>Properly filter out optional dependencies (i.e. extras) when checking build environment distributions. (<code>[#11112](pypa/pip#11112) &lt;https://github.com/pypa/pip/issues/11112&gt;</code>_)</li>
<li>Change the build environment dependency checking to be opt-in. (<code>[#11116](pypa/pip#11116) &lt;https://github.com/pypa/pip/issues/11116&gt;</code>_)</li>
<li>Allow using a pre-release version to satisfy a build requirement. This helps
manually populated build environments to more accurately detect build-time
requirement conflicts. (<code>[#11123](pypa/pip#11123) &lt;https://github.com/pypa/pip/issues/11123&gt;</code>_)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/pypa/pip/commit/ca2d9f41931a449b8c1b27d02031199d91af93e7"><code>ca2d9f4</code></a> Bump for release</li>
<li><a href="https://github.com/pypa/pip/commit/f20ab575b930b44ea524b0dbdb162f3cecfdf890"><code>f20ab57</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11124">#11124</a> from uranusjr/use-contain-for-checking</li>
<li><a href="https://github.com/pypa/pip/commit/f7c05a51241e3ea656f94f2d79d0afdcf2b0165f"><code>f7c05a5</code></a> Allow pre-release to satisfy build requirements</li>
<li><a href="https://github.com/pypa/pip/commit/30af8074bf83d41a9dacdcd13fb6ca982856032d"><code>30af807</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11117">#11117</a> from q0w/opt-check</li>
<li><a href="https://github.com/pypa/pip/commit/923cb5a197a742bf83797c2190118bdb0e276753"><code>923cb5a</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11119">#11119</a> from pradyunsg/move-add_requirement-to-legacy-resolver</li>
<li><a href="https://github.com/pypa/pip/commit/d673aa14284788ea12a789b34846353b7cb3d46f"><code>d673aa1</code></a> Move <code>RequirementSet.add_requirement</code> into <code>LegacyResolver</code></li>
<li><a href="https://github.com/pypa/pip/commit/3166157e406eeaa3e4a6e4db586b04122b411fe9"><code>3166157</code></a> Opt to check build dependencies</li>
<li><a href="https://github.com/pypa/pip/commit/0a982f6444a4e08f601d4b0744b25dd19697306a"><code>0a982f6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/11112">#11112</a> from pradyunsg/filter-out-build-env-extras</li>
<li><a href="https://github.com/pypa/pip/commit/bf090d37d18f27a60839063d02f607185a8d1164"><code>bf090d3</code></a> 📰</li>
<li><a href="https://github.com/pypa/pip/commit/d0c89a151c82a91161477cc9b385833efc18289a"><code>d0c89a1</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pypa/pip/issues/10865">#10865</a> from pypa/pradyunsg-patch-1</li>
<li>Additional commits viewable in <a href="https://github.com/pypa/pip/compare/22.1...22.1.1">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pip&package-manager=pip&previous-version=22.1&new-version=22.1.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

22.1: Editable installs for packages with extras & flit causes UndefinedEnvironmentName
3 participants