diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 444f9d46a3a5..6361195e1c83 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 1fbfc0a8e92d..f522021080f9 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 5f1541084942..1883b870198a 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 40f3c61c10ae..6b8eeefb1769 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 5f1541084942..ea07e8d318f6 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 5f1541084942..22cbe4eb9ca3 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 31f638bf33df..2c151642b36f 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 5f1541084942..58bc38349459 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 5f1541084942..bad265e4fe3f 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 31f638bf33df..fafbc99588cb 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 43a3246aeece..309661e3eeac 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 31f638bf33df..cb7498d03056 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 40f3c61c10ae..a035bd0a01ba 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 c6f9ff51425d..2f7192bd8b2b 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 d975cef24d6a..f054d2b8f920 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"