You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
requirements-txt-fixer ordering breaks using --index-url and --extra-index-url together in requirements.txt #612
If you use both the --index-url and --extra-index-url flags together in a requirements.txt file the hook will put --extra-index-url above the --index-url which causes the url set to index-url be skipped. I suppose this is because the flags are also sorted alphabetically.
something like that doesn't really make sense as a hook -- looking at global settings doesn't make sense for something that's supposed to check source code
plus you'd have to know to configure such a thing and at that point you might as well just turn off the bad setting -- it's not something you're going to "accidentally" commit one day
@asottile please review if you have time. I'm hoping this PR is simple enough and goes with the spirit of the special case you mentioned. Also, I'd appreciate if you could label w/ hacktoberfest-accepted so I can get a tree planted, thanks.
I’m a new contributor and I’ve started looking into the current behavior of requirements-txt-fixer when both --index-url and --extra-index-url are present.
My plan is to reproduce the behavior locally, add a test for it, and submit a PR with a minimal fix. Please let me know if this issue is still available or if there’s any preferred approach.
Activity
asottile commentedon Jun 14, 2021
note that
--extra-index-urlis unsafe and should generally never be useda special case could be added, though my thought is that supporting something that shouldn't be used seems like unnecessary work
redfungus commentedon Jun 14, 2021
@asottile I did not know about the security problems! Thank you for the link!
robin-snt commentedon Jun 21, 2022
Is there a pre-commit hook for detecting if the developer has incorrectly configured pip to run with
--extra-index-urlinstead of--index-url?I mean in addition to simply reading the requirements files, so it would also detect if the global pip config has been incorrectly configured?
asottile commentedon Jun 21, 2022
something like that doesn't really make sense as a hook -- looking at global settings doesn't make sense for something that's supposed to check source code
plus you'd have to know to configure such a thing and at that point you might as well just turn off the bad setting -- it's not something you're going to "accidentally" commit one day
robin-snt commentedon Jun 21, 2022
@asottile Your insight is highly appreciated!
renegaderyu commentedon Oct 19, 2022
@asottile please review if you have time. I'm hoping this PR is simple enough and goes with the spirit of the special case you mentioned. Also, I'd appreciate if you could label w/
hacktoberfest-acceptedso I can get a tree planted, thanks.asottile commentedon Oct 19, 2022
I'm not going to review something which doesn't pass tests
renegaderyu commentedon Oct 20, 2022
@asottile Apologies for not seeing the failing tests before asking. I think its ready now.
repairman29 commentedon Jan 9, 2026
Hey there! This looks like something I could help with. I'd be happy to take a look and see what we can do.
LouisLau-art commentedon Feb 5, 2026
Opened a PR to keep
--index-urlordered before--extra-index-urlinrequirements-txt-fixer(with a regression test): #1241Eric19881020 commentedon Apr 2, 2026
Hi, I’d like to work on this issue.
I’m a new contributor and I’ve started looking into the current behavior of
requirements-txt-fixerwhen both--index-urland--extra-index-urlare present.My plan is to reproduce the behavior locally, add a test for it, and submit a PR with a minimal fix. Please let me know if this issue is still available or if there’s any preferred approach.
Eric19881020 commentedon Apr 9, 2026
I’ve opened a PR for this issue. Please take a look when you have time. Thanks!
Eric19881020 commentedon Apr 9, 2026
I opened a PR for this: #1248