How to resolve Python package depencencies with pipenv?

后端 未结 12 2506
余生分开走
余生分开走 2020-12-13 06:35

I am using pipenv to handle a Python package dependencies.

The Python package is using two packages (named pckg1 and pckg2) that relies on

12条回答
  •  离开以前
    2020-12-13 07:01

    You can't. At the moment, pipenv doesn't offer anything for an explicit override of requirement constraints.

    As a workaround, you can put dependencies that you want to override to dev-packages as those will be overridden by packages, so this Pipfile should install pckg3>=4.1.0:

    # Pipfile
    ...
    [packages]
    pckg1 = "==3.0.0"
    
    [dev-packages]
    pckg2 = "==1.0.2"
    

    If you now lock and install:

    $ pipenv lock --dev
    $ pipenv install --dev
    

    the requirement ==4.0.11 will be overridden by >=4.1.0. This is ugly if you ask me because this is not what development packages are meant for and you're changing the role of pckg2 dependency in project, but I don't see any better way here.

提交回复
热议问题