This repository was archived by the owner on Jun 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
831 lines (767 loc) · 28.1 KB
/
Copy pathpyproject.toml
File metadata and controls
831 lines (767 loc) · 28.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
#:tombi schema.strict = false
# SPDX-FileCopyrightText: 2025 Knitli Inc.
# SPDX-FileContributor: Adam Poulemanos <adam@knit.li>
#
# SPDX-License-Identifier: MIT OR Apache-2.0
[project]
# It seems 'codeweaver' is too similar to 'codeweave' on PyPI, so we use 'code-weaver' as the package name
name = "code-weaver"
description = "Extensible MCP server for semantic code search with plugin architecture supporting multiple embedding providers, vector databases, and data sources."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.12"
license = "MIT OR Apache-2.0"
license-files = [
"./LICENSE-Apache-2.0",
"./LICENSE-MIT",
"LICENSES/Apache-2.0.txt",
"LICENSES/MIT.txt",
]
authors = [
{ name = "Knitli Inc." },
{ name = "Adam Poulemanos", email = "adam@knit.li" },
]
keywords = [
"agents",
"ai",
"anthropic",
"artificial intelligence",
"ast-grep",
"azure",
"bedrock",
"claude",
"code analysis",
"code embeddings",
"code indexing",
"code intelligence",
"code search",
"code understanding",
"codebase",
"codebase analysis",
"codebase management",
"cohere",
"docarray",
"embedding",
"embeddings",
"extensible",
"fastembed",
"fastmcp",
"framework",
"genai",
"google",
"grok",
"groq",
"huggingface",
"hybrid search",
"information retrieval",
"large language models",
"llama",
"llms",
"mcp",
"mcp protocol",
"mcp server",
"mistral",
"model context protocol",
"natural language processing",
"nlp",
"openai",
"perplexity",
"platform",
"plugin architecture",
"pydantic",
"pydantic-ai",
"qdrant",
"rerank",
"retrieval",
"search",
"semantic search",
"sentence transformers",
"tree-sitter",
"vector",
"vector database",
"vector embeddings",
"vector search",
"vector store",
"voyageai",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: Apache Software License",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Indexing",
"Topic :: Utilities",
"Typing :: Typed",
]
# Some notes:
# - Starting with Alpha 6, we pin client versions to ensure our `ClientOptions` subclasses work correctly.
# - We like to stay toward the edge, so we'll update these regularly but ensure they work first.
# -
# tombi: format.rules.array-values-order.disabled = true
dependencies = [
# * ================ Core Dependencies ==================*
"anyio>4.12.0",
"blake3>=1.0.8",
# We use some pydantic internal/private utilities in dependency resolution
# So we pin it to make sure we don't break on minor releases
"pydantic==2.12.5",
# for, you know, platform dirs
"platformdirs>=4.9.4",
# psutil used for resource governance/limiting by engine
"psutil>=7.2.2",
"textcase>=0.4.5",
"typing_extensions>=4.15.0",
"uuid7>=0.1.0; python_version < '3.14'",
"uvloop>=0.22.1; python_implementation == 'CPython' and platform_system != 'Windows'",
# * ================ Core Provider Dependencies ==================*
# tokenizers used by stats, telemetry, and all embed/rerank providers (for stats)
# no easy way to currently separate out stats-only usage from embedding/rerank usage
"code-weaver-tokenizers",
# numpy needed for all embedding providers
"numpy>=2.4.2",
# lazy import handling; spun off from core/utils/lazy_importer into its own package
"lateimport>=0.1.0",
# retries
"tenacity>=9.1.4",
# for local providers (sentence-transformers, fastembed) to detect CPU/GPU features
"py-cpuinfo>=9.0.0",
# * ================ CLI Dependencies ==================*
"cyclopts>=4.10.0",
"rich>=14.3.3",
# * ================ Provider Clients ==================*
# we must pin these to specific versions to ensure compatibility with our ClientOptions subclasses
"boto3==1.42.19",
"cohere==5.20.7",
"fastembed==0.7.4; python_version < '3.14'",
"google-genai==1.56.0",
# NOTE: We're waiting on pydantic-ai to update to 1.0+ before we can upgrade too
"huggingface-hub>=1.0.0",
"mistralai==1.10.0",
"openai==2.28.0",
"qdrant-client==1.17.1",
"pydantic-ai-slim>=1.68.0",
"sentence-transformers==5.2.0; python_version <= '3.14'",
"voyageai==0.3.7",
# * ================ Indexing and Engine ==================*
# Also known as: the land of python rust extensions
# the core code-weaver-daemon package that keeps indexing continuously updated
"code-weaver-daemon",
# performant rust-based file walker with .gitignore support (pyO3 extensions for `ignore` crate)
"rignore>=0.7.6",
# performant rust-based file watcher
"watchfiles>=1.1.1",
# for semantic indexing, but also required for the Semantic package, unsurprisingly
# also rust-based.
"ast-grep-py>=0.40.3",
# * ================ Server and MCP Server Framework ==================*
# fastmcp is the core MCP server framework
"fastmcp>=2.14.0",
# just used for types but we need them at runtime for Pydantic models
"mcp>=1.23.3",
# Runs the core admin/management server
"uvicorn[standard]>=0.40.0",
# * ================ Configuration and Settings ==================*
# pydantic-settings with toml and yaml support for config files
"pydantic-settings[toml,yaml]>=2.13.1", # Pulls: tomli>=2.0.1, pyyaml>=6.0.1
# For writing toml config files
"tomli-w>=1.2.0",
# * ================ Telemetry and Observability ==================*
# It's telemetry. Our implementation is lightweight and privacy-focused.
"posthog>=7.9.12",
#! Not yet used, but planned for future releases
# * ================ Future Dependencies ==================*
# for advanced pipeline management and orchestration
# "pydantic-graph>=1.39.0",
]
dynamic = ["version"]
[project.urls]
Changelog = "https://github.com/knitli/codeweaver/blob/main/CHANGELOG.md"
# Documentation = "https://dev.knitli.com/codeweaver" not live yet
Homepage = "https://knitli.com"
Issues = "https://github.com/knitli/codeweaver/issues"
Repository = "https://github.com/knitli/codeweaver"
[project.scripts]
codeweaver = "codeweaver.cli.__main__:main"
cw = "codeweaver.cli.__main__:main"
[project.optional-dependencies]
# ==== Providers ====
anthropic = ["pydantic-ai-slim[anthropic]"]
# eunomia middleware - see https://gofastmcp.com/integrations/eunomia-authorization
auth-eunomia = ["eunomia-mcp"]
# ==== Authentication and Authorization Middleware ====
# Optional middleware to add authentication and authorization capabilities to the CodeWeaver server.
# This allows you to secure your CodeWeaver instance with various authentication providers and authorization policies.
# The middleware can be used to enforce access control policies, authenticate users, and manage permissions.
# TODO: Implement authentication and authorization middleware -- should be simple to add
# permit.io middleware - see https://gofastmcp.com/integrations/permit
auth-permitio = ["permit-fastmcp"]
# ==== Authentication and Authorization Middleware/Addons ====
# Settings/Config Secrets
aws-secrets-manager = ["pydantic-settings[yaml,toml,aws-secrets-manager]"]
# does NOT support free-threaded python 3.13 (3.14 is OK) due to cffi dependency in azure-identity
azure-key-vault = ["pydantic-settings[yaml,toml,azure-key-vault]"]
bedrock = ["pydantic-ai-slim[bedrock]"]
cohere = ["pydantic-ai-slim[cohere]"]
# ==== Data Sources ====
# duckduckgo relies on primp, which needs maturin. Maturin does not yet support python 3.14 free-threaded builds, so we exclude it from python 3.14 installs for now. If you need duckduckgo support on python 3.14, you can install the ddgs package manually in your environment.
duckduckgo = ["ddgs; python_version < '3.14'"]
exa = ["exa-py"]
fastembed = ["fastembed; python_version < '3.14'", "py-cpuinfo"]
# Requires additional setup, see https://qdrant.github.io/fastembed/examples/FastEmbed_GPU/
fastembed-gpu = ["fastembed-gpu; python_version < '3.14'", "py-cpuinfo"]
full = [
"permit-fastmcp",
"ddgs; python_version < '3.14'",
"eunomia-mcp",
"exa-py",
"pydantic-ai-slim[openai,cohere,google,anthropic,groq,mistral,bedrock,huggingface,retries,xai]",
# azure-key-vault requires azure-identity, which requires cffi. cffi *does* work on python 3.13, but NOT 3.13 freethreaded
# since we have no way to test for freethreaded builds in pyproject.toml and the build breaks with it, we leave it out.
# If you need azure-key-vault support on python 3.13, you can install the full group and then manually install azure-identity in your environment to get the missing dependency (with vanilla python).
"pydantic-settings[yaml,toml,aws-secrets-manager,gcp-secret-manager]; python_version == '3.13'",
"pydantic-settings[yaml,toml,aws-secrets-manager,gcp-secret-manager,azure-key-vault]; python_version != '3.13'",
"permit-fastmcp",
"sentence-transformers",
"tavily-python",
]
full-gpu = [
"permit-fastmcp",
"ddgs; python_version < '3.14'",
"eunomia-mcp",
"fastembed-gpu; python_version < '3.14'",
"permit-fastmcp",
"exa-py",
"pydantic-ai-slim[openai,cohere,google,anthropic,groq,mistral,bedrock,huggingface,retries,xai]",
"pydantic-settings[yaml,toml,aws-secrets-manager,azure-key-vault,gcp-secret-manager]",
"sentence-transformers",
# see note below about why this is commented out
# "sentence-transformers[onnx-gpu]; python_version>='3.12' and python_version<'3.14'",
"tavily-python",
]
gcp-secret-manager = ["pydantic-settings[yaml,toml,gcp-secret-manager]"]
google = ["pydantic-ai-slim[google]"]
gpu-support = [
"fastembed-gpu; python_version < '3.14'",
# see note below about why this is commented out
# "sentence-transformers[onnx-gpu]; python_version>='3.12' and python_version<'3.14'",
]
groq = ["pydantic-ai-slim[groq]"]
# --- Embedding and Agent Providers --- (no rerank)
huggingface = ["pydantic-ai-slim[huggingface]"]
# ==== Vector Stores ====
in-memory = ["qdrant-client", "tokenizers"]
mistral = ["pydantic-ai-slim[mistral]"]
# OpenAI includes support for:
# Cerebras, DeekSeek, Ollama, OpenRouter, Vercel, Perplexity, Moonshot, FireworksAI,
# TogetherAI, Azure AI Foundry, Heroku, and Github Models
# which all use the OpenAI API
openai = ["pydantic-ai-slim[openai]"]
qdrant = ["qdrant-client"]
recommended = [
"fastembed; python_version < '3.14'",
"sentence-transformers",
"tokenizers",
"py-cpuinfo",
"voyageai",
"ddgs; python_version < '3.14'",
"pydantic-ai-slim[openai,anthropic,retries]",
"tavily",
]
recommended-local-only = [
"fastembed; python_version < '3.14'",
"sentence-transformers",
"tokenizers",
"ddgs; python_version < '3.14'",
"py-cpuinfo",
# openai for ollama local models
"pydantic-ai-slim[openai,retries]",
]
sentence-transformers = ["sentence-transformers", "py-cpuinfo"]
tavily = ["tavily"]
# NOTE: Why not GPU or OpenVino support for sentence-transformers?
# The underlying runtimes for these packages, when resolved against our other dependencies,
# essentially require us to choose between support for Python 3.14 and these packages.
# When python 3.14 is included, then the only compatible build results in transformers version 3.x
# Which does not have the `SparseEncoder` class required for sparse-encodings.
# We think the sparse-encoding use case is much broader than GPU or OpenVino acceleration for most users (in fact we always use sparse encodings),
# so we are leaving these out of the official optional dependencies for now.
# If you need GPU or OpenVino support, you can install these packages manually in your environment.
# sentence-transformers-gpu = [
# GPU requires additional setup
# "sentence-transformers[onnx-gpu]; python_version>='3.12' and python_version<'3.14'",
# ]
# sentence-transformers-openvino = [
# "sentence-transformers[openvino]",
# "py-cpuinfo",
# ]
voyageai = ["voyageai"]
xai = ["pydantic-ai-slim[xai]"]
[dependency-groups]
dev = [
# black is used to format generated code
"black>=26.3.1",
"ruff>=0.15.6",
"serena>=0.9.1",
"ty>=0.0.23",
"uv>=0.10.11",
]
build = ["hatchling>=1.28.0", "twine>=6.2.0", "uv-dynamic-versioning>=0.12.0"]
dev-helpers = [
"ipython>=9.11.0",
"jsonlines>=4.0.0",
"memory-profiler>=0.61.0",
"pdbpp>=0.12.1",
"pyperclip>=1.11.0",
"superclaude>=4.2.0",
]
docs = [
"griffe>=2.0.0",
"griffe-pydantic>=1.1.0",
"griffe2md>=1.5.0",
]
test = [
"dirty-equals>=0.11.0",
"hypothesis>=6.151.9",
"pytest>=9.0.2",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.0.0",
"pytest-env>=1.6.0",
"pytest-examples>=0.0.18",
"pytest-flakefinder>=1.1.0",
"pytest-mock>=3.15.1",
"pytest-report>=0.2.1",
"pytest-timeout>=2.4.0",
]
[build-system]
requires = [
"hatchling>=1.29.0",
"twine>=6.2.0",
"uv-dynamic-versioning>=0.13.0",
]
build-backend = "hatchling.build"
# TODO: Integrate hatch plugins for:
# - readme: https://github.com/hynek/hatch-fancy-pypi-readme
[tool.coverage.run]
omit = [
"scripts/*",
"mise-tasks/*",
"typings/*",
".venv/*",
"tests/*",
"vendored/*",
"src/codeweaver/__init__.py",
"src/codeweaver/**/__init__.py",
"src/codeweaver/**/types/*",
"src/codeweaver/**/types.py",
]
[tool.hatch.build.hooks.version]
additionalProperties = true
path = "src/codeweaver/_version.py"
# The reuse statements prevent REUSE from considering this snippet for license compliance, which would error
# REUSE-IgnoreStart
template = '''# SPDX-FileCopyrightText: 2025 Knitli Inc.
# SPDX-License-Identifier: MIT OR Apache-2.0
"""Version information for CodeWeaver."""
from typing import Final
__version__: Final[str] = "{version}"
__all__ = ("__version__",)
'''
# REUSE-IgnoreEnd
[tool.hatch.build.targets.wheel]
artifacts = ["*.so", "src/**", "vendored/**", "packages/**"]
[tool.hatch.build.targets.wheel.force-include]
"LICENSES" = "LICENSES"
"typings" = "typings"
"README.md" = "README.md"
"SECURITY.md" = "SECURITY.md"
"sbom.spdx" = "sbom.spdx"
"LICENSE-Apache-2.0" = "LICENSE-APACHE-2.0"
"LICENSE-MIT" = "LICENSE-MIT"
"src/codeweaver" = "codeweaver"
"packages" = "packages"
[tool.hatch.build.targets.sdist]
include = [
".gitignore",
"ARCHITECTURE.md",
"CHANGELOG.md",
"CONTRIBUTORS_LICENSE_AGREEMENT.py",
"LICENSE",
"LICENSE-APACHE-2.0",
"LICENSE-MIT",
"LICENSES",
"PRIVACY_POLICY.md",
"README.md",
"REUSE.toml",
"SECURITY.md",
"context7.json",
"context7.json.license",
"packages/**",
"pyproject.toml",
"sbom.spdx",
"schema/**",
"src/**",
"tests/**",
"typings/**",
"uv.lock",
"uv.lock.license",
"vendored/**",
]
exclude = [
".claude/**",
".roo/**",
".serena/**",
".specify/**",
".vscode/**",
"claudedocs/**",
"data/**",
"docker/**",
"docs-site/**",
"mise-tasks/**",
"overrides/**",
"plans/**",
"scripts/**",
"specs/**",
]
[tool.hatch.version]
source = "uv-dynamic-versioning"
[tool.pytest]
# tombi: format.rules.array-values-order.disabled = true
addopts = [
# While we don't chase coverage, we want to ensure a minimum bar to catch missing tests
# We can raise this over time as the project matures
"--cov-fail-under=50",
"--cov-report=html",
"--cov-report=term-missing",
"--cov-report=xml",
"--cov=codeweaver",
"--import-mode=importlib",
"--strict-config",
"--strict-markers",
# Exclude resource-intensive tests by default
# Override with: pytest -m "expensive" or pytest -m "requires_models" to run these tests
"-ra",
"-m",
"not expensive and not requires_models and not requires_gpu and not requires_api_keys",
]
filterwarnings = [
"error",
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning",
"ignore::UserWarning",
"ignore::urllib3.exceptions.SystemTimeWarning",
]
markers = [
"async_test: Asynchronous tests (in addition to pytest.mark.asyncio)",
# Performance & benchmarks
"benchmark: Performance benchmark tests",
# Configuration & environment
"config: Configuration-related tests",
# Development & debugging
"debug: Tests for debugging purposes",
"dev_only: Tests that should only run in development",
"docker: Tests that require Docker and Docker Compose (may fail in some CI environments)",
"e2e: End-to-end tests that test complete workflows",
# Feature-specific
"embeddings: Tests related to embedding functionality",
"env_vars: Tests that depend on environment variables",
"expensive: Tests taking more than 30 seconds to complete",
"external_api: Tests that interact with external APIs",
"fixtures: Tests that heavily rely on pytest fixtures",
# Stability & reliability
"flaky: Tests that may occasionally fail due to timing or external factors",
"indexing: Tests related to code indexing",
"integration: Integration tests that test component interactions",
# Platform-specific
"linux_only: Tests that only run on Linux platforms",
"macos_only: Tests that only run on macOS platforms",
"mcp: Tests related to MCP protocol functionality",
"mock_only: Tests that only use mocked dependencies",
"network: Tests that require network access",
# Test types
"parametrize: Parametrized tests with multiple test cases",
"performance: Performance-related tests",
"qdrant: Tests that require Qdrant vector database",
# External dependencies
"real_providers: Tests using actual embedding/vector store providers (not mocks)",
"requires_api_keys: Tests requiring external API credentials and authentication",
"requires_fastembed: Tests requiring fastembed package (not available on Python 3.14+)",
"requires_gpu: Tests requiring GPU hardware for execution",
"requires_models: Tests requiring ML model downloads and local model files",
"requires_voyageai: Tests requiring voyageai package (has pydantic v1 issues on Python 3.14+)",
"retry: Tests that may need retries",
"search: Tests related to search functionality",
"server: Tests related to server functionality",
"services: Tests related to services layer",
"skip_ci: Tests to skip in CI/CD environments",
"skip_on_free_threaded: Tests that should be skipped on free-threaded Python builds",
"skip_on_python_314: Tests that should be skipped on Python 3.14+ due to dependency incompatibilities",
"slow: Tests that take a significant amount of time to run",
"telemetry: Tests related to telemetry and metrics",
"timeout: Tests with specific timeout requirements",
"timing_sensitive: Tests with strict timing requirements that may be environment-dependent",
# Test categories
"unit: Unit tests that test individual components in isolation",
"validation: Validation tests that ensure system consistency",
"voyageai: Tests that require VoyageAI API access",
"windows_only: Tests that only run on Windows platforms",
]
minversion = "9.0"
python_classes = ["Test*"]
python_files = ["*_test.py", "test_*.py"]
python_functions = ["test_*"]
pythonpath = ["src"]
testpaths = ["tests"]
asyncio_mode = "auto"
timeout = "600"
timeout_method = "thread"
# Override timeout for specific markers
timeout_func_only = true # Only apply timeout to test functions, not setup/teardown
[tool.ty.environment]
python-version = "3.12"
root = ["./src", "./tests", "./scripts", "./mise-tasks", "./packages"]
python = "./.venv"
extra-paths = ["./typings"]
[tool.ty.rules]
# === Core Type Safety Rules (kept strict for src/) ===
# These remain as errors by default and will catch real bugs in production code
invalid-method-override = "ignore" # many false positives here
# === Test Framework Limitations ===
# ty doesn't understand pytest mocks/fixtures - these are inherent limitations, not real bugs
possibly-missing-attribute = "ignore" # Pytest fixtures don't have static attributes
unresolved-attribute = "warn" # Test mocks may have dynamic attributes
unknown-argument = "warn" # Pytest fixtures injected dynamically
unresolved-reference = "warn" # Test references may be dynamic
# === Type Inference Limitations ===
# ty is overly strict with Literal inference in dict lookups and dynamic patterns
invalid-argument-type = "warn" # Many false positives in capabilities dicts and code gen
missing-typed-dict-key = "warn" # Often false positive with dynamic TypedDict construction (e.g., **dict comprehension)
# === Style and Refactoring Suggestions ===
redundant-cast = "ignore" # Informational only, not bugs
# === Optional Dependencies ===
# Scripts may import optional dependencies (e.g., mkdocs_gen_files, black)
unresolved-import = "warn" # Downgrade to warn for optional dependencies
[tool.ty.src]
include = ["./src", "./tests", "./scripts", "./mise-tasks", "./packages"]
# Exclude vendored code, typings, and intentionally malformed test fixtures
exclude = ["./typings", "./tests/**/malformed.py", "./vendored"]
# === Per-Directory Overrides ===
# Apply different strictness levels: strict for src/, lenient for scripts/mise-tasks/tests
# Scripts: Code generation, build automation, documentation generation
# These often use dynamic patterns, optional dependencies, and intentional type flexibility
[[tool.ty.overrides]]
include = ["scripts/**/*.py"]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
missing-typed-dict-key = "ignore"
unresolved-import = "ignore"
invalid-argument-type = "ignore"
unresolved-reference = "ignore"
unresolved-attribute = "ignore"
# Mise Tasks: Build and diagnostic automation
# These are utility scripts with intentional dynamic behavior (e.g., monkey-patching warnings)
[[tool.ty.overrides]]
include = ["mise-tasks/**/*.py"]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
unresolved-import = "ignore"
invalid-argument-type = "ignore"
unresolved-reference = "ignore"
# Tests: May use pytest fixtures, mocks, and test-specific patterns
# Also may not have test dependencies installed when running ty in dev environment
# Tests can be less exact per the project requirements - focus on src/ strictness
[[tool.ty.overrides]]
include = ["tests/**/*.py"]
[tool.ty.overrides.rules]
unresolved-import = "ignore" # pytest and other test dependencies may not be installed
unknown-argument = "ignore" # pytest fixtures inject arguments dynamically
unresolved-reference = "ignore" # test fixtures and dynamic test patterns
unresolved-attribute = "ignore" # mocks and fixtures have dynamic attributes
not-subscriptable = "ignore" # Often false positive after pytest assertions
unsupported-operator = "warn" # Type narrowing after assertions not always understood
missing-argument = "warn" # Dynamic test patterns and fixtures
too-many-positional-arguments = "warn" # Dynamic function calls in tests
invalid-assignment = "ignore" # Test setup patterns
invalid-argument-type = "ignore" # Test mocks and fixtures may have dynamic types
[[tool.ty.overrides]]
include = ["src/codeweaver/core/statistics.py"]
[tool.ty.overrides.rules]
unresolved-attribute = "ignore"
invalid-assignment = "ignore"
invalid-argument-type = "ignore"
invalid-return-type = "ignore"
# Test Fixtures: Intentionally malformed or edge-case test data
# These may have type errors by design to test error handling
[[tool.ty.overrides]]
include = ["tests/fixtures/**/*.py", "tests/unit/engine/test_failover.py"]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
invalid-argument-type = "ignore"
unresolved-reference = "ignore"
# Specific File Overrides
# These files have known type issues that are either false positives or low priority to fix
[[tool.ty.overrides]]
# All __init__.py files' lazy import patterns cause false positives
include = [
"src/codeweaver/__init__.py",
"src/codeweaver/**/__init__.py",
"src/codeweaver/*/__init__.py",
"src/codeweaver/*/*/__init__.py",
"src/codeweaver/*/*/*/__init__.py",
"src/codeweaver/*/*/*/*/__init__.py",
"packages/*/__init__.py",
"packages/*/*/__init__.py",
"packages/*/*/*/__init__.py",
"packages/*/*/*/*/__init__.py",
# there's a similar issue in some of the embedding providers
"src/codeweaver/providers/embedding/providers/bedrock.py",
"src/codeweaver/providers/embedding/providers/cohere.py",
"src/codeweaver/providers/embedding/providers/google.py",
"src/codeweaver/providers/config/profiles.py"
]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
invalid-argument-type = "ignore"
unresolved-attribute = "ignore"
[[tool.ty.overrides]]
include = ["src/codeweaver/providers/vector_stores/qdrant_base.py"]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
[[tool.ty.overrides]]
include = ["scripts/build/generate-mcp-server-json.py"]
[tool.ty.overrides.rules]
unknown-argument = "ignore"
[[tool.ty.overrides]]
include = [
"src/codeweaver/providers/config/categories/embedding.py",
"src/codeweaver/providers/config/sdk/embedding.py"
]
[tool.ty.overrides.rules]
unresolved-attribute = "ignore"
invalid-assignment = "ignore"
call-top-callable = "ignore"
unsupported-operator = "ignore"
missing-typed-dict-key = "ignore"
[[tool.ty.overrides]]
include = [
"src/codeweaver/providers/vector_stores/qdrant_base.py",
"src/codeweaver/providers/data/providers.py",
"src/codeweaver/providers/config/sdk/embedding.py",
"src/codeweaver/providers/config/sdk/reranking.py",
"src/codeweaver/providers/config/categories/embedding.py",
"src/codeweaver/providers/config/categories/vector_store.py",
"src/codeweaver/providers/data/exa.py",
"src/codeweaver/*/config/*settings.py"
]
[tool.ty.overrides.rules]
invalid-argument-type = "ignore"
[[tool.ty.overrides]]
include = ["src/codeweaver/core/types/aliases.py"]
[tool.ty.overrides.rules]
invalid-newtype = "ignore"
[[tool.ty.overrides]]
include = [
"src/codeweaver/providers/embedding/providers/*.py",
"src/codeweaver/providers/reranking/providers/*.py",
"src/codeweaver/providers/data/*.py",
"src/codeweaver/engine/services/config_analyzer.py",
"src/codeweaver/providers/vector_stores/inmemory.py",
]
[tool.ty.overrides.rules]
unresolved-attribute = "ignore"
[[tool.ty.overrides]]
include = [
"src/codeweaver/*/dependencies.py",
"src/codeweaver/*/dependencies/*.py"
]
# there's an issue with type checkers resolving through the dependency_provider decorators and the dynamic provider registry, which causes false positives in these files
[tool.ty.overrides.rules]
call-non-callable = "ignore"
invalid-await = "ignore"
invalid-argument-type = "ignore"
invalid-return-type = "ignore"
unresolved-attribute = "ignore"
[[tool.ty.overrides]]
include = ["src/codeweaver/core/types/service_cards.py"]
[tool.ty.overrides.rules]
invalid-argument-type = "ignore"
invalid-return-type = "ignore"
unsupported-operator = "ignore"
no-matching-overload = "ignore"
[[tool.ty.overrides]]
include = [
"src/codeweaver/__init__.py",
"src/codeweaver/semantic/classifications.py"
]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
[[tool.ty.overrides]]
include = ["src/codeweaver/core/di/container.py"]
[tool.ty.overrides.rules]
unresolved-attribute = "ignore"
[[tool.ty.overrides]]
include = ["src/codeweaver/semantic/classifier.py"]
[tool.ty.overrides.rules]
missing-argument = "ignore"
[[tool.ty.overrides]]
include = ["src/codeweaver/providers/config/sdk/embedding.py"]
[tool.ty.overrides.rules]
invalid-argument-type = "ignore"
call-non-callable = "ignore"
invalid-return-type = "ignore"
[tool.uv]
cache-keys = [
{ file = "uv.lock" },
{ file = "pyproject.toml" },
{ dir = "src/codeweaver" },
{ dir = "tests" },
{ dir = "packages" },
]
conflicts = [
[
{ extra = "full-gpu" },
{ extra = "full" },
],
[
{ extra = "full-gpu" },
{ package = "fastembed" },
],
[
{ extra = "full" },
{ package = "fastembed-gpu" },
],
[
{ extra = "gpu-support" },
{ package = "fastembed" },
],
[
{ package = "fastembed" },
{ package = "fastembed-gpu" },
],
]
preview = true
[tool.uv.workspace]
members = ["packages/*"]
[tool.uv.sources]
code-weaver-daemon = { workspace = true }
code-weaver-tokenizers = { workspace = true }
boto3-types = { path = "./typings/boto3_types/__init__.pyi" }
[tool.uv-dynamic-versioning]
vcs = "git"
style = "pep440"
bump = true
dirty = false # Disabled .dirty suffix to maintain PEP 440 compliance
# tag-branch = "main" # Commented out to allow building on feature branches
commit-prefix = "g"