From 5dcf83f5bf4ebcb16775fa8c0503434a1a16e5f9 Mon Sep 17 00:00:00 2001 From: Lou Kratz <219901029+loukratz-bv@users.noreply.github.com> Date: Tue, 6 Jan 2026 13:14:58 -0500 Subject: [PATCH 1/3] Add ty support --- .pre-commit-config.yaml | 13 +++++--- pyproject.toml | 15 +++------ uv.lock | 74 +++++++++++++++-------------------------- 3 files changed, 40 insertions(+), 62 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d478fbda..e0872d10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,8 +22,11 @@ repos: files: ^ui/.*\.(ts|tsx|js|jsx)$ pass_filenames: false - # - repo: https://github.com/pre-commit/mirrors-mypy - # rev: v1.17.1 - # hooks: - # - id: mypy - # additional_dependencies: [types-PyYAML, pydantic>=2.11.5] \ No newline at end of file + - repo: local + hooks: + - id: ty + name: ty check + entry: ty check kissml --ignore unresolved-import + language: python + pass_filenames: false + files: ^kissml/.*\.py$ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 2b80e96a..3cd0b7ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,7 +72,6 @@ dev = [ "mkdocs>=1.6.1", "mkdocstrings-python>=1.16.12", "mkdocstrings>=0.30.0", - "mypy>=1.8.0", "networkx>=3.4.2", "pandas-stubs>=2.3.2.250827", "pkginfo>=1.12.1.2", @@ -86,6 +85,7 @@ dev = [ "types-networkx>=3.5.0.20250901", "types-PyYAML>=6.0.2", "types-requests>=2.32.4.20250809", + "ty>=0.0.8", ] docs = [ "mkdocs>=1.5.0", @@ -134,7 +134,7 @@ force_grid_wrap = 0 use_parentheses = true ensure_newline_before_comments = true -[tool.mypy] +[tool.ty] python_version = "3.10" warn_return_any = true warn_unused_configs = true @@ -142,18 +142,13 @@ disallow_untyped_defs = true explicit_package_bases = true plugins = ["pydantic.mypy"] -[[tool.mypy.overrides]] +[[tool.ty.overrides]] module = "tests.*" disallow_untyped_defs = false -[[tool.mypy.overrides]] +[[tool.ty.overrides]] module = "qtype.semantic.model" -ignore_errors = true - -[tool.pydantic-mypy] -init_forbid_extra = true -init_typed = true -warn_required_dynamic_aliases = true +warn_return_any = false [tool.coverage.run] source = ["qtype"] diff --git a/uv.lock b/uv.lock index f6d0f336..efc6c666 100644 --- a/uv.lock +++ b/uv.lock @@ -3451,51 +3451,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6c/28/dd72947e59a6a8c856448a5e74da6201cb5502ddff644fbc790e4bd40b9a/multiprocess-0.70.18-py39-none-any.whl", hash = "sha256:e78ca805a72b1b810c690b6b4cc32579eba34f403094bbbae962b7b5bf9dfcb8", size = 133478, upload-time = "2025-04-17T03:11:26.253Z" }, ] -[[package]] -name = "mypy" -version = "1.18.2" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "mypy-extensions" }, - { name = "pathspec" }, - { name = "tomli", marker = "python_full_version < '3.11'" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/c0/77/8f0d0001ffad290cef2f7f216f96c814866248a0b92a722365ed54648e7e/mypy-1.18.2.tar.gz", hash = "sha256:06a398102a5f203d7477b2923dda3634c36727fa5c237d8f859ef90c42a9924b", size = 3448846, upload-time = "2025-09-19T00:11:10.519Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/03/6f/657961a0743cff32e6c0611b63ff1c1970a0b482ace35b069203bf705187/mypy-1.18.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c1eab0cf6294dafe397c261a75f96dc2c31bffe3b944faa24db5def4e2b0f77c", size = 12807973, upload-time = "2025-09-19T00:10:35.282Z" }, - { url = "https://files.pythonhosted.org/packages/10/e9/420822d4f661f13ca8900f5fa239b40ee3be8b62b32f3357df9a3045a08b/mypy-1.18.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:7a780ca61fc239e4865968ebc5240bb3bf610ef59ac398de9a7421b54e4a207e", size = 11896527, upload-time = "2025-09-19T00:10:55.791Z" }, - { url = "https://files.pythonhosted.org/packages/aa/73/a05b2bbaa7005f4642fcfe40fb73f2b4fb6bb44229bd585b5878e9a87ef8/mypy-1.18.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:448acd386266989ef11662ce3c8011fd2a7b632e0ec7d61a98edd8e27472225b", size = 12507004, upload-time = "2025-09-19T00:11:05.411Z" }, - { url = "https://files.pythonhosted.org/packages/4f/01/f6e4b9f0d031c11ccbd6f17da26564f3a0f3c4155af344006434b0a05a9d/mypy-1.18.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f9e171c465ad3901dc652643ee4bffa8e9fef4d7d0eece23b428908c77a76a66", size = 13245947, upload-time = "2025-09-19T00:10:46.923Z" }, - { url = "https://files.pythonhosted.org/packages/d7/97/19727e7499bfa1ae0773d06afd30ac66a58ed7437d940c70548634b24185/mypy-1.18.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:592ec214750bc00741af1f80cbf96b5013d81486b7bb24cb052382c19e40b428", size = 13499217, upload-time = "2025-09-19T00:09:39.472Z" }, - { url = "https://files.pythonhosted.org/packages/9f/4f/90dc8c15c1441bf31cf0f9918bb077e452618708199e530f4cbd5cede6ff/mypy-1.18.2-cp310-cp310-win_amd64.whl", hash = "sha256:7fb95f97199ea11769ebe3638c29b550b5221e997c63b14ef93d2e971606ebed", size = 9766753, upload-time = "2025-09-19T00:10:49.161Z" }, - { url = "https://files.pythonhosted.org/packages/88/87/cafd3ae563f88f94eec33f35ff722d043e09832ea8530ef149ec1efbaf08/mypy-1.18.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:807d9315ab9d464125aa9fcf6d84fde6e1dc67da0b6f80e7405506b8ac72bc7f", size = 12731198, upload-time = "2025-09-19T00:09:44.857Z" }, - { url = "https://files.pythonhosted.org/packages/0f/e0/1e96c3d4266a06d4b0197ace5356d67d937d8358e2ee3ffac71faa843724/mypy-1.18.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:776bb00de1778caf4db739c6e83919c1d85a448f71979b6a0edd774ea8399341", size = 11817879, upload-time = "2025-09-19T00:09:47.131Z" }, - { url = "https://files.pythonhosted.org/packages/72/ef/0c9ba89eb03453e76bdac5a78b08260a848c7bfc5d6603634774d9cd9525/mypy-1.18.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1379451880512ffce14505493bd9fe469e0697543717298242574882cf8cdb8d", size = 12427292, upload-time = "2025-09-19T00:10:22.472Z" }, - { url = "https://files.pythonhosted.org/packages/1a/52/ec4a061dd599eb8179d5411d99775bec2a20542505988f40fc2fee781068/mypy-1.18.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1331eb7fd110d60c24999893320967594ff84c38ac6d19e0a76c5fd809a84c86", size = 13163750, upload-time = "2025-09-19T00:09:51.472Z" }, - { url = "https://files.pythonhosted.org/packages/c4/5f/2cf2ceb3b36372d51568f2208c021870fe7834cf3186b653ac6446511839/mypy-1.18.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3ca30b50a51e7ba93b00422e486cbb124f1c56a535e20eff7b2d6ab72b3b2e37", size = 13351827, upload-time = "2025-09-19T00:09:58.311Z" }, - { url = "https://files.pythonhosted.org/packages/c8/7d/2697b930179e7277529eaaec1513f8de622818696857f689e4a5432e5e27/mypy-1.18.2-cp311-cp311-win_amd64.whl", hash = "sha256:664dc726e67fa54e14536f6e1224bcfce1d9e5ac02426d2326e2bb4e081d1ce8", size = 9757983, upload-time = "2025-09-19T00:10:09.071Z" }, - { url = "https://files.pythonhosted.org/packages/07/06/dfdd2bc60c66611dd8335f463818514733bc763e4760dee289dcc33df709/mypy-1.18.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:33eca32dd124b29400c31d7cf784e795b050ace0e1f91b8dc035672725617e34", size = 12908273, upload-time = "2025-09-19T00:10:58.321Z" }, - { url = "https://files.pythonhosted.org/packages/81/14/6a9de6d13a122d5608e1a04130724caf9170333ac5a924e10f670687d3eb/mypy-1.18.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a3c47adf30d65e89b2dcd2fa32f3aeb5e94ca970d2c15fcb25e297871c8e4764", size = 11920910, upload-time = "2025-09-19T00:10:20.043Z" }, - { url = "https://files.pythonhosted.org/packages/5f/a9/b29de53e42f18e8cc547e38daa9dfa132ffdc64f7250e353f5c8cdd44bee/mypy-1.18.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d6c838e831a062f5f29d11c9057c6009f60cb294fea33a98422688181fe2893", size = 12465585, upload-time = "2025-09-19T00:10:33.005Z" }, - { url = "https://files.pythonhosted.org/packages/77/ae/6c3d2c7c61ff21f2bee938c917616c92ebf852f015fb55917fd6e2811db2/mypy-1.18.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:01199871b6110a2ce984bde85acd481232d17413868c9807e95c1b0739a58914", size = 13348562, upload-time = "2025-09-19T00:10:11.51Z" }, - { url = "https://files.pythonhosted.org/packages/4d/31/aec68ab3b4aebdf8f36d191b0685d99faa899ab990753ca0fee60fb99511/mypy-1.18.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a2afc0fa0b0e91b4599ddfe0f91e2c26c2b5a5ab263737e998d6817874c5f7c8", size = 13533296, upload-time = "2025-09-19T00:10:06.568Z" }, - { url = "https://files.pythonhosted.org/packages/9f/83/abcb3ad9478fca3ebeb6a5358bb0b22c95ea42b43b7789c7fb1297ca44f4/mypy-1.18.2-cp312-cp312-win_amd64.whl", hash = "sha256:d8068d0afe682c7c4897c0f7ce84ea77f6de953262b12d07038f4d296d547074", size = 9828828, upload-time = "2025-09-19T00:10:28.203Z" }, - { url = "https://files.pythonhosted.org/packages/5f/04/7f462e6fbba87a72bc8097b93f6842499c428a6ff0c81dd46948d175afe8/mypy-1.18.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:07b8b0f580ca6d289e69209ec9d3911b4a26e5abfde32228a288eb79df129fcc", size = 12898728, upload-time = "2025-09-19T00:10:01.33Z" }, - { url = "https://files.pythonhosted.org/packages/99/5b/61ed4efb64f1871b41fd0b82d29a64640f3516078f6c7905b68ab1ad8b13/mypy-1.18.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:ed4482847168439651d3feee5833ccedbf6657e964572706a2adb1f7fa4dfe2e", size = 11910758, upload-time = "2025-09-19T00:10:42.607Z" }, - { url = "https://files.pythonhosted.org/packages/3c/46/d297d4b683cc89a6e4108c4250a6a6b717f5fa96e1a30a7944a6da44da35/mypy-1.18.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c3ad2afadd1e9fea5cf99a45a822346971ede8685cc581ed9cd4d42eaf940986", size = 12475342, upload-time = "2025-09-19T00:11:00.371Z" }, - { url = "https://files.pythonhosted.org/packages/83/45/4798f4d00df13eae3bfdf726c9244bcb495ab5bd588c0eed93a2f2dd67f3/mypy-1.18.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a431a6f1ef14cf8c144c6b14793a23ec4eae3db28277c358136e79d7d062f62d", size = 13338709, upload-time = "2025-09-19T00:11:03.358Z" }, - { url = "https://files.pythonhosted.org/packages/d7/09/479f7358d9625172521a87a9271ddd2441e1dab16a09708f056e97007207/mypy-1.18.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:7ab28cc197f1dd77a67e1c6f35cd1f8e8b73ed2217e4fc005f9e6a504e46e7ba", size = 13529806, upload-time = "2025-09-19T00:10:26.073Z" }, - { url = "https://files.pythonhosted.org/packages/71/cf/ac0f2c7e9d0ea3c75cd99dff7aec1c9df4a1376537cb90e4c882267ee7e9/mypy-1.18.2-cp313-cp313-win_amd64.whl", hash = "sha256:0e2785a84b34a72ba55fb5daf079a1003a34c05b22238da94fcae2bbe46f3544", size = 9833262, upload-time = "2025-09-19T00:10:40.035Z" }, - { url = "https://files.pythonhosted.org/packages/5a/0c/7d5300883da16f0063ae53996358758b2a2df2a09c72a5061fa79a1f5006/mypy-1.18.2-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:62f0e1e988ad41c2a110edde6c398383a889d95b36b3e60bcf155f5164c4fdce", size = 12893775, upload-time = "2025-09-19T00:10:03.814Z" }, - { url = "https://files.pythonhosted.org/packages/50/df/2cffbf25737bdb236f60c973edf62e3e7b4ee1c25b6878629e88e2cde967/mypy-1.18.2-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:8795a039bab805ff0c1dfdb8cd3344642c2b99b8e439d057aba30850b8d3423d", size = 11936852, upload-time = "2025-09-19T00:10:51.631Z" }, - { url = "https://files.pythonhosted.org/packages/be/50/34059de13dd269227fb4a03be1faee6e2a4b04a2051c82ac0a0b5a773c9a/mypy-1.18.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6ca1e64b24a700ab5ce10133f7ccd956a04715463d30498e64ea8715236f9c9c", size = 12480242, upload-time = "2025-09-19T00:11:07.955Z" }, - { url = "https://files.pythonhosted.org/packages/5b/11/040983fad5132d85914c874a2836252bbc57832065548885b5bb5b0d4359/mypy-1.18.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d924eef3795cc89fecf6bedc6ed32b33ac13e8321344f6ddbf8ee89f706c05cb", size = 13326683, upload-time = "2025-09-19T00:09:55.572Z" }, - { url = "https://files.pythonhosted.org/packages/e9/ba/89b2901dd77414dd7a8c8729985832a5735053be15b744c18e4586e506ef/mypy-1.18.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:20c02215a080e3a2be3aa50506c67242df1c151eaba0dcbc1e4e557922a26075", size = 13514749, upload-time = "2025-09-19T00:10:44.827Z" }, - { url = "https://files.pythonhosted.org/packages/25/bc/cc98767cffd6b2928ba680f3e5bc969c4152bf7c2d83f92f5a504b92b0eb/mypy-1.18.2-cp314-cp314-win_amd64.whl", hash = "sha256:749b5f83198f1ca64345603118a6f01a4e99ad4bf9d103ddc5a3200cc4614adf", size = 9982959, upload-time = "2025-09-19T00:10:37.344Z" }, - { url = "https://files.pythonhosted.org/packages/87/e3/be76d87158ebafa0309946c4a73831974d4d6ab4f4ef40c3b53a385a66fd/mypy-1.18.2-py3-none-any.whl", hash = "sha256:22a1748707dd62b58d2ae53562ffc4d7f8bcc727e8ac7cbc69c053ddc874d47e", size = 2352367, upload-time = "2025-09-19T00:10:15.489Z" }, -] - [[package]] name = "mypy-extensions" version = "1.1.0" @@ -5647,7 +5602,6 @@ dev = [ { name = "mkdocs-material" }, { name = "mkdocstrings" }, { name = "mkdocstrings-python" }, - { name = "mypy" }, { name = "networkx", version = "3.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "networkx", version = "3.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "pandas-stubs" }, @@ -5658,6 +5612,7 @@ dev = [ { name = "pytest-asyncio" }, { name = "pytest-cov" }, { name = "ruff" }, + { name = "ty" }, { name = "types-cachetools" }, { name = "types-networkx" }, { name = "types-pyyaml" }, @@ -5728,7 +5683,6 @@ dev = [ { name = "mkdocs-material", specifier = ">=9.6.15" }, { name = "mkdocstrings", specifier = ">=0.30.0" }, { name = "mkdocstrings-python", specifier = ">=1.16.12" }, - { name = "mypy", specifier = ">=1.8.0" }, { name = "networkx", specifier = ">=3.4.2" }, { name = "pandas-stubs", specifier = ">=2.3.2.250827" }, { name = "pkginfo", specifier = ">=1.12.1.2" }, @@ -5738,6 +5692,7 @@ dev = [ { name = "pytest-asyncio", specifier = ">=1.2.0" }, { name = "pytest-cov", specifier = ">=6.0.0" }, { name = "ruff", specifier = ">=0.1.0" }, + { name = "ty", specifier = ">=0.0.8" }, { name = "types-cachetools", specifier = ">=6.2.0.20250827" }, { name = "types-networkx", specifier = ">=3.5.0.20250901" }, { name = "types-pyyaml", specifier = ">=6.0.2" }, @@ -7017,6 +6972,31 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fb/b7/1dec8433ac604c061173d0589d99217fe7bf90a70bdc375e745d044b8aad/triton-3.5.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:317fe477ea8fd4524a6a8c499fb0a36984a56d0b75bf9c9cb6133a1c56d5a6e7", size = 170580176, upload-time = "2025-10-13T16:38:31.14Z" }, ] +[[package]] +name = "ty" +version = "0.0.9" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/19/7b/4f677c622d58563c593c32081f8a8572afd90e43dc15b0dedd27b4305038/ty-0.0.9.tar.gz", hash = "sha256:83f980c46df17586953ab3060542915827b43c4748a59eea04190c59162957fe", size = 4858642, upload-time = "2026-01-05T12:24:56.528Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3f/3f/c1ee119738b401a8081ff84341781122296b66982e5982e6f162d946a1ff/ty-0.0.9-py3-none-linux_armv6l.whl", hash = "sha256:dd270d4dd6ebeb0abb37aee96cbf9618610723677f500fec1ba58f35bfa8337d", size = 9763596, upload-time = "2026-01-05T12:24:37.43Z" }, + { url = "https://files.pythonhosted.org/packages/63/41/6b0669ef4cd806d4bd5c30263e6b732a362278abac1bc3a363a316cde896/ty-0.0.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:debfb2ba418b00e86ffd5403cb666b3f04e16853f070439517dd1eaaeeff9255", size = 9591514, upload-time = "2026-01-05T12:24:26.891Z" }, + { url = "https://files.pythonhosted.org/packages/02/a1/874aa756aee5118e690340a771fb9ded0d0c2168c0b7cc7d9561c2a750b0/ty-0.0.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:107c76ebb05a13cdb669172956421f7ffd289ad98f36d42a44a465588d434d58", size = 9097773, upload-time = "2026-01-05T12:24:14.442Z" }, + { url = "https://files.pythonhosted.org/packages/32/62/cb9a460cf03baab77b3361d13106b93b40c98e274d07c55f333ce3c716f6/ty-0.0.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6868ca5c87ca0caa1b3cb84603c767356242b0659b88307eda69b2fb0bfa416b", size = 9581824, upload-time = "2026-01-05T12:24:35.074Z" }, + { url = "https://files.pythonhosted.org/packages/5a/97/633ecb348c75c954f09f8913669de8c440b13b43ea7d214503f3f1c4bb60/ty-0.0.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d14a4aa0eb5c1d3591c2adbdda4e44429a6bb5d2e298a704398bb2a7ccdafdfe", size = 9591050, upload-time = "2026-01-05T12:24:08.804Z" }, + { url = "https://files.pythonhosted.org/packages/6f/e6/4b0c6a7a8a234e2113f88c80cc7aaa9af5868de7a693859f3c49da981934/ty-0.0.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01bd4466504cefa36b465c6608e9af4504415fa67f6affc01c7d6ce36663c7f4", size = 10018262, upload-time = "2026-01-05T12:24:53.791Z" }, + { url = "https://files.pythonhosted.org/packages/cb/97/076d72a028f6b31e0b87287aa27c5b71a2f9927ee525260ea9f2f56828b8/ty-0.0.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:76c8253d1b30bc2c3eaa1b1411a1c34423decde0f4de0277aa6a5ceacfea93d9", size = 10911642, upload-time = "2026-01-05T12:24:48.264Z" }, + { url = "https://files.pythonhosted.org/packages/3f/5a/705d6a5ed07ea36b1f23592c3f0dbc8fc7649267bfbb3bf06464cdc9a98a/ty-0.0.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8992fa4a9c6a5434eae4159fdd4842ec8726259bfd860e143ab95d078de6f8e3", size = 10632468, upload-time = "2026-01-05T12:24:24.118Z" }, + { url = "https://files.pythonhosted.org/packages/44/78/4339a254537488d62bf392a936b3ec047702c0cc33d6ce3a5d613f275cd0/ty-0.0.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c79d503d151acb4a145a3d98702d07cb641c47292f63e5ffa0151e4020a5d33", size = 10273422, upload-time = "2026-01-05T12:24:45.8Z" }, + { url = "https://files.pythonhosted.org/packages/90/40/e7f386e87c9abd3670dcee8311674d7e551baa23b2e4754e2405976e6c92/ty-0.0.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7a7ebf89ed276b564baa1f0dd9cd708e7b5aa89f19ce1b2f7d7132075abf93e", size = 10120289, upload-time = "2026-01-05T12:24:17.424Z" }, + { url = "https://files.pythonhosted.org/packages/f7/46/1027442596e725c50d0d1ab5179e9fa78a398ab412994b3006d0ee0899c7/ty-0.0.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ae3866e50109d2400a886bb11d9ef607f23afc020b226af773615cf82ae61141", size = 9566657, upload-time = "2026-01-05T12:24:51.048Z" }, + { url = "https://files.pythonhosted.org/packages/56/be/df921cf1967226aa01690152002b370a7135c6cced81e86c12b86552cdc4/ty-0.0.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:185244a5eacfcd8f5e2d85b95e4276316772f1e586520a6cb24aa072ec1bac26", size = 9610334, upload-time = "2026-01-05T12:24:20.334Z" }, + { url = "https://files.pythonhosted.org/packages/ac/e8/f085268860232cc92ebe95415e5c8640f7f1797ac3a49ddd137c6222924d/ty-0.0.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f834ff27d940edb24b2e86bbb3fb45ab9e07cf59ca8c5ac615095b2542786408", size = 9726701, upload-time = "2026-01-05T12:24:29.785Z" }, + { url = "https://files.pythonhosted.org/packages/42/b4/9394210c66041cd221442e38f68a596945103d9446ece505889ffa9b3da9/ty-0.0.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:773f4b3ba046de952d7c1ad3a2c09b24f3ed4bc8342ae3cbff62ebc14aa6d48c", size = 10227082, upload-time = "2026-01-05T12:24:40.132Z" }, + { url = "https://files.pythonhosted.org/packages/dc/9f/75951eb573b473d35dd9570546fc1319f7ca2d5b5c50a5825ba6ea6cb33a/ty-0.0.9-py3-none-win32.whl", hash = "sha256:1f20f67e373038ff20f36d5449e787c0430a072b92d5933c5b6e6fc79d3de4c8", size = 9176458, upload-time = "2026-01-05T12:24:32.559Z" }, + { url = "https://files.pythonhosted.org/packages/9b/80/b1cdf71ac874e72678161e25e2326a7d30bc3489cd3699561355a168e54f/ty-0.0.9-py3-none-win_amd64.whl", hash = "sha256:2c415f3bbb730f8de2e6e0b3c42eb3a91f1b5fbbcaaead2e113056c3b361c53c", size = 10040479, upload-time = "2026-01-05T12:24:42.697Z" }, + { url = "https://files.pythonhosted.org/packages/b5/8f/abc75c4bb774b12698629f02d0d12501b0a7dff9c31dc3bd6b6c6467e90a/ty-0.0.9-py3-none-win_arm64.whl", hash = "sha256:48e339d794542afeed710ea4f846ead865cc38cecc335a9c781804d02eaa2722", size = 9543127, upload-time = "2026-01-05T12:24:11.731Z" }, +] + [[package]] name = "typer" version = "0.19.2" From e640709bbebaa225e0f3e9e87b5a89bc0d8e202a Mon Sep 17 00:00:00 2001 From: Lou Kratz <219901029+loukratz-bv@users.noreply.github.com> Date: Tue, 6 Jan 2026 13:45:34 -0500 Subject: [PATCH 2/3] Address all type warnings --- .pre-commit-config.yaml | 4 +- pyproject.toml | 22 ++++------ qtype/commands/generate.py | 4 +- qtype/dsl/custom_types.py | 3 +- qtype/interpreter/api.py | 5 ++- qtype/interpreter/base/base_step_executor.py | 4 +- qtype/interpreter/conversions.py | 10 +++-- .../executors/construct_executor.py | 2 +- .../executors/file_source_executor.py | 6 +-- .../executors/file_writer_executor.py | 8 ++-- .../executors/index_upsert_executor.py | 2 +- .../executors/sql_source_executor.py | 2 +- qtype/interpreter/resource_cache.py | 4 +- qtype/interpreter/rich_progress.py | 9 ++-- qtype/interpreter/stream/chat/converter.py | 42 +++++++++++-------- .../stream/chat/ui_request_to_domain_type.py | 4 +- qtype/interpreter/typing.py | 12 +++--- qtype/semantic/checker.py | 2 +- qtype/semantic/generate.py | 6 +-- qtype/semantic/visualize.py | 7 +++- 20 files changed, 88 insertions(+), 70 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0872d10..0d4624a2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: hooks: - id: ty name: ty check - entry: ty check kissml --ignore unresolved-import + entry: ty check qtype --ignore unresolved-import language: python pass_filenames: false - files: ^kissml/.*\.py$ \ No newline at end of file + files: ^qtype/.*\.py$ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3cd0b7ef..ef3f84b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -134,21 +134,13 @@ force_grid_wrap = 0 use_parentheses = true ensure_newline_before_comments = true -[tool.ty] -python_version = "3.10" -warn_return_any = true -warn_unused_configs = true -disallow_untyped_defs = true -explicit_package_bases = true -plugins = ["pydantic.mypy"] - -[[tool.ty.overrides]] -module = "tests.*" -disallow_untyped_defs = false - -[[tool.ty.overrides]] -module = "qtype.semantic.model" -warn_return_any = false +# Note: ty will show references to .venv in error contexts when reporting +# type issues with imported external libraries. This is expected behavior. +[tool.ty.environment] +root = ["."] + +[tool.ty.src] +include = ["qtype/**"] [tool.coverage.run] source = ["qtype"] diff --git a/qtype/commands/generate.py b/qtype/commands/generate.py index f522a33c..5934dfb7 100644 --- a/qtype/commands/generate.py +++ b/qtype/commands/generate.py @@ -51,7 +51,9 @@ def run_dump_commons_library(args: argparse.Namespace) -> None: ) # Convert to YAML and save - content = facade.convert_document(model_list) + from pydantic_yaml import to_yaml_str + + content = to_yaml_str(model_list) output_path = Path(f"{args.prefix}/aws.bedrock.models.qtype.yaml") output_path.write_text(content, encoding="utf-8") logger.info(f"AWS Bedrock models exported to {output_path}") diff --git a/qtype/dsl/custom_types.py b/qtype/dsl/custom_types.py index 03b62320..9600c75a 100644 --- a/qtype/dsl/custom_types.py +++ b/qtype/dsl/custom_types.py @@ -43,7 +43,8 @@ def _parse_type_string(type_str: str) -> tuple[Any, bool]: resolved_type = ForwardRef(type_str) if is_optional: - return Union[resolved_type, None], True + # Type checker: resolved_type is runtime-constructed type + return Union[resolved_type, None], True # type: ignore[valid-type] return resolved_type, False diff --git a/qtype/interpreter/api.py b/qtype/interpreter/api.py index 01727567..5fe3091c 100644 --- a/qtype/interpreter/api.py +++ b/qtype/interpreter/api.py @@ -3,6 +3,7 @@ import asyncio from contextlib import asynccontextmanager from pathlib import Path +from typing import Any from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware @@ -86,8 +87,10 @@ async def shutdown_telemetry(): if ui_enabled: # Add CORS middleware only for localhost development if self.host in ("localhost", "127.0.0.1", "0.0.0.0"): + from typing import cast + app.add_middleware( - CORSMiddleware, + cast(Any, CORSMiddleware), allow_origins=["*"], allow_credentials=True, allow_methods=["*"], diff --git a/qtype/interpreter/base/base_step_executor.py b/qtype/interpreter/base/base_step_executor.py index 3a2ae028..01dea695 100644 --- a/qtype/interpreter/base/base_step_executor.py +++ b/qtype/interpreter/base/base_step_executor.py @@ -355,7 +355,9 @@ async def _process_message_with_cache( ): serialized = [to_cache_value(m, self.step) for m in buf] self.cache.set( - key, serialized, expire=self.step.cache_config.ttl + key, + serialized, + expire=self.step.cache_config.ttl, # type: ignore[union-attr] ) # type: ignore async def _process_message_with_telemetry( diff --git a/qtype/interpreter/conversions.py b/qtype/interpreter/conversions.py index 8423dd57..8c00ff5a 100644 --- a/qtype/interpreter/conversions.py +++ b/qtype/interpreter/conversions.py @@ -331,7 +331,7 @@ def to_embedding_model( OpenAIEmbedding, ) - api_key = None + api_key: str | None = None if model.auth: with auth(model.auth, secret_manager) as provider: if not isinstance(provider, APIKeyAuthProvider): @@ -343,7 +343,7 @@ def to_embedding_model( api_key = provider.api_key # type: ignore[assignment] openai_embedding: BaseEmbedding = OpenAIEmbedding( - api_key=api_key, + api_key=api_key, # type: ignore[arg-type] model_name=model.model_id if model.model_id else model.id, ) return openai_embedding @@ -523,7 +523,11 @@ def from_chat_message(message: LlamaChatMessage) -> ChatMessage: f"Unsupported content block type: {type(block)}" ) - return ChatMessage(role=message.role, blocks=blocks) + # Convert llama_index MessageRole to our MessageRole + from qtype.dsl.domain_types import MessageRole as QTypeMessageRole + + role = QTypeMessageRole(message.role.value) + return ChatMessage(role=role, blocks=blocks) def to_text_splitter(splitter: DocumentSplitter) -> Any: diff --git a/qtype/interpreter/executors/construct_executor.py b/qtype/interpreter/executors/construct_executor.py index 2843b48b..3df5909c 100644 --- a/qtype/interpreter/executors/construct_executor.py +++ b/qtype/interpreter/executors/construct_executor.py @@ -53,7 +53,7 @@ async def process_message( } # use the mapping to convert variable names to inputs = { - self.step.field_mapping.get(var_name, var_name): value + self.step.field_mapping.get(var_name, var_name): value # type: ignore[attr-defined] for var_name, value in input_values.items() } else: diff --git a/qtype/interpreter/executors/file_source_executor.py b/qtype/interpreter/executors/file_source_executor.py index a0cc934b..51d026af 100644 --- a/qtype/interpreter/executors/file_source_executor.py +++ b/qtype/interpreter/executors/file_source_executor.py @@ -40,10 +40,10 @@ async def process_message( output_columns = {output.id for output in self.step.outputs} # get the path - if isinstance(self.step.path, ConstantPath): - file_path = self.step.path + if isinstance(self.step.path, ConstantPath): # type: ignore[attr-defined] + file_path = self.step.path # type: ignore[attr-defined] else: - file_path = message.variables.get(self.step.path.id) + file_path = message.variables.get(self.step.path.id) # type: ignore[attr-defined] if not file_path: raise ValueError( ( diff --git a/qtype/interpreter/executors/file_writer_executor.py b/qtype/interpreter/executors/file_writer_executor.py index e1f8b8e7..a5df1afe 100644 --- a/qtype/interpreter/executors/file_writer_executor.py +++ b/qtype/interpreter/executors/file_writer_executor.py @@ -48,8 +48,8 @@ async def process_batch( if len(self.step.outputs): output_name = self.step.outputs[0].id - if isinstance(self.step.path, ConstantPath): - file_path = self.step.path.uri + if isinstance(self.step.path, ConstantPath): # type: ignore[attr-defined] + file_path = self.step.path.uri # type: ignore[attr-defined] df = self.to_pandas(batch) # A fixed path is provided -- just write all of the data await self.stream_emitter.status( @@ -67,12 +67,12 @@ async def process_batch( else: # Group messages by file path (path is a Variable in this branch) - if not isinstance(self.step.path, Variable): + if not isinstance(self.step.path, Variable): # type: ignore[attr-defined] raise ValueError( "Expected path to be a Variable in dynamic path case." ) - path_var_id = self.step.path.id + path_var_id = self.step.path.id # type: ignore[attr-defined] # Sort messages by file path for groupby sorted_batch = sorted( diff --git a/qtype/interpreter/executors/index_upsert_executor.py b/qtype/interpreter/executors/index_upsert_executor.py index 14efdedc..75450695 100644 --- a/qtype/interpreter/executors/index_upsert_executor.py +++ b/qtype/interpreter/executors/index_upsert_executor.py @@ -145,7 +145,7 @@ async def _upsert_to_vector_store( nodes.append(node) # Batch upsert all nodes to the vector store - await self._vector_store.async_add(nodes) + await self._vector_store.async_add(nodes) # type: ignore[union-attr] num_inserted = len(items) # Emit status update diff --git a/qtype/interpreter/executors/sql_source_executor.py b/qtype/interpreter/executors/sql_source_executor.py index 5349899b..b8737554 100644 --- a/qtype/interpreter/executors/sql_source_executor.py +++ b/qtype/interpreter/executors/sql_source_executor.py @@ -41,7 +41,7 @@ async def process_message( connection_string = self._resolve_secret(self.step.connection) connect_args = {} if self.step.auth: - with auth(self.step.auth) as creds: + with auth(self.step.auth, self._secret_manager) as creds: if isinstance(creds, boto3.Session): connect_args["session"] = creds engine = create_engine(connection_string, connect_args=connect_args) diff --git a/qtype/interpreter/resource_cache.py b/qtype/interpreter/resource_cache.py index 7ab4f0a6..65bccb7d 100644 --- a/qtype/interpreter/resource_cache.py +++ b/qtype/interpreter/resource_cache.py @@ -25,9 +25,11 @@ def cached_resource(func: Callable[..., Any]) -> Callable[..., Any]: @functools.wraps(func) def wrapper(*args: Any, **kwargs: Any) -> Any: + # Use getattr with fallback for callables that aren't functions + qualname = getattr(func, "__qualname__", repr(func)) cache_key = ( func.__module__, - func.__qualname__, + qualname, args, tuple(sorted(kwargs.items())), ) diff --git a/qtype/interpreter/rich_progress.py b/qtype/interpreter/rich_progress.py index 6de456e0..89a00b83 100644 --- a/qtype/interpreter/rich_progress.py +++ b/qtype/interpreter/rich_progress.py @@ -3,7 +3,7 @@ import logging import threading from collections import deque -from typing import Deque, Dict +from typing import Any, Deque, Dict from rich.console import Console from rich.live import Live @@ -11,6 +11,7 @@ from rich.progress import ( Progress, ProgressColumn, + TaskID, TaskProgressColumn, TextColumn, TimeElapsedColumn, @@ -140,7 +141,7 @@ def __init__( ) # Map step_id -> Rich task id - self.tasks: Dict[str, int] = {} + self.tasks: dict[str, TaskID] = {} self._started = False # Pre-create tasks in the desired order if provided @@ -202,7 +203,9 @@ def __call__( if total_items is not None: update_kwargs["total"] = total_items - self.progress.update(task_id, **update_kwargs) + from typing import cast + + self.progress.update(task_id, **cast(Any, update_kwargs)) def compute_color(self, items_processed: int, items_in_error: int) -> str: # Avoid divide-by-zero diff --git a/qtype/interpreter/stream/chat/converter.py b/qtype/interpreter/stream/chat/converter.py index 418487d1..fced692e 100644 --- a/qtype/interpreter/stream/chat/converter.py +++ b/qtype/interpreter/stream/chat/converter.py @@ -258,10 +258,12 @@ def _convert_tool_execution_start( 3. ToolInputAvailableChunk - Complete input ready, tool can execute """ # 1. Start tool input streaming - yield ToolInputStartChunk( - toolCallId=event.tool_call_id, - toolName=event.tool_name, - providerExecuted=True, # Tools are executed on the server + yield ToolInputStartChunk.model_validate( + { + "toolCallId": event.tool_call_id, + "toolName": event.tool_name, + "providerExecuted": True, + } ) # 2. Stream the input as JSON text delta @@ -274,11 +276,13 @@ def _convert_tool_execution_start( ) # 3. Signal input is complete and ready for execution - yield ToolInputAvailableChunk( - toolCallId=event.tool_call_id, - toolName=event.tool_name, - input=event.tool_input, - providerExecuted=True, # Tools are executed on the server + yield ToolInputAvailableChunk.model_validate( + { + "toolCallId": event.tool_call_id, + "toolName": event.tool_name, + "input": event.tool_input, + "providerExecuted": True, + } ) def _convert_tool_execution_end( @@ -289,10 +293,12 @@ def _convert_tool_execution_end( Signals successful tool completion with output. """ - yield ToolOutputAvailableChunk( - toolCallId=event.tool_call_id, - output=event.tool_output, - providerExecuted=True, # Tools are executed on the server + yield ToolOutputAvailableChunk.model_validate( + { + "toolCallId": event.tool_call_id, + "output": event.tool_output, + "providerExecuted": True, + } ) def _convert_tool_execution_error( @@ -303,10 +309,12 @@ def _convert_tool_execution_error( Signals tool execution failure with error message. """ - yield ToolOutputErrorChunk( - toolCallId=event.tool_call_id, - errorText=event.error_message, - providerExecuted=True, # Tools are executed on the server + yield ToolOutputErrorChunk.model_validate( + { + "toolCallId": event.tool_call_id, + "errorText": event.error_message, + "providerExecuted": True, + } ) def _convert_error(self, event: ErrorEvent) -> Iterator[UIMessageChunk]: diff --git a/qtype/interpreter/stream/chat/ui_request_to_domain_type.py b/qtype/interpreter/stream/chat/ui_request_to_domain_type.py index ea439fbb..1b7f96a2 100644 --- a/qtype/interpreter/stream/chat/ui_request_to_domain_type.py +++ b/qtype/interpreter/stream/chat/ui_request_to_domain_type.py @@ -39,11 +39,11 @@ def _ui_message_to_domain_type(message: UIMessage) -> ChatMessage: for part in message.parts: if part.type == "text": blocks.append( - ChatContent(type=PrimitiveTypeEnum.text, content=part.text) + ChatContent(type=PrimitiveTypeEnum.text, content=part.text) # type: ignore[attr-defined] ) elif part.type == "reasoning": blocks.append( - ChatContent(type=PrimitiveTypeEnum.text, content=part.text) + ChatContent(type=PrimitiveTypeEnum.text, content=part.text) # type: ignore[attr-defined] ) elif part.type == "file": blocks.append( diff --git a/qtype/interpreter/typing.py b/qtype/interpreter/typing.py index d77fbd86..8029b5a3 100644 --- a/qtype/interpreter/typing.py +++ b/qtype/interpreter/typing.py @@ -25,11 +25,9 @@ def _get_variable_type(var: DSLVariable) -> tuple[Type, dict[str, Any]]: python_type = PRIMITIVE_TO_PYTHON_TYPE.get(var.type, str) field_metadata["qtype_type"] = var.type.value elif isinstance(var.type, ListType): - python_type = list[ - _get_variable_type(DSLVariable(id="", type=var.type.element_type))[ - 0 - ] - ] + element_var = DSLVariable(id="", type=var.type.element_type) + element_type, _ = _get_variable_type(element_var) + python_type = list[element_type] # type: ignore[valid-type] field_metadata["qtype_type"] = f"list[{var.type.element_type}]" elif ( isinstance(var.type, type) @@ -82,7 +80,7 @@ def create_output_container_type(flow: Flow) -> Type[BaseModel]: Field(description="List of errored execution outputs"), ) fields["outputs"] = ( - list[output_shape], + list[output_shape], # type: ignore[valid-type] Field(description="List of successful execution outputs"), ) return create_model(f"{flow.id}Response", __base__=BaseModel, **fields) # type: ignore @@ -162,7 +160,7 @@ def instantiate_variable(variable: DSLVariable, value: Any) -> Any: # 2. Handle Pydantic Models (Custom/Domain Types) if hasattr(target_type, "model_validate"): - return target_type.model_validate(value) + return target_type.model_validate(value) # type: ignore[misc] # 3. Handle Primitives & Complex Python Types (List, Optional, Union) try: diff --git a/qtype/semantic/checker.py b/qtype/semantic/checker.py index a24f437f..52cbffae 100644 --- a/qtype/semantic/checker.py +++ b/qtype/semantic/checker.py @@ -704,7 +704,7 @@ def check(model: BaseModel) -> None: # Check if this model type has a validator model_type = type(model) if model_type in _VALIDATORS: - _VALIDATORS[model_type](model) + _VALIDATORS[model_type](model) # type: ignore[arg-type] # Recursively validate all fields for field_name, field_value in model: diff --git a/qtype/semantic/generate.py b/qtype/semantic/generate.py index 9ccf01f1..bb9c062d 100644 --- a/qtype/semantic/generate.py +++ b/qtype/semantic/generate.py @@ -73,7 +73,7 @@ def sort_classes_by_inheritance( ): graph.add_edge(base.__name__, class_name) - sorted_names = list(nx.topological_sort(graph)) + sorted_names = list(nx.topological_sort(graph)) # type: ignore[arg-type] # sorted_names = sorted(graph.nodes, key=lambda node: depths[node]) return [(name, class_dict[name]) for name in sorted_names] @@ -490,10 +490,10 @@ def generate_semantic_class(class_name: str, cls: type) -> str: # Only process fields that are actually defined on this class for field_name in cls.__annotations__: if ( - field_name in cls.model_fields + field_name in cls.model_fields # type: ignore[operator] and f"{class_name}.{field_name}" not in FIELDS_TO_IGNORE ): - field_info = cls.model_fields[field_name] + field_info = cls.model_fields[field_name] # type: ignore[index] field_type = field_info.annotation field_default = field_info.default field_default_factory = field_info.default_factory diff --git a/qtype/semantic/visualize.py b/qtype/semantic/visualize.py index 237f36a2..25f3801b 100644 --- a/qtype/semantic/visualize.py +++ b/qtype/semantic/visualize.py @@ -415,8 +415,11 @@ def _generate_shared_resources(app: Application) -> list[str]: # Handle auth as either AuthorizationProvider object or string ID if isinstance(index.auth, str): auth_id = f"AUTH_{_sanitize_id(index.auth)}" + elif hasattr(index.auth, "id"): + auth_id = f"AUTH_{_sanitize_id(str(index.auth.id))}" else: - auth_id = f"AUTH_{_sanitize_id(index.auth.id)}" + # Fallback for unexpected types + auth_id = f"AUTH_{_sanitize_id(str(index.auth))}" lines.append(f" {index_id} -.->|uses| {auth_id}") # Memories @@ -459,7 +462,7 @@ def _generate_shared_resources(app: Application) -> list[str]: def _generate_telemetry_nodes(telemetry: TelemetrySink) -> list[str]: """Generate nodes for telemetry configuration.""" # Replace :// with a space to avoid markdown link parsing - safe_endpoint = telemetry.endpoint.replace("://", "://") + safe_endpoint = telemetry.endpoint.replace("://", "://") # type: ignore[union-attr] lines = [ ' subgraph TELEMETRY ["📊 Observability"]', From d96aaabf8ede4f7d82923bd6f0be00b2e4a7520f Mon Sep 17 00:00:00 2001 From: Lou Kratz <219901029+loukratz-bv@users.noreply.github.com> Date: Tue, 6 Jan 2026 13:54:31 -0500 Subject: [PATCH 3/3] clean up commons export --- common/aws.bedrock.models.qtype.yaml | 124 +++++++++++++++++++++------ qtype/commands/generate.py | 4 +- qtype/dsl/model.py | 7 +- 3 files changed, 106 insertions(+), 29 deletions(-) diff --git a/common/aws.bedrock.models.qtype.yaml b/common/aws.bedrock.models.qtype.yaml index bd50040e..e5a23fda 100644 --- a/common/aws.bedrock.models.qtype.yaml +++ b/common/aws.bedrock.models.qtype.yaml @@ -1,14 +1,108 @@ +- id: nvidia.nemotron-nano-12b-v2 + provider: aws-bedrock - id: anthropic.claude-sonnet-4-20250514-v1:0 provider: aws-bedrock +- id: anthropic.claude-haiku-4-5-20251001-v1:0 + provider: aws-bedrock +- id: openai.gpt-oss-120b-1:0 + provider: aws-bedrock +- id: stability.stable-creative-upscale-v1:0 + provider: aws-bedrock +- id: qwen.qwen3-next-80b-a3b + provider: aws-bedrock +- id: amazon.nova-2-multimodal-embeddings-v1:0 + provider: aws-bedrock +- id: nvidia.nemotron-nano-3-30b + provider: aws-bedrock +- id: minimax.minimax-m2 + provider: aws-bedrock +- id: mistral.voxtral-mini-3b-2507 + provider: aws-bedrock +- id: amazon.nova-pro-v1:0 + provider: aws-bedrock +- id: stability.stable-image-remove-background-v1:0 + provider: aws-bedrock +- id: stability.stable-image-control-sketch-v1:0 + provider: aws-bedrock +- id: amazon.nova-2-lite-v1:0 + provider: aws-bedrock +- id: amazon.nova-2-lite-v1:0:256k + provider: aws-bedrock +- id: stability.stable-conservative-upscale-v1:0 + provider: aws-bedrock +- id: google.gemma-3-12b-it + provider: aws-bedrock +- id: stability.stable-image-search-recolor-v1:0 + provider: aws-bedrock +- id: moonshot.kimi-k2-thinking + provider: aws-bedrock +- id: mistral.mistral-large-3-675b-instruct + provider: aws-bedrock - id: twelvelabs.pegasus-1-2-v1:0 provider: aws-bedrock +- id: amazon.nova-2-sonic-v1:0 + provider: aws-bedrock +- id: qwen.qwen3-32b-v1:0 + provider: aws-bedrock +- id: mistral.ministral-3-14b-instruct + provider: aws-bedrock +- id: writer.palmyra-x5-v1:0 + provider: aws-bedrock +- id: nvidia.nemotron-nano-9b-v2 + provider: aws-bedrock +- id: mistral.ministral-3-8b-instruct + provider: aws-bedrock +- id: mistral.voxtral-small-24b-2507 + provider: aws-bedrock +- id: openai.gpt-oss-20b-1:0 + provider: aws-bedrock +- id: google.gemma-3-4b-it + provider: aws-bedrock +- id: stability.stable-fast-upscale-v1:0 + provider: aws-bedrock +- id: stability.stable-image-erase-object-v1:0 + provider: aws-bedrock +- id: openai.gpt-oss-safeguard-120b + provider: aws-bedrock +- id: google.gemma-3-27b-it + provider: aws-bedrock +- id: stability.stable-image-control-structure-v1:0 + provider: aws-bedrock +- id: twelvelabs.marengo-embed-3-0-v1:0 + provider: aws-bedrock +- id: writer.palmyra-x4-v1:0 + provider: aws-bedrock +- id: anthropic.claude-sonnet-4-5-20250929-v1:0 + provider: aws-bedrock +- id: twelvelabs.marengo-embed-2-7-v1:0 + provider: aws-bedrock +- id: qwen.qwen3-vl-235b-a22b + provider: aws-bedrock +- id: stability.stable-outpaint-v1:0 + provider: aws-bedrock +- id: stability.stable-image-inpaint-v1:0 + provider: aws-bedrock - id: anthropic.claude-opus-4-1-20250805-v1:0 provider: aws-bedrock -- id: amazon.titan-tg1-large +- id: stability.stable-image-style-guide-v1:0 + provider: aws-bedrock +- id: mistral.magistral-small-2509 + provider: aws-bedrock +- id: stability.stable-style-transfer-v1:0 + provider: aws-bedrock +- id: cohere.embed-v4:0 + provider: aws-bedrock +- id: mistral.ministral-3-3b-instruct + provider: aws-bedrock +- id: anthropic.claude-opus-4-5-20251101-v1:0 + provider: aws-bedrock +- id: stability.stable-image-search-replace-v1:0 provider: aws-bedrock -- id: amazon.titan-image-generator-v1:0 +- id: qwen.qwen3-coder-30b-a3b-v1:0 provider: aws-bedrock -- id: amazon.titan-image-generator-v1 +- id: openai.gpt-oss-safeguard-20b + provider: aws-bedrock +- id: amazon.titan-tg1-large provider: aws-bedrock - id: amazon.titan-image-generator-v2:0 provider: aws-bedrock @@ -22,14 +116,10 @@ provider: aws-bedrock - id: amazon.nova-premier-v1:0 provider: aws-bedrock -- id: amazon.titan-text-premier-v1:0 - provider: aws-bedrock - id: amazon.nova-pro-v1:0:24k provider: aws-bedrock - id: amazon.nova-pro-v1:0:300k provider: aws-bedrock -- id: amazon.nova-pro-v1:0 - provider: aws-bedrock - id: amazon.nova-lite-v1:0:24k provider: aws-bedrock - id: amazon.nova-lite-v1:0:300k @@ -52,10 +142,6 @@ provider: aws-bedrock - id: amazon.titan-embed-g1-text-02 provider: aws-bedrock -- id: amazon.titan-text-lite-v1:0:4k - provider: aws-bedrock -- id: amazon.titan-text-lite-v1 - provider: aws-bedrock - id: amazon.titan-text-express-v1:0:8k provider: aws-bedrock - id: amazon.titan-text-express-v1 @@ -72,20 +158,12 @@ provider: aws-bedrock - id: amazon.titan-embed-image-v1 provider: aws-bedrock -- id: stability.stable-diffusion-xl-v1:0 - provider: aws-bedrock -- id: stability.stable-diffusion-xl-v1 - provider: aws-bedrock -- id: ai21.jamba-instruct-v1:0 - provider: aws-bedrock - id: ai21.jamba-1-5-large-v1:0 provider: aws-bedrock - id: ai21.jamba-1-5-mini-v1:0 provider: aws-bedrock - id: anthropic.claude-instant-v1:2:100k provider: aws-bedrock -- id: anthropic.claude-instant-v1 - provider: aws-bedrock - id: anthropic.claude-v2:0:18k provider: aws-bedrock - id: anthropic.claude-v2:0:100k @@ -94,10 +172,6 @@ provider: aws-bedrock - id: anthropic.claude-v2:1:200k provider: aws-bedrock -- id: anthropic.claude-v2:1 - provider: aws-bedrock -- id: anthropic.claude-v2 - provider: aws-bedrock - id: anthropic.claude-3-sonnet-20240229-v1:0:28k provider: aws-bedrock - id: anthropic.claude-3-sonnet-20240229-v1:0:200k @@ -140,6 +214,8 @@ provider: aws-bedrock - id: cohere.embed-multilingual-v3 provider: aws-bedrock +- id: cohere.rerank-v3-5:0 + provider: aws-bedrock - id: deepseek.r1-v1:0 provider: aws-bedrock - id: meta.llama3-8b-instruct-v1:0 @@ -174,5 +250,3 @@ provider: aws-bedrock - id: mistral.pixtral-large-2502-v1:0 provider: aws-bedrock -- id: twelvelabs.marengo-embed-2-7-v1:0 - provider: aws-bedrock diff --git a/qtype/commands/generate.py b/qtype/commands/generate.py index 5934dfb7..19c9bc54 100644 --- a/qtype/commands/generate.py +++ b/qtype/commands/generate.py @@ -53,7 +53,9 @@ def run_dump_commons_library(args: argparse.Namespace) -> None: # Convert to YAML and save from pydantic_yaml import to_yaml_str - content = to_yaml_str(model_list) + content = to_yaml_str( + model_list, exclude_none=True, exclude_unset=True + ) output_path = Path(f"{args.prefix}/aws.bedrock.models.qtype.yaml") output_path.write_text(content, encoding="utf-8") logger.info(f"AWS Bedrock models exported to {output_path}") diff --git a/qtype/dsl/model.py b/qtype/dsl/model.py index 8d0cb412..dca40df6 100644 --- a/qtype/dsl/model.py +++ b/qtype/dsl/model.py @@ -285,9 +285,10 @@ def _serialize_type(value): @model_serializer def _model_serializer(self): # Use the default serialization, but ensure 'type' is a string - data = self.model_dump() - data["type"] = self._serialize_type(data.get("type")) - return data + return { + "type": self._serialize_type(self.type), + "optional": self.optional, + } class ListType(BaseModel):