pythonpippipenvlockfilepython-poetry

Cross-platform Pipenv.lock


I am creating a cross-platform Python app, using pipenv (as I understand poetry has the same issue too) for management of dependencies and virtual envs.

While trying to build the app on Windows and Linux I noticed that Pipenv.lock is platform-specific.

For example, I create a project on Windows and add pytest, it has colorama with "markers": "sys_platform == 'win32'" in the lock file. But when modifying the lock file on Linux, such as adding a new lib, this dependency will disappear.

Here is the full output on both systems and diff https://gist.github.com/AlexP11223/6457fd4c98272c526c855c63088c00d4

Is it supposed to work like that? If yes, what is the best way to handle that? Is there any better solution than just committing lock files for all platforms to the Git repo (such as Pipenv-win.lock, Pipenv-linux.lock) and renaming one of them to Pipenv.lock when building?


Solution

  • https://github.com/pypa/pipenv/issues/3902

    A Pipenv developer suggested to add --keep-outdated option. It seems to work, at least in this simple example.

    Currently it does not work in the latest release (2018.11.26), only in the Git repo master branch.

    UPD: looks like I was wrong about Poetry and it handles this correctly by default https://gist.github.com/AlexP11223/afbe247175efdcc897930d8c6ab04184