Cross-platform Pipenv.lock?
See original GitHub issueI am creating a cross-platform Python app.
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 (pipenv install hello-world
), this dependency will disappear.
diff ../py-win/Pipfile.lock Pipfile.lock
4c4
< "sha256": "828b8ad012f4c8773e6e61e3ac2be0ffcd7540fd7ed175a8355676c8e31c4d3d"
---
> "sha256": "c4a1bdfad8e2d208344003d9c704432100fbcb9bd87f713178895637222767a4"
33c33
< "colorama": {
---
> "hello-world": {
35,36c35
< "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d",
< "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"
---
> "sha256:f236ab36224613dff8db190dc4a02b3787c3d19e95f7e0876e3098966118bc1e"
38,39c37,38
< "markers": "sys_platform == 'win32'",
< "version": "==0.4.1"
---
> "index": "pypi",
> "version": "==0.2"
Here is the full output on both systems: https://gist.github.com/AlexP11223/6457fd4c98272c526c855c63088c00d4
Is it supposed to work like that? If yes, what is the best way to handle that for cross-platform apps? 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?
Pipenv version: '2018.11.26'
Pipenv location: 'C:\\Users\\user\\AppData\\Roaming\\Python\\Python37\\site-packages\\pipenv'
Python location: 'c:\\python37\\python.exe'
Python installations found:
3.7.3
:C:\Python37\python.exe
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.3',
'os_name': 'nt',
'platform_machine': 'AMD64',
'platform_python_implementation': 'CPython',
'platform_release': '10',
'platform_system': 'Windows',
'platform_version': '10.0.17763',
'python_full_version': '3.7.3',
'python_version': '3.7',
'sys_platform': 'win32'}
Pipenv version: '2018.11.26'
Pipenv location: '/home/alex/.local/lib/python3.7/site-packages/pipenv'
Python location: '/usr/bin/python3'
Python installations found:
3.7.3
:/usr/bin/python3.7
3.7.3
:/usr/bin/python3.7m
2.7.16
:/usr/bin/python
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.3',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '5.0.0-21-generic',
'platform_system': 'Linux',
'platform_version': '#22+system76-Ubuntu SMP Tue Jul 16 19:57:52 UTC 2019',
'python_full_version': '3.7.3',
'python_version': '3.7',
'sys_platform': 'linux'}
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (6 by maintainers)
Top GitHub Comments
I mean that it should be the default behavior (otherwise someone will forget to add it sooner or later), not hidden under some switch with an unrelated name (which probably does more than just keeping dependencies marked as for other platforms).
For anyone that may have initially thought to use
--keep-outdated
as I did and doing apipenv install --dev --keep-outdated pytest
this will not reinstall and capture the pytest dependancies for that platform. Instead, you can used it with the lock command and get all the platform specific dependancies for your whole project:pipenv lock --keep-outdated
Probably most people read it that way to begin with, but not I, for whatever reason.
Maybe worth scanning your the diff of your
Pipfile.lock
though, to make sure no unexpected versions get changed or removed.