peterbe / hashin

Helping you write hashed entries for packages in your requirements.txt
https://www.peterbe.com/plog/hashin
MIT License
105 stars 27 forks source link

Add an optional --index-url argument similar to that in pip #107

Closed nmacinnis closed 5 years ago

nmacinnis commented 5 years ago

Adds an optional --index-url argument so that hashin can be used with an alternate package index.

Pip supports this behavior with the same argument. Hashin was hardcoded to point at pypi.org, so if you happened to be working with an alternate index, hashin couldn't help you.

Pip also accepts an --extra-index-url argument, but I'm guessing that hashin won't benefit much from supporting the same. I expect the main use case of --index-url to be a package or package version that only exists on the alternate index.

nmacinnis commented 5 years ago

@peterbe thanks for the feedback!

I was already looking at reducing the size of the changeset by defaulting the index url kwarg in a few places. I've incorporated the env var idea. Also made the index url kwarg into a regular positional argument in get_package_data because it is obviously mandatory as you noted.