To add an alternative to what’s already been suggested: you can keep a requirements.in with your explicit dependencies, and use pip-tools’s pip-compile to generate requirements.txt with the full tree, version locked. Or you can generate this from a pyproject.toml. Then you can use pip-tools’s pip-sync to install and uninstall packages to make your actual environment match the .txt lockfile.
To add an alternative to what’s already been suggested: you can keep a
requirements.inwith your explicit dependencies, and use pip-tools’spip-compileto generaterequirements.txtwith the full tree, version locked. Or you can generate this from apyproject.toml. Then you can use pip-tools’spip-syncto install and uninstall packages to make your actual environment match the.txtlockfile.