Skip to content

-e . does not take precedence over pin in requirements file #8307

Closed
@davidism

Description

@davidism

I've been experimenting with using pip-compile for Jinja, and have run into an interesting circular dependency between Jinja and Sphinx. Jinja uses an editable install (-e .) for development. Jinja lists Sphinx in requirements.in for building docs. But Sphinx depends on Jinja, so jinja2==2.11.1 gets pinned in requirements.txt. But this pin overwrites the locally installed version of Jinja, which is what should be documented and tested.

I wanted to provide contributors with a command to set up a dev env. Using the current resolver, pip install -e . -r requirements.txt ends up installing jinja2==2.11.1 from requirements.txt instead of -e . The order of -e and -r in the command doesn't matter.

Using the alpha resolver, pip install --unstable-feature=resolver -e . -r requirements.txt (or -r -e) produces an error.

$ pip install --unstable-feature=resolver -r requirements/dev.txt -e .
Obtaining file:///home/david/Projects/jinja
ERROR: Could not find a version that satisfies the requirement ExplicitRequirement(EditableCandidate('file:///home/david/Projects/jinja'))
ERROR: Could not find a version that satisfies the requirement jinja2==2.11.2
ERROR: No matching distribution found for jinja2, jinja2

I would expect a local install to always take precedence over pinned requirements. Otherwise, projects that depend on each other during development will have a more difficult time pinning requirements.

As a workaround, the editable install can be done as a separate command. Tox, Nox, and ReadTheDocs can install the local project after the dependencies, but adding a second command introduces a hard to detect way for new contributors to misconfigure their local environment.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions