I have a package which has a complex web of dependencies. I need to publish this on PyPI; it's not designed as an end-user application. However, when I install the package, I get messages such as INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
. Often this goes on for longer than an hour, and I have to kill the installation process.
However, none of this happens if I pip install my_package --use-deprecated=legacy-resolver
. This is fine for development, but once I publish on PyPI, my users will have to use --use-deprecated=legacy-resolver
if they want it to ever install.
I could introduce arbitrary version constraints to help the resolver as suggested by Pip, but I don't actually want to constrain versions unnecessarily, because this will limit the compatibility of my package. And in any case I have tried doing this and limiting the dependency ranges of a few packages doesn't help, because most of the problematic dependencies are transitive dependencies - dependencies of dependencies. I don't want to declare these in my pyproject.toml
because I don't actually use them myself.
Is there an official way to declare that I want to use a different dependency resolver for my package, such as the legacy one? Does PEP 517 make this possible? Or is this a core limitation of the Python ecosystem? Can I use a lockfile or constraint file for a published package to hint to the resolver which versions to use without restricting it?