Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix #6171 #6247

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Fix #6171 #6247

wants to merge 6 commits into from

Conversation

Naofal-Helal
Copy link

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants