But I'm sure I'm missing something. Please feel free to convince me I'm wrong :)
But I'm sure I'm missing something. Please feel free to convince me I'm wrong :)
I know that it's just a few simple operations for me to do it myself, but npm has spoiled me.
This is a missing feature, there are various hacks but nothing concrete.
If you're working on a large project you have to keep track of all your dependencies and preferably only add the main dependency, not its dependencies, into requirements.
I tend to avoid doing pip freeze > requirements.txt because it lists packages I know shouldn't be in requirements.
Like civilian, my main ask for an improved pip would be a way to save a single explicit package into my requirements.txt by adding a --save flag when installing it.
I don't want to include sub-dependencies in my requirements.txt.
The way to maintain requirements.txt with single dependencies (base dependencies maybe, I'm self-taught on the lingo), is to manually add them one by one.
Pip freeze is useless because it adds a lot of things you don't need into requirements, making it cluttered and hard to follow.
Another benefit is named groups, which allow you to more succinctly specify dependencies for various environments (dev/test/production/etc.) Along with this you get the benefits of the lock file so you can be assured the subset of libraries you use in production will be the exact tested libraries you use in your larger dev/test environment.
in fact, there's already a library for this called pip-tools (https://github.com/nvie/pip-tools) that generates a requirements.txt (the lock file) from a requirements.in (your direct dependencies)
To fix that, you'd need something like Nix.
Installing the project would cause it to be built from the lock file (assuming the Pipefile hasn't changed). This will mean your users won't get "some version" of a library you depend on between verion 1.0 and 2.0 or whatever range you specified. They'll get the exact package you last successfully used and checked in yourself, right down to the git commit if applicable.
Once you modify the Pipfile then pip will resolve your dependencies and try to make the specified changes by adding/removing/upgrading packages. If Pypa continues following bundler conventions this will be done by making the fewest changes possible from your existing versions in your lock file. You'll also have an upgrade mode where pip will rebuild you project from the Pipfile looking for the most recent versions of all libraries or a specified library within your specified version ranges. When done and your app/tests are working, check in the new version and you can ensure all your users/environments will be able to upgrade cleanly.
https://caremad.io/posts/2013/07/setup-vs-requirement/ covers it pretty well. Or https://medium.com/@sdboyer/so-you-want-to-write-a-package-m... for a fantastic read and a LOT more context.
Grouping of sub-dependency groups (e.g. a testing group).
That seems like an improvement over having multiple requirement files. Then again, I'm perfectly happy with separate dev/testing files.It'd be nice to be able to mark a dependency as being conditional based on some expression, e.g. `$PYTHON_VERSION_MAJOR >= 3`.