Skip to content

Ability to skip locking/pinning of dependency versionΒ #6096

@fredrikaverpil

Description

@fredrikaverpil
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

What?

Ability to add "unlocked" or "unpinned" dependencies.

Why?

I've got loads of small library and application projects which all have few production dependencies I wish to lock the version for. But then I usually have a large number of developer dependencies. When using Poetry to manage this, I wish I had a nice solution to define that I don't need poetry to lock certain (often dev-) dependencies.

I know I'm not alone in experiencing the churn/fatigue with dependabot and opting for e.g. setuptools, flit, hatch et al instead of poetry only to make the maintenance burden easier and rely on failing CI builds/test if something breaks. Here are just some examples of fairly popular projects which are not pinning all of their dependencies to one specific version to make the case that this is not a niche request or use case:

Other reasons/motivations:

  • I have an internal project meant (by design) to be installed always using its latest versions as it distributes schemas within our organization. Using Poetry's ability to add this project as git link is excellent. But having to update the lockfile in all sorts of projects is cumbersome.
  • For some projects, it makes more sense to rely on CI/builds to fail and then go back and pin certain dependencies rather than locking/pinning everything by default.
  • It is said that poetry is meant for applications primarily, and not so much libraries. Wouldn't poetry be an amazing fit for libraries if it was possible to opt in to have certain dependencies un-pinned?

Why not use workaround...

Another CI bot with feature X

Because I like Poetry, and I don't want to add a bandaid on top of it. I just wish I was able to make an informed decision myself here.

A side-car requirements.dev.txt

That would make the developer experience less great. And how would I know that a poetry-locked dependency isn't overwritten if I perform another dependency installation outside of the Poetry resolver?
I would be better off looking into setuptools/flit/hatch and pip-tools. But then I would personally miss some very nice features in Poetry.

Ideas

How about:

[tool.poetry.dev-dependencies]
pytest = { version: ">=7.1.1", lock: false }
black = { version: "*", lock: false }
flake8 = { lock: false }
  • If another dependency depends on e.g. pytest (in the above example), and it has pytest pinned to a certain version, this pinning will be respected.
  • poetry export would export the unpinned dependencies, as defined in pyproject.toml.
  • If plugins could hook into the locking/resolver, maybe a plugin could be written to enable this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions