From bb24e77404af84b0ff32020ad6c356c659bc6fe5 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Tue, 12 Oct 2021 12:30:45 +0200 Subject: [PATCH] Update remaining versions for third-party stubs (#6094) Also remove the python2 markers of packages that don't list Python 2 as supported in the latest version. Don't special case version '0.1' Co-authored-by: Akuli --- CONTRIBUTING.md | 20 +++++++++++--------- stubs/DateTimeRange/METADATA.toml | 3 +-- stubs/JACK-Client/METADATA.toml | 2 +- stubs/aiofiles/METADATA.toml | 2 +- stubs/contextvars/METADATA.toml | 2 +- stubs/dataclasses/METADATA.toml | 2 +- stubs/decorator/METADATA.toml | 3 +-- stubs/frozendict/METADATA.toml | 2 +- stubs/pyRFC3339/METADATA.toml | 2 +- stubs/pycurl/METADATA.toml | 3 +-- stubs/tzlocal/METADATA.toml | 3 +-- stubs/ujson/METADATA.toml | 3 +-- stubs/waitress/METADATA.toml | 2 +- tests/check_consistent.py | 3 ++- tests/stubtest_third_party.py | 5 +---- 15 files changed, 26 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 444f9d46a..6361195e1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,16 +95,18 @@ The metadata file describes the stubs package using the [TOML file format](https://toml.io/en/). Currently, the following keys are supported: -* `version`: The versions of the library that the stubs support. - For libraries that reflect API changes in the version number only - the parts indicating the API level should be specified, with an - asterisk representing the API-independent part. In the case - of [Semantic Versioning](https://semver.org/), this version could look - like this: `2.7.*`. When the stubs are updated to a newer version +* `version`: The versions of the library that the stubs support. Two + formats are supported: + - A concrete version. This is especially suited for libraries that + use [Calendar Versioning](https://calver.org/). + - A version range ending in `.*`. This is suited for libraries that + reflect API changes in the version number only, where the API-independent + part is represented by the asterisk. In the case + of [Semantic Versioning](https://semver.org/), this version could look + like this: `2.7.*`. + When the stubs are updated to a newer version of the library, the version of the stub should be bumped (note that - previous versions are still available on PyPI). Some legacy stubs are - marked with version `0.1`, indicating that their supported version is - unknown and needs to be updated. + previous versions are still available on PyPI). * `python2` (default: `false`): If set to `true`, the top-level stubs support both Python 2 and Python 3. * `requires` (optional): A list of other stub packages or packages with type diff --git a/stubs/DateTimeRange/METADATA.toml b/stubs/DateTimeRange/METADATA.toml index 1fbfc0a8e..f52202108 100644 --- a/stubs/DateTimeRange/METADATA.toml +++ b/stubs/DateTimeRange/METADATA.toml @@ -1,3 +1,2 @@ -version = "0.1" -python2 = true +version = "1.2.*" requires = ["types-python-dateutil"] diff --git a/stubs/JACK-Client/METADATA.toml b/stubs/JACK-Client/METADATA.toml index 5f1541084..1883b8701 100644 --- a/stubs/JACK-Client/METADATA.toml +++ b/stubs/JACK-Client/METADATA.toml @@ -1 +1 @@ -version = "0.1" +version = "0.5.*" diff --git a/stubs/aiofiles/METADATA.toml b/stubs/aiofiles/METADATA.toml index 40f3c61c1..6b8eeefb1 100644 --- a/stubs/aiofiles/METADATA.toml +++ b/stubs/aiofiles/METADATA.toml @@ -1,2 +1,2 @@ -version = "0.1" +version = "0.7.*" requires = [] diff --git a/stubs/contextvars/METADATA.toml b/stubs/contextvars/METADATA.toml index 5f1541084..ea07e8d31 100644 --- a/stubs/contextvars/METADATA.toml +++ b/stubs/contextvars/METADATA.toml @@ -1 +1 @@ -version = "0.1" +version = "2.4" diff --git a/stubs/dataclasses/METADATA.toml b/stubs/dataclasses/METADATA.toml index 5f1541084..22cbe4eb9 100644 --- a/stubs/dataclasses/METADATA.toml +++ b/stubs/dataclasses/METADATA.toml @@ -1 +1 @@ -version = "0.1" +version = "0.6" diff --git a/stubs/decorator/METADATA.toml b/stubs/decorator/METADATA.toml index 31f638bf3..2c151642b 100644 --- a/stubs/decorator/METADATA.toml +++ b/stubs/decorator/METADATA.toml @@ -1,2 +1 @@ -version = "0.1" -python2 = true +version = "5.1.*" diff --git a/stubs/frozendict/METADATA.toml b/stubs/frozendict/METADATA.toml index 5f1541084..58bc38349 100644 --- a/stubs/frozendict/METADATA.toml +++ b/stubs/frozendict/METADATA.toml @@ -1 +1 @@ -version = "0.1" +version = "2.0.*" diff --git a/stubs/pyRFC3339/METADATA.toml b/stubs/pyRFC3339/METADATA.toml index 5f1541084..bad265e4f 100644 --- a/stubs/pyRFC3339/METADATA.toml +++ b/stubs/pyRFC3339/METADATA.toml @@ -1 +1 @@ -version = "0.1" +version = "1.1" diff --git a/stubs/pycurl/METADATA.toml b/stubs/pycurl/METADATA.toml index 31f638bf3..fafbc9958 100644 --- a/stubs/pycurl/METADATA.toml +++ b/stubs/pycurl/METADATA.toml @@ -1,2 +1 @@ -version = "0.1" -python2 = true +version = "7.44.*" diff --git a/stubs/tzlocal/METADATA.toml b/stubs/tzlocal/METADATA.toml index 43a3246ae..309661e3e 100644 --- a/stubs/tzlocal/METADATA.toml +++ b/stubs/tzlocal/METADATA.toml @@ -1,3 +1,2 @@ -version = "0.1" -python2 = true +version = "3.0" requires = ["types-pytz"] diff --git a/stubs/ujson/METADATA.toml b/stubs/ujson/METADATA.toml index 31f638bf3..cb7498d03 100644 --- a/stubs/ujson/METADATA.toml +++ b/stubs/ujson/METADATA.toml @@ -1,2 +1 @@ -version = "0.1" -python2 = true +version = "4.2.*" diff --git a/stubs/waitress/METADATA.toml b/stubs/waitress/METADATA.toml index 40f3c61c1..a035bd0a0 100644 --- a/stubs/waitress/METADATA.toml +++ b/stubs/waitress/METADATA.toml @@ -1,2 +1,2 @@ -version = "0.1" +version = "2.0.*" requires = [] diff --git a/tests/check_consistent.py b/tests/check_consistent.py index c6f9ff514..2f7192bd8 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -169,7 +169,8 @@ def check_metadata(): assert "version" in data, f"Missing version for {distribution}" version = data["version"] msg = f"Unsupported Python version {version}" - assert re.match(r"^\d+(\.\d+)*(\.\*)?$", version), msg + assert isinstance(version, str), msg + assert re.fullmatch(r"\d+(\.\d+)+|\d+(\.\d+)*\.\*", version), msg for key in data: assert key in metadata_keys, f"Unexpected key {key} for {distribution}" assert isinstance(data.get("python2", False), bool), f"Invalid python2 value for {distribution}" diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index d975cef24..f054d2b8f 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -49,10 +49,7 @@ def run_stubtest(dist: Path) -> None: dist_version = metadata["version"] assert isinstance(dist_version, str) - if dist_version == "0.1": - dist_req = dist.name - else: - dist_req = f"{dist.name}=={dist_version}" + dist_req = f"{dist.name}=={dist_version}" # If @tests/requirements-stubtest.txt exists, run "pip install" on it. req_path = dist / "@tests" / "requirements-stubtest.txt"