From d33f4ec541bfb814be38539984ebcd6ca6035ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C6=B0=C6=A1ng=20Qu=E1=BB=91c=20Kh=C3=A1nh?= Date: Sun, 28 Aug 2022 02:47:16 +0900 Subject: [PATCH] Fixes pipenv lock nondeterminism with environment markers (#5299) * Fixes pipenv lock nondeterminism with environment markers --- news/5299.bugfix.rst | 1 + pipenv/utils/resolver.py | 1 + 2 files changed, 2 insertions(+) create mode 100644 news/5299.bugfix.rst diff --git a/news/5299.bugfix.rst b/news/5299.bugfix.rst new file mode 100644 index 00000000..3e724299 --- /dev/null +++ b/news/5299.bugfix.rst @@ -0,0 +1 @@ +Sorting ``constraints`` before resolving, which fixes ``pipenv lock`` generates nondeterminism environment markers. diff --git a/pipenv/utils/resolver.py b/pipenv/utils/resolver.py index 198ad484..82663b68 100644 --- a/pipenv/utils/resolver.py +++ b/pipenv/utils/resolver.py @@ -647,6 +647,7 @@ class Resolver: # Only use default_constraints when installing dev-packages if self.dev: self._constraints += self.default_constraints + self._constraints.sort(key=lambda ireq: ireq.name) return self._constraints @contextlib.contextmanager