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

Deletes second platform dependency #231

Closed
hugovk opened this issue Jul 2, 2024 · 1 comment · Fixed by tox-dev/pyproject-fmt-rust#37
Closed

Deletes second platform dependency #231

hugovk opened this issue Jul 2, 2024 · 1 comment · Fixed by tox-dev/pyproject-fmt-rust#37

Comments

@hugovk
Copy link
Contributor

hugovk commented Jul 2, 2024

Given config like this, which is meant to install a dependency on macOS and Windows, but not Linux:

[project]
name = "testing"
classifiers = [
  "Programming Language :: Python :: 3 :: Only",
  "Programming Language :: Python :: 3.8",
  "Programming Language :: Python :: 3.9",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
]
dependencies = [
  'pyperclip; platform_system == "Darwin"',
  'pyperclip; platform_system == "Windows"',
]

pyproject-fmt 2.1.3 deletes the first dependency:

❯ pyproject-fmt pyproject.toml
--- pyproject.toml

+++ pyproject.toml

@@ -9,6 +9,5 @@

   "Programming Language :: Python :: 3.12",
 ]
 dependencies = [
-  'pyperclip; platform_system == "Darwin"',
-  'pyperclip; platform_system == "Windows"',
+  "pyperclip; platform_system=='Windows'",
 ]

If I switch them so Windows is first instead, it deletes the Windows one.

I guess it thinks they're duplicates, without considering the platform_system?

@gaborbernat
Copy link
Member

PR welcome 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants