From ec3240984d005941d646c69ea600a308451d811e Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 29 Nov 2026 11:31:41 -0600 Subject: [PATCH 1/3] typing(build[ty]) Check the whole project with ty 0.0.113 why: The type check should use the supported Python version for each CI job and include maintained Python tooling. what: - Pin ty and refresh its lock entry under a package-specific cooldown exception. - Check the repository from its root and select the target interpreter version in CI. --- .github/workflows/tests.yml | 12 +++++----- pyproject.toml | 12 +++------- uv.lock | 47 +++++++++++++++++++------------------ 3 files changed, 33 insertions(+), 38 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8f86102a..b0ef49c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,8 +33,8 @@ jobs: run: uv run ruff check . - name: Format check (ruff format) run: uv run ruff format --check . - - name: Type check (ty) - run: uv run ty check --output-format github + - name: Check types with ty + run: uv run ty check --python-version ${{ matrix.python-version }} --output-format github - name: Tests (pytest) if: matrix.python-version != '3.14' run: uv run pytest -m "" @@ -61,8 +61,8 @@ jobs: python-version: "3.14" - name: Install dependencies run: uv sync --all-groups - - name: Type check (ty) - run: uv run ty check --output-format github + - name: Check types with ty + run: uv run ty check --python-version 3.14 --output-format github - name: Tests (pytest + POSIX PTY) run: uv run pytest -m "" @@ -82,8 +82,8 @@ jobs: python-version: "3.14" - name: Install dependencies run: uv sync --all-groups - - name: Type check (ty) - run: uv run ty check --output-format github + - name: Check types with ty + run: uv run ty check --python-version 3.14 --output-format github - name: Tests (portable core + stream) run: uv run pytest -m "" diff --git a/pyproject.toml b/pyproject.toml index 63dc9e7e..4e4244c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ dev = [ "pytest-cov", # Lint / typecheck "ruff>=0.17.3", - "ty>=0.0.58", + "ty==0.0.113", # Benchmark harness "click>=8.1", "pydantic>=2.12", @@ -85,7 +85,7 @@ coverage = [ ] lint = [ "ruff>=0.17.3", - "ty>=0.0.58", + "ty==0.0.113", ] [build-system] @@ -115,6 +115,7 @@ include = [ python-preference = "system" [tool.uv.exclude-newer-package] +ty = false gp-furo-theme = false gp-libs = false gp-sphinx = false @@ -141,13 +142,6 @@ python-version = "3.12" [tool.ty.rules] blanket-ignore-comment = "error" -[tool.ty.src] -include = [ - "scripts", - "src", - "tests", -] - [tool.ty.terminal] error-on-warning = true diff --git a/uv.lock b/uv.lock index f82b2389..81117502 100644 --- a/uv.lock +++ b/uv.lock @@ -26,6 +26,7 @@ sphinx-gp-sitemap = false sphinx-gp-theme = false sphinx-ux-autodoc-layout = false sphinx-ux-badges = false +ty = false [[package]] name = "accessible-pygments" @@ -564,7 +565,7 @@ dev = [ { name = "sphinx-autobuild" }, { name = "sphinx-autodoc-api-style", specifier = "==0.1.0a39" }, { name = "sphinx-autodoc-pytest-fixtures", specifier = "==0.1.0a39" }, - { name = "ty", specifier = ">=0.0.58" }, + { name = "ty", specifier = "==0.0.113" }, { name = "typer", specifier = ">=0.12" }, ] docs = [ @@ -575,7 +576,7 @@ docs = [ ] lint = [ { name = "ruff", specifier = ">=0.17.3" }, - { name = "ty", specifier = ">=0.0.58" }, + { name = "ty", specifier = "==0.0.113" }, ] testing = [ { name = "gp-libs", specifier = ">=0.0.19" }, @@ -1456,27 +1457,27 @@ wheels = [ [[package]] name = "ty" -version = "0.0.110" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/07/df/d914a453dfe6c92c6ce4fb3c5507f0ba71aabea1d437708e109642f8c75a/ty-0.0.110.tar.gz", hash = "sha256:0339d980a2ac78f356737260817ed9d11304a7a091fef57e9bcece1f00779742", size = 8443384, upload-time = "2026-11-25T06:11:12.98Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3e/3c/f09ce75dc95424abf29fb3718ed618271920141f0d8463f7f82d7ebe6a0f/ty-0.0.110-py3-none-linux_armv6l.whl", hash = "sha256:7172cd2b03f6d20083ed17121531f9b532ffd77144b82b743a5db7a753659c6c", size = 15393937, upload-time = "2026-11-25T06:10:19.442Z" }, - { url = "https://files.pythonhosted.org/packages/c8/f7/09c39f9f4980c151cec2d9dad06a75f0ba424e138fdaf832534bbbf2fc0f/ty-0.0.110-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:2474928cd2c841bf5cd570a9ada996b9156f6c565eee66a13a5ce2d9531614ce", size = 14939399, upload-time = "2026-11-25T06:10:23.3Z" }, - { url = "https://files.pythonhosted.org/packages/23/95/b84c935e84b7a9adb8b431e58b08bb991a430b5bde7f76b1d012aa1999ce/ty-0.0.110-py3-none-macosx_11_0_arm64.whl", hash = "sha256:92039667989c98e44c10f2400553daf767c3f11eb34f81a3ecc152bec2acd812", size = 14388649, upload-time = "2026-11-25T06:10:25.963Z" }, - { url = "https://files.pythonhosted.org/packages/c8/3d/102c0b9e04613bebd19c1f21896b331b1e9c605d4d73571f188cc0bffd5d/ty-0.0.110-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3972f28202a1baff1c4a325aa55cf52fac5f47774f720812d100c502603b8c10", size = 15234109, upload-time = "2026-11-25T06:10:29.372Z" }, - { url = "https://files.pythonhosted.org/packages/2d/fc/850658976caf9536b3c69bbdfd61979a68a1c7d24adc2319a90cfc39815d/ty-0.0.110-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a6fc2ae3df1e84be4bb3501fb2f119c792746f306e3436d97d74793442ba094e", size = 15123994, upload-time = "2026-11-25T06:10:32.293Z" }, - { url = "https://files.pythonhosted.org/packages/a6/2c/3b7433acf00d833247c10a91b42f3fcc2a3d9c7e91ac6773492b7d9732f3/ty-0.0.110-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:744e320b0f2aabe2331796c46bd9a44854ebeade1fdfc4b18f0f42def43e37c1", size = 16087143, upload-time = "2026-11-25T06:10:36.056Z" }, - { url = "https://files.pythonhosted.org/packages/fe/ef/1bd0cf0072ebe440043bffc1df22119bd80cfb78ed891be34015960d5b8f/ty-0.0.110-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fc192b6bf87d44a4c810252461e047a7a52461544460c6ca6a2f4fa8ab230802", size = 16597625, upload-time = "2026-11-25T06:10:39.65Z" }, - { url = "https://files.pythonhosted.org/packages/c5/3e/097b94eb0b3e3179a52d6f9fc57d766db5aaff0a7450f511b4734a369f92/ty-0.0.110-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7346ccda9da07355b5834217d09a7962f05be7b3a8b71a8f10d8c9cd160fe081", size = 16379894, upload-time = "2026-11-25T06:10:43.602Z" }, - { url = "https://files.pythonhosted.org/packages/55/0d/dda9df961eb277469cbf2b3193bd1dd3905f35324ab15de44657c4eb107a/ty-0.0.110-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:277816213c272c999080e174f6a319692e77b45848c9b9998dc763dc5961ee18", size = 17934544, upload-time = "2026-11-25T06:10:46.733Z" }, - { url = "https://files.pythonhosted.org/packages/b1/4e/4d733d9932319da3f24a763868fab815feda79996ee6bd9c60292d4f453c/ty-0.0.110-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:ece489528dc6c07786feb9d8247f6271d898827cc13dc6b6c71788097484218f", size = 15993734, upload-time = "2026-11-25T06:10:49.589Z" }, - { url = "https://files.pythonhosted.org/packages/c4/b3/31996d6f872ebd62ab0ed36813c2fd605e8b0a01a4bde7ba1b362d9eb9de/ty-0.0.110-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d01c5e930d41df63ace0952eb8b054d4225bea73a8be680e7e720bfe90936350", size = 14738953, upload-time = "2026-11-25T06:10:52.541Z" }, - { url = "https://files.pythonhosted.org/packages/8b/31/e0fd4c9028932233f8af3b1244e1dcb1c494d9a18ef67e33059b951d1350/ty-0.0.110-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:040cec2b465a97653d9f6f286445d4a862fecf57c3a4ef2e09d62384d79c0423", size = 15128783, upload-time = "2026-11-25T06:10:55.573Z" }, - { url = "https://files.pythonhosted.org/packages/29/79/4f488b6751cc8e96181dc88fc769121aa2f096a4b5482613d7dba4cee51d/ty-0.0.110-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9cbc0bc41bc8861e5359980ba28653bba269c7e85ec79e8451c0b21d7d8c7511", size = 15455555, upload-time = "2026-11-25T06:10:58.442Z" }, - { url = "https://files.pythonhosted.org/packages/bc/e0/6576c3805b2c6adefb556565098e6213b42aab0d0c71bdcf47e2cfa6e62b/ty-0.0.110-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:8d092b73fb004952980f18c79bb1e545c78ad8e7fa1dbaa8e7f5a4b58ba61d4b", size = 15808820, upload-time = "2026-11-25T06:11:01.224Z" }, - { url = "https://files.pythonhosted.org/packages/de/76/890a35df4ab5e70b9ae2adc2f9dd9958559d13e710f83b1db3dc7c539503/ty-0.0.110-py3-none-win32.whl", hash = "sha256:aa68bc7b5851a1917e9e98ec824165d16b9f0bfdf2606e3b1f595398cca82e7d", size = 14303296, upload-time = "2026-11-25T06:11:03.91Z" }, - { url = "https://files.pythonhosted.org/packages/46/ae/ba6f56c5ec826822a5fe4dbe7906df6f7d81cea8b99c74632872b198d823/ty-0.0.110-py3-none-win_amd64.whl", hash = "sha256:1e3ddceac69166d4c5caa546c3785339fd0fd0184faa240a4e28225fdf8b25de", size = 15240567, upload-time = "2026-11-25T06:11:06.785Z" }, - { url = "https://files.pythonhosted.org/packages/3c/3c/59aa32ac6ff60c83f4963b9f92595efb81dbf9c5a87262d940b6df762108/ty-0.0.110-py3-none-win_arm64.whl", hash = "sha256:7ba53d4c6f497ef68d686e97e8f8991fd43b8d53043487bef887cee0da6e6e76", size = 14388015, upload-time = "2026-11-25T06:11:09.828Z" }, +version = "0.0.113" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d2/4b/7138e0209e6fe108391f05438629db277694ae855ce06e38af139a24bb1f/ty-0.0.113.tar.gz", hash = "sha256:d751c2314a497ff506947908e218a0adbdcb3c560e2783dcd7458660a88d3261", size = 8470296, upload-time = "2026-11-29T02:34:32.062Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7e/a7/e39420a5374108e4d22b18d8ef47cd3b2b11e8c8bdd835ce78b6911bf860/ty-0.0.113-py3-none-linux_armv6l.whl", hash = "sha256:51329027041bc71b8a4308048909775404b6fc49ab257f5fc56f1251d0252615", size = 15566174, upload-time = "2026-11-29T02:33:45.96Z" }, + { url = "https://files.pythonhosted.org/packages/75/e3/728392a39edd84a73e83ca95cb80a368395f6adfffbdc2bfc76de1a9223f/ty-0.0.113-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:bd6d0faac3c0fa9f5e711f497a7cf448e4f5f189c77638327123ed7469afb446", size = 15075921, upload-time = "2026-11-29T02:33:49.133Z" }, + { url = "https://files.pythonhosted.org/packages/9e/5d/eb84feaf16a5c9d4bcab34eedf107b6ecb9a746ce759e67b244bfbe3afd5/ty-0.0.113-py3-none-macosx_11_0_arm64.whl", hash = "sha256:a617ba0012b21c2984680bcb596f8c78bdc07fb922f811fe2ba0d29169f53581", size = 14594072, upload-time = "2026-11-29T02:33:51.661Z" }, + { url = "https://files.pythonhosted.org/packages/89/87/40de569367a5aaff373d2e5657cd5d1cd0ae9fe90982fd26a900f7122a61/ty-0.0.113-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:48f376e42b5f7b824b4dd8aa421ef91f009b695689625054385280683bb8b19d", size = 15609691, upload-time = "2026-11-29T02:33:54.329Z" }, + { url = "https://files.pythonhosted.org/packages/ff/42/77677c00cabb09c2a122877bc754b94128434bd0461591b3a20c8b3bda67/ty-0.0.113-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4c0e21df96effa906892ea682c28d5bdb784813584b35736f34fb13022ed6c2c", size = 15287631, upload-time = "2026-11-29T02:33:56.917Z" }, + { url = "https://files.pythonhosted.org/packages/e6/01/b4283becd51b637627858faffe80907c054635958806fdfcaf6bd7efb63c/ty-0.0.113-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c67d33ddaec99fb2b01d50725c0ba8f45ea4a2f1ab8b1bd8d72a1cffde4d9166", size = 16281475, upload-time = "2026-11-29T02:33:59.399Z" }, + { url = "https://files.pythonhosted.org/packages/74/3e/4221eafd1cb4f3ef4ce80249d32c5d062e150c4bba0ddb16d2b52eabead0/ty-0.0.113-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c1ac300512ab772c0f9da24f1ac11caa3f961b5b7741f920885ec0c6e6ededca", size = 16735678, upload-time = "2026-11-29T02:34:02.521Z" }, + { url = "https://files.pythonhosted.org/packages/6c/f5/cb4e5a22e830f225e892efe2435799b6128d6c62212e27389feb5b6d2498/ty-0.0.113-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dd6c055511c79d34c720fc03da96c62567a7c866d522ad6aa51357b0bf840f9e", size = 16568976, upload-time = "2026-11-29T02:34:05.122Z" }, + { url = "https://files.pythonhosted.org/packages/e9/7c/ae864be853865350447161808015f6d04e3c8c9f7831fbb64f56a99ec470/ty-0.0.113-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:edf0ff45b103999528ade08e30d9149ef901e1d8f413cc61a1681470c02bc5f2", size = 17319920, upload-time = "2026-11-29T02:34:07.973Z" }, + { url = "https://files.pythonhosted.org/packages/85/92/4a16e1e23210e8e7a6d77d025a505811fec4394de25917c588fe0acd2f63/ty-0.0.113-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:c2f03b32bcde1d3f888082503226f7046cee179f002d84a43d802c43acc64f1c", size = 16145916, upload-time = "2026-11-29T02:34:10.796Z" }, + { url = "https://files.pythonhosted.org/packages/99/38/cd64145da4a8b47e3c3b92cd2d6e2a3909848c053094a6b71376792d7d83/ty-0.0.113-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:445319275f80edcf02a638e7701f715d44731f0c247753dc800cda97c50c30ef", size = 14953053, upload-time = "2026-11-29T02:34:13.318Z" }, + { url = "https://files.pythonhosted.org/packages/78/cf/eff9e15b8a96d1beb4487624eaa9fe192f63585858f89b73d8383f9d62b8/ty-0.0.113-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:62e06dfadb5fd43d57b64e6401731c97005562f321b592cfab1587658999a7ed", size = 15296406, upload-time = "2026-11-29T02:34:16.143Z" }, + { url = "https://files.pythonhosted.org/packages/f3/ea/952ccd2250c06475e6e6563936c98196d74b16220105e4e5cfd3d477abf2/ty-0.0.113-py3-none-musllinux_1_2_i686.whl", hash = "sha256:238aee2c3bde34d12b0753800d0836de16b93f8e0694cec2ba29cc3faed325aa", size = 15640130, upload-time = "2026-11-29T02:34:18.861Z" }, + { url = "https://files.pythonhosted.org/packages/ef/38/0b13a7199197866c16a180f9b6843829d4876d1ef277561a728bb79c758d/ty-0.0.113-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:8a8f2b7f015651d6d1e8100cd3b0bbf7004ffeb4355cb9724e0af44fd40f29c3", size = 15944137, upload-time = "2026-11-29T02:34:21.32Z" }, + { url = "https://files.pythonhosted.org/packages/c7/c9/fab860478f952d6261714fc5be843874a83343b4d5eeb9f651cebb10e1be/ty-0.0.113-py3-none-win32.whl", hash = "sha256:37eafc0cdb484a127e3902ba660e77756d0162b2799ef17d0c9ffdd5c00f8463", size = 14472935, upload-time = "2026-11-29T02:34:24.048Z" }, + { url = "https://files.pythonhosted.org/packages/c1/fa/cd0c051183c4586b350d65ef53d4f761ecde2a8380e48824fd9e65e57b80/ty-0.0.113-py3-none-win_amd64.whl", hash = "sha256:3826ca83e71ef66d94cdc8bc6df8392a38cf2da83be9dcedcf3f3040023dc9cd", size = 15273590, upload-time = "2026-11-29T02:34:26.734Z" }, + { url = "https://files.pythonhosted.org/packages/b6/1c/1bbcc9b44176d56f291e1bc5346f84ff39faf96365d9fbd9799af90bbf23/ty-0.0.113-py3-none-win_arm64.whl", hash = "sha256:aa75bbb54eecf55f6190ff3a1054d9a977d5e04ed597ea11184521ed138e4bb9", size = 14589176, upload-time = "2026-11-29T02:34:29.219Z" }, ] [[package]] From 15ae002d9b74fb4271deb9535b08ef8a5a143733 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 29 Nov 2026 13:12:41 -0600 Subject: [PATCH 2/3] docs(typing) Define when Python inputs may have open types why: Contributors need a consistent way to resolve typing ambiguities while preserving the contract callers rely on. what: - Describe the limited uses of object and Any at input boundaries. - Check precise signatures against supported callers, misuse and downstream inference. --- AGENTS.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index b8b32c4d..1f0b4580 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -65,6 +65,23 @@ Python >= 3.12 is the compatibility floor, and runtime dependencies stay empty (`dependencies = []`). Importing `libvt` performs no I/O and does not load `asyncio`, `pty`, or `pytest`. +## Python typing + +Give callers the most precise signature that covers supported behavior. Use +`object` for a parameter only when every value is valid or when the function +accepts unknown input for validation. Narrow unknown values before using them. +Reserve `Any` for an inherently dynamic interface where Python cannot express +the input contract. Explain the reason there and keep unchecked values out of +the rest of the API. + +Before weakening a type, inspect real callers and try a precise alternative. +A union can describe known alternatives, a protocol can name the operations a +caller must provide, and a type parameter can preserve the relationship between +an input and its result. Try both a supported call and a plausible misuse with +ty. Check what downstream callers infer, whether the error is understandable, +and whether existing valid calls still work. Never widen a type, cast a value, +or suppress a diagnostic solely to make the checker pass. + ## References - Repository: https://github.com/tmux-python/libvt From 55fa34799a7e9b56d55b47814aecf6a8fa2744fb Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 29 Nov 2026 12:15:33 -0600 Subject: [PATCH 3/3] CHANGES(docs) Record the type-checking changes (#70) why: Contributors need the supported checker and its scope in the release notes. what: - Summarize the migration and link its pull request. --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index f4e2ff0b..3b4833c1 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,8 @@ _Notes on the upcoming release will go here._ +CI runs ty on the terminal package, test suite and development scripts at the supported Python targets. ([#70](https://github.com/tmux-python/libvt/pull/70)) + ## libvt 0.0.1a3 (2026-11-29) `libvt` 0.0.1a3 adds mode-40-gated `80`/`132`-column switching