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

--update-all and --interactive #96

Closed peterbe closed 5 years ago

peterbe commented 5 years ago

Fixes #90

peterbe commented 5 years ago

@mythmon I don't need an in-depth review but can you take a look?

Basically, the way I test it is:

python hashin.py -r ~/songsearch/requirements.txt -i -u --dry-run

Do you like the interactive prompt? Is it working? Anything else obvious you see?

peterbe commented 5 years ago

Sigh. I've stumbled on a bug when working on that feedback.

In an old requirements.txt file I had, I had it entered as discogs_client==2.2.1 but it appears that that's been renamed all of a sudden to discogs-client.

I already had some code in place to deal with case insensitivity. E.g. if you had DjAnGo==2.1.2 in your requirements file it shouldn't barf.

What should happen in this case, if I chose to press "Y" to upgrade to that discogs* package, it should not only replace the version and the hashes but also the name.

Back to the drawingboard a bit.

peterbe commented 5 years ago

@mythmon Wanna take a last look? The recent changes are quite insignificant. In particular, I discovered a bug in my first attempt where if you had some-package=1.2.3 in your requirements file but, over time, that package has been renamed (301 in Pypi JSON lingo) to other-package then my it wouldn't work. Now it works and there are unit tests for that too.

The other thing I changed was that I add the "?" option to the prompt. Thank you. Also, I changed it so that if you do say "A" ("all") it will "keep the interactive", but not ask any more questions. That way you can clearly see which packages can be updated and what they get updated to.