Skip to content

Deletes second platform dependency #231

@hugovk

Description

@hugovk

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions