Repository: pypa/wheel

Issue:
Parens in metadata version specifiers
The [packaging spec](https://packaging.python.org/en/latest/specifications/core-metadata/#requires-dist-multiple-use) says that Requires-Dist specifiers should not have parens, but wheel add the parens [here](https://github.com/pypa/wheel/blob/main/src/wheel/metadata.py#L95).

I ran into this problem because of a super edge case installing a wheel that has exact identity (===) dependencies. Pip allows any character after an the identity specifier, which means that it also captures the closing paren and so a requirement like `requests (===1.2.3)` won't match. The identity specifiers are used for prereleases and some other special-case version specifiers.

Discussion:
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/pypa/wheel/pull/552?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pypa) Report
Patch coverage: **`100.00%`** and no project coverage change.
> Comparison is base [(`fbd385c`)](https://app.codecov.io/gh/pypa/wheel/commit/fbd385c4eceb6ad0f95a58af1b0996ad8be062da?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pypa) 69.79% compared to head [(`d29c8a6`)](https://app.codecov.io/gh/pypa/wheel/pull/552?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pypa) 69.79%.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #552   +/-   ##
=======================================
  Coverage   69.79%   69.79%           
=======================================
  Files          13       13           
  Lines        1076     1076           
=======================================
  Hits          751      751           
  Misses        325      325           
```


| [Files Changed](https://app.codecov.io/gh/pypa/wheel/pull/552?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pypa) | Coverage Δ | |
|---|---|---|
| [src/wheel/metadata.py](https://app.codecov.io/gh/pypa/wheel/pull/552?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pypa#diff-c3JjL3doZWVsL21ldGFkYXRhLnB5) | `92.22% <100.00%> (ø)` | |


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/pypa/wheel/pull/552?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pypa).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pypa).


Patch:
diff --git a/docs/news.rst b/docs/news.rst
index a76eb6c..df991f2 100644
--- a/docs/news.rst
+++ b/docs/news.rst
@@ -5,6 +5,7 @@ Release Notes
 
 - Fixed naming of the ``data_dir`` directory in the presence of local version segment
   given via ``egg_info.tag_build`` (PR by Anderson Bravalheri)
+- Fixed version specifiers in ``Requires-Dist`` being wrapped in parentheses
 
 **0.41.0 (2023-07-22)**
 
diff --git a/src/wheel/metadata.py b/src/wheel/metadata.py
index b391c96..ddcb90e 100644
--- a/src/wheel/metadata.py
+++ b/src/wheel/metadata.py
@@ -92,7 +92,7 @@ def requires_to_requires_dist(requirement: Requirement) -> str:
         requires_dist.append(spec.operator + spec.version)
 
     if requires_dist:
-        return " (" + ",".join(sorted(requires_dist)) + ")"
+        return " " + ",".join(sorted(requires_dist))
     else:
         return ""
 


Test patch:
diff --git a/tests/test_metadata.py b/tests/test_metadata.py
index e267f02..8480732 100644
--- a/tests/test_metadata.py
+++ b/tests/test_metadata.py
@@ -22,11 +22,11 @@ def test_pkginfo_to_metadata(tmp_path):
         ("Provides-Extra", "faster-signatures"),
         ("Requires-Dist", "ed25519ll ; extra == 'faster-signatures'"),
         ("Provides-Extra", "rest"),
-        ("Requires-Dist", "docutils (>=0.8) ; extra == 'rest'"),
+        ("Requires-Dist", "docutils >=0.8 ; extra == 'rest'"),
         ("Requires-Dist", "keyring ; extra == 'signatures'"),
         ("Requires-Dist", "keyrings.alt ; extra == 'signatures'"),
         ("Provides-Extra", "test"),
-        ("Requires-Dist", "pytest (>=3.0.0) ; extra == 'test'"),
+        ("Requires-Dist", "pytest >=3.0.0 ; extra == 'test'"),
         ("Requires-Dist", "pytest-cov ; extra == 'test'"),
     ]