How to open up requirements post pip 20.2.4 dependency update for developers

Hi All,
With the update to the dependency resolver, our current developer workflow has broken. It’s now difficult to pin versions for release but enable more open requirements for development.

TLDR: How do I pin versions in setup.py but let the developer override this version when installing.

Our current flow is
I’ve a common python package that is used from multiple project specific packages.

This is pinned to a version in each of the project packages in the setup.py:
install_requires=["mylib==1.0.0"]

This works well for distributing the project packages with their dependencies, but is a pain for developers as the library and project packages are developed in parallel. Usually the developer will have an editable install of both the library and project.

To facilitate this, we use constraints.

To install the project package in an existing virtual environment with common library already installed we run:
pip install -e ./projpackage -c any.constraints
Where any.constraints is:
mylib>=0.0.dev

To install the project package in a new virtual environment and also clone the common package as editable we run:
pip install -e ./projpackage -c dev.constraints
Where dev.constraints is:
-e git+git@github.com:path/to/mylib#egg=mylib

Now that the constraints files now add to the requirements rather than replace them, I’m not sure how to enable a simple developer flow which allows us to use the currently installed dependency (eg editable) or to pull from SCM instead of our wheel server.

Before we used this, we’d have to install the project package first using the pinned versions pulled from our wheel server and then force install the library from a git clone. Or install the project with “–no-deps” and then manually install 3rd party dependencies.

ref: https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

1 Like