I'd suggest reading up on poetry. It's much more rigorous than pip for reasons that other commenters have said... but in particular the --dev and --extras arguments allow you to do exactly what you're writing about out of the box, with the benefits that you can define groups of --extras to install conditionally.