Add envvar for emit index url#2192
Open
cloudsmith-iduffy wants to merge 3 commits intojazzband:mainfrom
Open
Conversation
When somebody has a custom global index-url defined in their pip conf pip-compile ends up placing it into the generated requirements.txt Not only does it place in the index url, it also places any authentication credentials. By exposing PIP_TOOLS_EMIT_INDEX_URL as an environment variable we will enable users with a custom global index-url set to change the default behaviour of pip-compile to false for including it via an envvar.
for more information, see https://pre-commit.ci
webknjaz
reviewed
Jul 9, 2025
README.md
Outdated
Member
There was a problem hiding this comment.
I think that's the unstable prettier hook inserting noise.
If the initial commit is rebased (discarding the pre-commit.ci fixup), it shouldn't happen again, since we removed that hook.
webknjaz
reviewed
Jul 9, 2025
| @@ -640,7 +640,6 @@ This will be indicated in the output with one of the following suffixes: | |||
| - [pip-compile-multi](https://pip-compile-multi.readthedocs.io/en/latest/) - pip-compile command wrapper for multiple cross-referencing requirements files. | |||
| - [pipdeptree](https://github.com/tox-dev/pipdeptree) to print the dependency tree of the installed packages. | |||
| - `requirements.in`/`requirements.txt` syntax highlighting: | |||
Member
There was a problem hiding this comment.
Suggested change
| - `requirements.in`/`requirements.txt` syntax highlighting: | |
| - `requirements.in`/`requirements.txt` syntax highlighting: | |
webknjaz
reviewed
Jul 9, 2025
| "--emit-index-url/--no-emit-index-url", | ||
| is_flag=True, | ||
| default=True, | ||
| envvar="PIP_TOOLS_EMIT_INDEX_URL", |
Member
There was a problem hiding this comment.
This probably needs tests and docs.
Member
|
@cloudsmith-iduffy hi, are you planning to add tests for this? |
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.
When somebody has a custom global index-url defined in their pip conf pip-compile ends up placing it into the generated requirements.txt
Not only does it place in the index url, it also places any authentication credentials.
By exposing PIP_TOOLS_EMIT_INDEX_URL as an environment variable we will enable users with a custom global index-url set to change the default behaviour of pip-compile to false using the envvar.
Contributor checklist
Maintainer checklist
backwards incompatible,feature,enhancement,deprecation,bug,dependency,docsorskip-changelogas they determine changelog listing.