-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
406 lines (376 loc) · 10.4 KB
/
pyproject.toml
File metadata and controls
406 lines (376 loc) · 10.4 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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "codebank"
version = "1.0.0"
description = "Revolutionary Edge AI code generation system with 1,000+ production-ready snippets"
readme = "README.md"
requires-python = ">=3.9"
license = { text = "MIT" }
authors = [
{ name = "CodeSnippetBank Team", email = "team@codebank.ai" },
]
keywords = [
"code-snippets",
"edge-ai",
"machine-learning",
"computer-vision",
"nlp",
"code-generation",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Code Generators",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
]
dependencies = [
"numpy>=1.24.0",
"scikit-learn>=1.3.0",
"nltk>=3.8.0",
"Pillow>=10.0.0",
]
[project.optional-dependencies]
dev = [
"ruff>=0.8.0",
"mypy>=1.13.0",
"pytest>=8.3.0",
"pytest-cov>=6.0.0",
"pytest-asyncio>=0.24.0",
"pytest-xdist>=3.6.0",
"pre-commit>=4.0.0",
"hatch>=1.13.0",
"types-Pillow>=10.0.0",
]
edge = [
"micropython-unix-stubs>=1.20",
]
[project.urls]
Homepage = "https://github.com/codebase/codebank"
Documentation = "https://github.com/codebase/codebank#readme"
Repository = "https://github.com/codebase/codebank"
Issues = "https://github.com/codebase/codebank/issues"
[project.scripts]
tissue = "tools.tissue_cli:main"
codebank = "tools.tissue_cli:main"
[tool.hatch.build.targets.wheel]
packages = [
"ai",
"api",
"converters",
"core",
"demos",
"framework",
"marketing",
"research",
"scripts",
"snippets",
"tissues",
"tools",
]
# ==============================================================================
# RUFF CONFIGURATION - Modern linter + formatter (replaces black, flake8, isort)
# ==============================================================================
[tool.ruff]
target-version = "py39"
line-length = 100
indent-width = 4
# Enable preview features for cutting-edge rules
preview = true
# Exclude common directories
exclude = [
".git",
".mypy_cache",
".pytest_cache",
".ruff_cache",
".venv",
"venv",
"__pycache__",
"build",
"dist",
"*.egg-info",
]
[tool.ruff.lint]
# Enable comprehensive rule sets
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"YTT", # flake8-2020
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"S", # flake8-bandit (security)
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"EM", # flake8-errmsg
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"INT", # flake8-gettext
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"TD", # flake8-todos
"FIX", # flake8-fixme
"ERA", # eradicate
"PD", # pandas-vet
"PGH", # pygrep-hooks
"PL", # pylint
"TRY", # tryceratops
"FLY", # flynt
"NPY", # numpy-specific rules
"PERF", # perflint
"FURB", # refurb
"RUF", # ruff-specific rules
]
# Ignore specific rules that may be too strict for this codebase
ignore = [
"ANN101", # Missing type annotation for self
"ANN102", # Missing type annotation for cls
"ANN401", # Dynamically typed expressions (Any) are disallowed
"COM812", # Missing trailing comma (conflicts with formatter)
"ISC001", # Single line implicit string concatenation (conflicts with formatter)
"D", # pydocstyle (enable if you want strict docstring enforcement)
"TD002", # Missing TODO author
"TD003", # Missing TODO link
"FIX002", # Line contains TODO
"S101", # Use of assert (common in tests)
"PLR0913", # Too many arguments
"PLR2004", # Magic value used in comparison
]
# Allow fix for all enabled rules (when `--fix` is provided)
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.per-file-ignores]
# Ignore specific rules in test files
"tests/**/*.py" = [
"S101", # Use of assert
"ARG001", # Unused function argument
"PLR2004", # Magic value comparison
"ANN001", # Missing type annotation
"ANN201", # Missing return type annotation
]
# Ignore import errors in __init__.py files
"__init__.py" = [
"F401", # Unused import
"E402", # Module level import not at top
]
# Ignore annotation requirements in setup.py
"setup.py" = [
"ANN", # Type annotations
]
[tool.ruff.lint.isort]
known-first-party = ["codebank", "ai", "api", "converters", "core", "demos", "framework", "marketing", "research", "scripts", "snippets", "tissues", "tools"]
force-sort-within-sections = true
split-on-trailing-comma = true
[tool.ruff.lint.mccabe]
# Maximum cyclomatic complexity
max-complexity = 10
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pylint]
max-args = 8
max-branches = 15
max-returns = 6
max-statements = 50
[tool.ruff.format]
# Use double quotes for strings
quote-style = "double"
# Indent with spaces
indent-style = "space"
# Respect magic trailing commas
skip-magic-trailing-comma = false
# Auto-detect line endings
line-ending = "auto"
# Enable preview style formatting
preview = true
# ==============================================================================
# MYPY CONFIGURATION - Strict type checking
# ==============================================================================
[tool.mypy]
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
strict_optional = true
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
no_implicit_reexport = true
show_error_codes = true
show_column_numbers = true
pretty = true
# Ignore missing imports for third-party libraries without stubs
[[tool.mypy.overrides]]
module = [
"nltk.*",
"sklearn.*",
]
ignore_missing_imports = true
# Relax rules for test files
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
# ==============================================================================
# PYTEST CONFIGURATION
# ==============================================================================
[tool.pytest.ini_options]
minversion = "8.0"
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--strict-markers",
"--strict-config",
"--verbose",
"--tb=short",
"--cov=.",
"--cov-report=term-missing:skip-covered",
"--cov-report=html",
"--cov-report=xml",
"--cov-fail-under=80",
"-ra",
"--color=yes",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"e2e: marks tests as end-to-end tests",
"smoke: marks tests as smoke tests",
"edge: marks tests requiring edge AI dependencies",
]
filterwarnings = [
"error",
"ignore::UserWarning",
"ignore::DeprecationWarning",
]
asyncio_mode = "auto"
# Run tests in parallel (requires pytest-xdist)
# Uncomment to enable: addopts = [..., "-n", "auto"]
# ==============================================================================
# COVERAGE CONFIGURATION
# ==============================================================================
[tool.coverage.run]
source = ["."]
omit = [
"tests/*",
"setup.py",
"*/__pycache__/*",
"*/.venv/*",
"*/venv/*",
"*/build/*",
"*/dist/*",
"*/.pytest_cache/*",
"*/.mypy_cache/*",
"*/.ruff_cache/*",
"*/migrations/*",
"*/__init__.py",
]
branch = true
parallel = true
context = "dynamic-contexts"
[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
skip_empty = true
sort = "Cover"
exclude_lines = [
"pragma: no cover",
"def __repr__",
"def __str__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
"@overload",
]
[tool.coverage.html]
directory = "htmlcov"
[tool.coverage.xml]
output = "coverage.xml"
# ==============================================================================
# HATCH ENVIRONMENTS
# ==============================================================================
[tool.hatch.envs.default]
dependencies = [
"ruff>=0.8.0",
"mypy>=1.13.0",
"pytest>=8.3.0",
"pytest-cov>=6.0.0",
"pytest-asyncio>=0.24.0",
"pytest-xdist>=3.6.0",
]
[tool.hatch.envs.default.scripts]
test = "pytest {args:tests}"
test-cov = "pytest --cov {args:tests}"
cov-report = [
"pytest --cov --cov-report=html",
"python -m webbrowser htmlcov/index.html",
]
lint = "ruff check ."
format = "ruff format ."
format-check = "ruff format --check ."
typecheck = "mypy ."
all = [
"format",
"lint",
"typecheck",
"test-cov",
]
[tool.hatch.envs.test]
dependencies = [
"pytest>=8.3.0",
"pytest-cov>=6.0.0",
"pytest-asyncio>=0.24.0",
"pytest-xdist>=3.6.0",
]
[[tool.hatch.envs.test.matrix]]
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]