-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
1021 lines (945 loc) · 37.6 KB
/
pyproject.toml
File metadata and controls
1021 lines (945 loc) · 37.6 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
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#: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 is dynamic; see [tool.hatch.metadata.hooks.fancy-pypi-readme] and the
# `dynamic` declaration further down in this [project] table.
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 :: 4 - Beta",
"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",
]
# `dependencies` and `optional-dependencies` are populated at build time by
# the uv-dynamic-versioning metadata hook (see
# [tool.hatch.metadata.hooks.uv-dynamic-versioning] below). Templating only
# the workspace sibling lines (`code-weaver-daemon`, `code-weaver-tokenizers`)
# with `=={{ version }}` keeps every published wheel pinned to the same VCS-
# derived version with zero hand-maintained version strings.
dynamic = ["dependencies", "optional-dependencies", "readme", "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] is populated dynamically — see
# [tool.hatch.metadata.hooks.uv-dynamic-versioning.optional-dependencies] below.
[dependency-groups]
# `dev` is the composed contributor group: lint + test + helpers + a couple of dev-only tools.
# Use `uv sync --group dev` to get everything needed for local development.
dev = [
"serena>=0.9.1",
"uv>=0.11.6",
{ include-group = "dev-helpers" },
{ include-group = "lint" },
{ include-group = "test" },
]
build = [
"hatch-fancy-pypi-readme>=25.1.0",
"hatchling>=1.29.0",
"uv-dynamic-versioning>=0.14.0",
{ include-group = "docs" },
]
dev-helpers = [
"ipython>=9.12.0",
"jsonlines>=4.0.0",
"memory-profiler>=0.61.0",
"pdbpp>=0.12.1",
"pyperclip>=1.11.0",
"superclaude>=4.3.0",
]
docs = [
"griffe>=2.0.2",
"griffe-pydantic>=1.3.1",
"griffe2md>=1.5.0",
]
# Linting/formatting/typecheck — the minimum a contributor needs to pass `mise run check`.
lint = [
# black is used to format generated code
"black>=26.3.1",
"ruff>=0.15.10",
"ty>=0.0.29",
]
# Baseline test dependencies. Workspace members inherit this group via `uv sync --group test`
# from the workspace root, so daemon/tokenizers no longer redeclare pytest et al.
test = [
"dirty-equals>=0.11.0",
"hypothesis>=6.151.12",
"pytest>=9.0.3",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.1.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 = [
"hatch-fancy-pypi-readme>=25.1.0",
"hatchling>=1.29.0",
"uv-dynamic-versioning>=0.14.0",
]
build-backend = "hatchling.build"
[tool.coverage.run]
concurrency = ["multiprocessing", "thread"]
patch = ["_exit", "subprocess"]
relative_files = true
parallel = true
omit = [
"*/scripts/*",
"*/mise-tasks/*",
"*/tests/*",
"*/__init__.py",
"*/__main__.py",
"*/_version.py",
]
[tool.coverage.report]
skip_empty = true
sort = "-cover"
omit = [
"*/scripts/*",
"*/mise-tasks/*",
"*/tests/*",
"*/__init__.py",
"*/__main__.py",
"*/_version.py",
]
exclude_also = [
'@(abc\.)?abstractmethod',
'@(dataclasses\.)?dataclass',
'@(typing\.)?overload',
'@(typing\.)?override',
'@(typing\.)?runtime_checkable',
'@(typing\.)?type_check_only',
'[ \t]+?pass\n',
'class .*\bProtocol\):',
"def __repr__",
"if __name__ == .__main__.:",
"if 0:",
"if self.debug:",
"if settings.DEBUG",
"if TYPE_CHECKING:",
"no cover: start(?s:.)*?no cover: stop",
"raise AssertionError",
"raise NotImplementedError",
'\s*def .*\)\s*->\s*TypeIs\[.+\]:[\n\sA-za-z0-9_-]+?\n\n',
# bracket/syntax only lines:
'''\s*[\[\]{}()]+\s*''',
]
# --------------------------------------------------------------------------- #
# README rewriting for PyPI
# --------------------------------------------------------------------------- #
# PyPI renders the README in isolation, so any relative links/images in
# README.md break (e.g. the logo and any in-repo doc links). hatch-fancy-pypi-
# readme rewrites those relative paths to absolute GitHub URLs at build time,
# while leaving README.md itself untouched for GitHub rendering.
#
# Images use raw.githubusercontent.com so they render inline; doc links use
# github.com/blob/main so they navigate to the rendered file. Both are pinned
# to `main` rather than the release tag — slightly less precise but avoids a
# circular dep between version resolution and build metadata.
#
# Docs: https://github.com/hynek/hatch-fancy-pypi-readme
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
# 1. <img src="relative/path"> → raw.githubusercontent absolute URL
# Matches any HTML <img> whose src is not already absolute (http(s)/data:/#).
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '(<img\b[^>]*?\bsrc=")(?!https?://|data:|#)([^"]+)(")'
replacement = '\g<1>https://raw.githubusercontent.com/knitli/codeweaver/main/\g<2>\g<3>'
# 2. Reference-style link defs: `[label]: <relative/path>` or `[label]: relative/path`
# Rewrites only the relative ones; leaves http(s)/mailto/anchor targets alone.
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '(?m)^(\[[^\]]+\]:\s*)<(?!https?://|mailto:|#)([^>]+)>'
replacement = '\g<1><https://github.com/knitli/codeweaver/blob/main/\g<2>>'
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '(?m)^(\[[^\]]+\]:\s*)(?!<|https?://|mailto:|#)(\S+)'
replacement = '\g<1>https://github.com/knitli/codeweaver/blob/main/\g<2>'
# 3. Inline markdown links `](relative/path)` (defensive — README currently
# uses reference style, but inline links may sneak in later).
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '\]\((?!https?://|mailto:|#)([^)]+)\)'
replacement = '](https://github.com/knitli/codeweaver/blob/main/\g<1>)'
# =============================================================================
# uv-dynamic-versioning metadata hook
# =============================================================================
# This block is the SINGLE SOURCE OF TRUTH for runtime dependencies and
# optional-dependencies. At wheel build time, hatch invokes the
# uv-dynamic-versioning metadata hook, which:
#
# 1. Resolves the project version from git via [tool.uv-dynamic-versioning]
# 2. Substitutes `{{ version }}` (and other Jinja vars) into any line below
# 3. Writes the rendered lists into the wheel METADATA
#
# Only the workspace sibling lines (`code-weaver-daemon`, `code-weaver-tokenizers`)
# are templated. Every other line is plain PEP 508 and passes through unchanged.
# In dev, `[tool.uv.sources]` further down still routes those names to the
# workspace, so editable installs are unaffected.
#
[tool.hatch.metadata.hooks.uv-dynamic-versioning]
# 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; python_version < '3.13'",
"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=={{ version }}",
# numpy needed for all embedding providers
"numpy>=2.4.4",
# lazy import handling; spun off from core/utils/lazy_importer into its own package
"lateimport>=1.0.1",
# 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.1",
"rich>=14.3.3",
# * ================ Provider Clients ==================*
# Provider SDK pins live in their corresponding optional-dependency extras
# (bedrock, cohere, google, huggingface, mistral, openai). They are pinned
# there — not here — because their ClientOptions subclasses only need to
# resolve when the provider itself is selected, not for a base install.
#
# Base install ships two clients unconditionally: qdrant (vector store) and
# pydantic-ai-slim (agent plumbing). Default local embedder is version-gated
# so exactly one resolves per interpreter:
# - fastembed on 3.12/3.13 (blocked on 3.14 by py-rust-stemmers)
# - sentence-transformers on 3.14 (no fastembed wheel)
# Default remote embedder is voyageai on 3.12/3.13 (upstream caps at <3.14).
"qdrant-client==1.17.1",
"pydantic-ai-slim>=1.68.0",
"fastembed==0.7.4; python_version < '3.14'",
"sentence-transformers==5.2.0; python_version >= '3.14'",
# voyageai declares requires_python: <3.14 — uv respects this automatically,
# but pip does not filter by requires_python during install, so we must gate it here.
"voyageai==0.3.7; python_version < '3.14'",
# * ================ 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=={{ version }}",
# 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>=3.0.0,<4.0.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",
]
[tool.hatch.metadata.hooks.uv-dynamic-versioning.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 carries the raw boto3 pin because our BedrockClientOptions subclass
# depends on boto3's ClientOptions internals staying byte-compatible.
bedrock = ["boto3==1.42.19", "pydantic-ai-slim[bedrock]"]
cohere = ["cohere==5.20.7", "pydantic-ai-slim[cohere]"]
# ==== Data Sources ====
duckduckgo = ["ddgs"]
exa = ["exa-py"]
# fastembed blocked on 3.14 by py-rust-stemmers (no cp314/cp314t wheels)
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"]
# Internal extra: the lines shared by both `full` and `full-gpu`. Defined once,
# referenced by both bundles via PEP 621 self-reference. Bumping any version
# here updates both bundles atomically.
#
# Note on the markered pydantic-settings pair:
# azure-key-vault → azure-identity → cryptography → cffi. On 3.13t
# (free-threaded), cryptography has no pre-built wheel and building from
# source requires Rust + cffi<2.0. No PEP 508 marker distinguishes 3.13t
# from 3.13, so we exclude azure-key-vault on all 3.13. Standard 3.13 users
# can install azure-identity manually. The _special-dependencies task
# handles this for non-free-threaded 3.13 builds.
# permit-fastmcp depends on cffi — same 3.13t issue as azure-key-vault.
common-extras = [
# Self-reference the per-provider extras so `full` users get the pinned raw
# SDKs (boto3, cohere, google-genai, huggingface-hub, mistralai, openai)
# plus the pydantic-ai-slim adapters. Each provider's pin lives exactly once
# in its own extra.
"code-weaver[anthropic,bedrock,cohere,google,groq,huggingface,mistral,openai,xai]=={{ version }}",
"ddgs",
"eunomia-mcp",
"exa-py",
"pydantic-ai-slim[retries]",
"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; python_version != '3.13'",
"sentence-transformers",
"tavily-python",
]
full = ["code-weaver[common-extras]=={{ version }}"]
# full-gpu adds fastembed-gpu, which is mutually exclusive with the base
# `fastembed` dep via [tool.uv].conflicts — uv resolves only one.
full-gpu = [
"code-weaver[common-extras]=={{ version }}",
"fastembed-gpu; python_version < '3.14'",
# see note below about why sentence-transformers[onnx-gpu] is commented out
# "sentence-transformers[onnx-gpu]; python_version>='3.12' and python_version<'3.14'",
]
gcp-secret-manager = ["pydantic-settings[yaml,toml,gcp-secret-manager]"]
google = ["google-genai==1.56.0", "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 = ["huggingface-hub>=1.0.0", "pydantic-ai-slim[huggingface]"]
# ==== Vector Stores ====
in-memory = ["qdrant-client", "tokenizers"]
mistral = ["mistralai==1.10.0", "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 = ["openai==2.28.0", "pydantic-ai-slim[openai]"]
qdrant = ["qdrant-client"]
recommended = [
"fastembed; python_version < '3.14'",
"sentence-transformers",
"tokenizers",
"py-cpuinfo",
"voyageai; python_version < '3.14'",
"tavily",
]
recommended-local-only = [
"fastembed; python_version < '3.14'",
"sentence-transformers",
"tokenizers",
"ddgs",
"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 self-excludes on 3.14+ via its own requires_python: <3.14,
# but pip doesn't filter on requires_python during install, so we gate here too.
voyageai = ["voyageai; python_version < '3.14'"]
xai = ["pydantic-ai-slim[xai]"]
[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",
"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/latest/*",
"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",
"install_smoke: Minimal smoke tests that must pass on any valid install profile (base, recommended, full, full-gpu, etc.) — used by the install-profile matrix workflow to validate wheel installs across python × extras combinations without requiring the full test suite's optional dependencies",
"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 (upstream requires_python caps at <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"
# Apply timeout to entire test lifecycle (setup + call + teardown) so that
# fixture hangs (e.g. model loading, indexing) are caught instead of running
# until the GHA job limit. Previously `timeout_func_only = true` left
# fixtures uncovered, causing Python 3.12 CI to hang indefinitely in the
# `indexed_test_project` fixture during `index_project()`.
timeout_func_only = false
[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/config/clients/multi.py",
"src/codeweaver/providers/vector_stores/qdrant_base.py",
"src/codeweaver/providers/config/categories/embedding.py",
"src/codeweaver/providers/config/categories/sparse_embedding.py",
]
# Both files use `try: import X; except ImportError: X = Any` fallbacks to
# gate optional dependencies (fastembed, torch, sentence-transformers, etc.)
# Ty flags the `X = Any` reassignment as invalid because it narrows the
# previously-declared type. The pattern is intentional and correct — it lets
# pydantic models with `field: X | None = None` work whether or not the
# optional package is installed.
[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"
# fastembed.py has two pre-existing ty issues that surface whenever any
# line in the file is touched:
#
# invalid-return-type (sparse _embed_documents/_embed_query): ty can't
# narrow `loop.run_in_executor(None, lambda: self._process_output(...))`
# through the executor/lambda hop into the declared
# `list[CodeWeaverSparseEmbedding]` return type. The conversion happens
# inside `_process_output` but ty's flow analysis doesn't trace it.
#
# invalid-assignment (FastEmbedSparseProvider.client default): the default
# value `_SparseTextEmbedding` is read from a TYPE_CHECKING-guarded
# lateimport that resolves to `Unknown | None` statically; the real
# value is set via pydantic default_factory at runtime. ty sees the
# static Unknown and flags the class-level default.
#
# Both are pre-existing false positives. Scoping the suppressions to this
# one file keeps the rest of the providers strict.
[[tool.ty.overrides]]
include = ["src/codeweaver/providers/embedding/providers/fastembed.py"]
[tool.ty.overrides.rules]
invalid-return-type = "ignore"
invalid-assignment = "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/providers/embedding/capabilities/*.py"]
[tool.ty.overrides.rules]
missing-typed-dict-key = "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
override-dependencies = [
# cffi 2.0 segfaults on free-threaded 3.13 (sync primitive differences vs 3.14t).
# No PEP 508 marker distinguishes 3.13t from 3.13, so this applies to both —
# harmless on standard 3.13 since cryptography has pre-built wheels there.
"cffi==1.17.1; python_version == '3.13'",
# Pin cryptography to 45.0.7 on 3.13: its build-system.requires uses cffi>=1.12,
# compatible with our cffi pin. cryptography 46+ requires cffi>=2.0.0 to build,
# which conflicts with the cffi<2.0 build constraint needed for 3.13t.
# On 3.14+, cryptography 46+ resolves naturally (has pre-built wheels + cffi 2.0 works).
"cryptography==45.0.7; python_version == '3.13'",
]
prerelease = "allow"