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

[Bug] requirements-txt-fixer: Index URLs Should not Sort #1054

Closed
ax3l opened this issue May 23, 2024 · 1 comment
Closed

[Bug] requirements-txt-fixer: Index URLs Should not Sort #1054

ax3l opened this issue May 23, 2024 · 1 comment

Comments

@ax3l
Copy link

ax3l commented May 23, 2024

Hi,

I have a requirements.txt file of the form

-r ../requirements.txt

openPMD-validator

# https://pytorch.org/get-started/locally/
-i https://download.pytorch.org/whl/cpu
torch

which requirements-txt-fixer reformats (and breaks) to


# https://pytorch.org/get-started/locally/
-i https://download.pytorch.org/whl/cpu
-r ../requirements.txt

openPMD-validator
torch

In this case, I intentionally use -i for the index instead of --extra-index-url to avoid index confusion attacks. But if openPMD-validator gets sorted after the -i line, then it cannot be found (because it exists on the regular PyPI index).

As a minor observation, maybe the -r ../requirements.txt should also not be moved around?

@ax3l ax3l changed the title requirements-txt-fixer: Index URLs Should not Sort [Bug[ requirements-txt-fixer: Index URLs Should not Sort May 23, 2024
@ax3l ax3l changed the title [Bug[ requirements-txt-fixer: Index URLs Should not Sort [Bug] requirements-txt-fixer: Index URLs Should not Sort May 23, 2024
@asottile
Copy link
Member

sounds like a bit of a garbage in garbage out scenario. if you isolate your torch hack to it's own file it should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants