Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix #6171 #6247

Merged
merged 6 commits into from
Sep 20, 2024
Merged

Fix #6171 #6247

merged 6 commits into from
Sep 20, 2024

Conversation

Naofal-Helal
Copy link
Contributor

@Naofal-Helal Naofal-Helal commented Sep 18, 2024

The issue

packages are not sorted when installing with extras.

ref #6171

The fix

Updating the toml table by body index rather than dict key seems to fix the issue:

diff --git a/pipenv/utils/toml.py b/pipenv/utils/toml.py
index 1eec3fed..1f69de45 100644
--- a/pipenv/utils/toml.py
+++ b/pipenv/utils/toml.py
@@ -44,7 +44,7 @@ def convert_toml_outline_tables(parsed, project):
             body = section._internal_container._body
         else:
             body = section._body
-        for key, value in body:
+        for index, (key, value) in enumerate(body):
             if not key:
                 continue
             if hasattr(value, "keys") and not isinstance(
@@ -52,7 +52,7 @@ def convert_toml_outline_tables(parsed, project):
             ):
                 table = tomlkit.inline_table()
                 table.update(value.value)
-                result[key.key] = table
+                result.value._body[index] = (key, table.value)
         return result

The checklist

  • Associated issue
  • A news fragment in the news/ directory to describe this fix with the extension .bugfix.rst, .feature.rst, .behavior.rst, .doc.rst. .vendor.rst. or .trivial.rst (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.

@Naofal-Helal Naofal-Helal marked this pull request as ready for review September 18, 2024 11:34
@oz123 oz123 merged commit 472b118 into pypa:main Sep 20, 2024
22 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants