Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ supported:
This defaults to `types-<distribution>` and should only be set in special
cases.
* `upstream-repository` (recommended): The URL of the upstream repository.
* `obsolete-since` (optional): This field is part of our process for
* `obsolete-since` (optional): This table is part of our process for
[removing obsolete third-party libraries](#third-party-library-removal-policy).
It contains the first version of the corresponding library that ships
its own `py.typed` file.
its own `py.typed` file, and the date when that version was released.
* `no-longer-updated` (optional): This field is set to `true` before removing
stubs for other reasons than the upstream library shipping with type
information.
Expand Down
16 changes: 9 additions & 7 deletions lib/ts_utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import tomlkit
from packaging.requirements import Requirement
from packaging.specifiers import Specifier
from tomlkit.items import String

from .paths import PYPROJECT_PATH, STUBS_PATH, distribution_path

Expand Down Expand Up @@ -299,12 +298,15 @@ def read_metadata(distribution: str) -> StubMetadata:
assert num_url_path_parts == 2, bad_github_url_msg

obsolete_since = data.get("obsolete-since")
assert isinstance(obsolete_since, (String, type(None)))
if obsolete_since:
comment = obsolete_since.trivia.comment
since_date_string = comment.removeprefix("# Released on ")
since_date = datetime.date.fromisoformat(since_date_string)
obsolete = ObsoleteMetadata(since_version=obsolete_since, since_date=since_date)
assert isinstance(obsolete_since, (dict, type(None)))
if obsolete_since is not None:
obsolete_table: dict[str, object] = obsolete_since
obsolete_since_version = obsolete_table.get("version")
obsolete_since_date = obsolete_table.get("date")
assert isinstance(obsolete_since_version, str)
assert isinstance(obsolete_since_date, str)
since_date = datetime.date.fromisoformat(obsolete_since_date)
obsolete = ObsoleteMetadata(since_version=obsolete_since_version, since_date=since_date)
else:
obsolete = None
no_longer_updated = data.get("no-longer-updated", False)
Expand Down
8 changes: 4 additions & 4 deletions scripts/stubsabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from dataclasses import dataclass, field
from http import HTTPStatus
from pathlib import Path
from typing import Annotated, Any, ClassVar, Literal, NamedTuple, TypedDict, TypeVar
from typing import Annotated, Any, ClassVar, Literal, NamedTuple, TypedDict, TypeVar, cast
from typing_extensions import Self, TypeAlias

if sys.version_info >= (3, 11):
Expand Down Expand Up @@ -906,9 +906,9 @@ async def suggest_typeshed_obsolete(obsolete: Obsolete, session: aiohttp.ClientS
async with _repo_lock:
branch_name = f"{BRANCH_PREFIX}/{normalize(obsolete.distribution)}"
subprocess.check_call(["git", "checkout", "-B", branch_name, "origin/main"])
obs_string = tomlkit.string(obsolete.obsolete_since_version)
obs_string.comment(f"Released on {obsolete.obsolete_since_date.date().isoformat()}")
update_metadata(obsolete.distribution, obsolete_since=obs_string)
obsolete_t = cast(dict[str, object], tomlkit.inline_table())
obsolete_t.update({"version": obsolete.obsolete_since_version, "date": obsolete.obsolete_since_date.date().isoformat()})
update_metadata(obsolete.distribution, obsolete_since=obsolete_t)
body = "\n".join(f"{k}: {v}" for k, v in obsolete.links.items())
subprocess.check_call(["git", "commit", "--all", "-m", f"{title}\n\n{body}"])
if action_level <= ActionLevel.local:
Expand Down
2 changes: 1 addition & 1 deletion stubs/binaryornot/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = "0.4.*"
upstream-repository = "https://github.com/binaryornot/binaryornot"
obsolete-since = "0.5.0" # Released on 2026-03-07
obsolete-since = { version = "0.5.0", date = "2026-03-07" }
2 changes: 1 addition & 1 deletion stubs/fpdf2/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = "2.8.4"
upstream-repository = "https://github.com/py-pdf/fpdf2"
dependencies = ["Pillow>=10.3.0"]
obsolete-since = "2.8.6" # Released on 2026-02-19
obsolete-since = { version = "2.8.6", date = "2026-02-19" }

[tool.stubtest]
stubtest-dependencies = ["cryptography"]
2 changes: 1 addition & 1 deletion stubs/icalendar/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = "6.3.2"
upstream-repository = "https://github.com/collective/icalendar"
dependencies = ["types-python-dateutil", "types-pytz"]
obsolete-since = "7.0.0" # Released on 2026-02-11
obsolete-since = { version = "7.0.0", date = "2026-02-11" }

[tool.stubtest]
stubtest-dependencies = ["pytz"]
Loading