-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
337 lines (297 loc) · 10 KB
/
pyproject.toml
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
# This file defines the project's build configuration, dependencies, and development tools.
# Version numbers are managed through CI/CD - do not modify them manually.
[build-system]
# Specifies the requirements and backend used to build the package
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
# Core project metadata and package information
name = "llamahome"
version = "0.1.0"
description = "A secure and efficient home for your LLMs"
readme = "README.md"
requires-python = ">=3.11"
license = {file = "LICENSE"}
authors = [
{name = "Zach Shallbetter", email = "[email protected]"},
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
# Production Dependencies
# These are required for the package to function in production
dependencies = [
# Machine Learning & Deep Learning Libraries
# Core frameworks for model training and inference
"torch>=2.0.0",
"torchvision>=0.15.0",
"torchaudio>=2.0.0",
"transformers>=4.30.0",
"accelerate>=0.20.3",
"bitsandbytes>=0.41.1", # Quantization and optimization
"optimum>=1.13.2", # Hardware-specific optimizations
"tokenizers>=0.13.3", # Fast tokenization
"sentencepiece>=0.1.99", # Subword tokenization
"sacremoses>=0.0.53", # Text preprocessing
"peft>=0.14.0", # Parameter-Efficient Fine-Tuning
# API & Server Components
# Required for serving models and handling requests
"fastapi>=0.100.0", # Modern web framework
"uvicorn>=0.22.0", # ASGI server
"starlette>=0.27.0", # Web toolkit
"python-multipart>=0.0.6", # File upload handling
"websockets>=11.0.3", # Real-time communication
"PyJWT>=2.7.0", # Authentication
"httpx>=0.24.1", # HTTP client
"ratelimit>=2.2.1", # Request rate limiting
# Configuration & Environment Management
"python-dotenv>=1.0.0", # Environment variable management
"toml>=0.10.2", # Configuration file parsing
"pydantic>=2.0.0,<3.0.0", # Data validation
# System Monitoring & Metrics
"psutil>=5.9.6", # System resource monitoring
"prometheus-client>=0.17.0", # Metrics collection
# File & Text Processing Utilities
"PyMuPDF>=1.25.2", # PDF processing
"aiofiles>=23.1.0", # Async file operations
"nltk>=3.9.1", # Natural language processing
"regex>=2023.0.0", # Enhanced regular expressions
# Graphical User Interface
"PyQt6>=6.8.0", # GUI framework
"PyQt6-Qt6>=6.8.0", # Qt bindings
"PyQt6-sip>=13.6.0", # Python/C++ bindings
]
[project.optional-dependencies]
# Development Tools and Utilities
# Not required for production, but needed for development
dev = [
# Testing Framework and Plugins
"pytest>=7.4.0", # Testing framework
"pytest-asyncio>=0.21.0", # Async test support
"pytest-cov>=4.1.0", # Coverage reporting
"pytest-qt>=4.2.0", # Qt testing
"pytest-mock>=3.11.1", # Mocking support
"pytest-timeout>=2.1.0", # Test timeouts
"pytest-xdist>=3.3.1", # Parallel testing
# Code Quality and Style Tools
"black>=23.3.0", # Code formatting
"isort>=5.12.0", # Import sorting
"mypy>=1.4.1", # Static type checking
"ruff>=0.0.280", # Fast linter
"bandit>=1.7.5", # Security linting
"mypy-extensions>=0.5.1", # Type system extensions
# Type Stubs for Static Analysis
"types-toml>=0.10.8",
"types-psutil>=5.9.5",
"types-PyJWT>=1.7.1",
"types-python-dateutil>=2.8.19",
"types-requests>=2.31.0",
"types-setuptools>=68.0.0",
"types-aiofiles>=23.1.0.1",
# Development and Testing Utilities
"faker>=19.3.0", # Test data generation
"freezegun>=1.2.2", # Time freezing for tests
"responses>=0.23.3", # HTTP mocking
"coverage>=7.3.0", # Code coverage
"rich>=13.5.2", # Rich terminal output
]
# Testing-only Dependencies
# Subset of dev dependencies needed just for running tests
test = [
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.1.0",
"pytest-qt>=4.2.0",
"pytest-mock>=3.11.1",
"pytest-timeout>=2.1.0",
"pytest-xdist>=3.3.1",
]
# Platform-Specific Optimizations
# Dependencies that are only installed on specific operating systems
platform_specific = [
"xformers>=0.0.29.post1; platform_system == 'Linux' and python_version >= '3.9'", # Memory-efficient attention
"triton>=2.0.0; platform_system == 'Linux'", # GPU optimization
"pywin32>=306.0; sys_platform == 'win32'", # Windows-specific features
"pyobjc-framework-Cocoa>=9.2; sys_platform == 'darwin'", # macOS-specific features
]
[tool.setuptools]
# Package Discovery and Build Configuration
[tool.setuptools.packages.find]
where = ["src"] # Look for packages in src directory
include = ["*"] # Include all packages
exclude = ["tests*", "docs*"] # Exclude test and documentation files
# Code Style and Formatting Configuration
[tool.black]
# Standard Python code formatting settings
line-length = 88
target-version = ["py311"]
include = '\.pyi?$'
[tool.isort]
# Import statement organization settings
profile = "black" # Compatibility with black
multi_line_output = 3
line-length = 88
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
known_first_party = ["src"]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
skip = [
".venv",
"build",
"dist",
".data",
"docs",
"Makefile",
"tests",
"config",
"outputs",
"logs",
"notebooks"
]
# Code Quality and Linting
[tool.ruff]
# Fast Python linter configuration
line-length = 88
target-version = "py311"
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes - dead code and undefined names
"I", # isort - import sorting
"C", # flake8-comprehensions - list/dict/set comprehension improvements
"B", # flake8-bugbear - bug risk detection
"UP", # pyupgrade - modernize Python code
]
ignore = [
"E501", # line too long - handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex - handled by cognitive complexity checks
]
[tool.ruff.per-file-ignores]
"tests/*" = ["E501"] # Allow long lines in tests
[tool.ruff.isort]
known-first-party = ["src"]
# Type Checking Configuration
[tool.mypy]
# Static type checking settings
python_version = "3.11"
cache_dir = ".cache/project/mypy" # Store type checking cache in project's cache directory
warn_return_any = true # Warn about returning Any type
warn_unused_configs = true # Warn about unused configurations
disallow_untyped_defs = true # Require type annotations for functions
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
ignore_missing_imports = false
[[tool.mypy.overrides]]
# Pydantic-specific type checking settings
module = "pydantic.*"
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[[tool.mypy.overrides]]
# Type checking overrides for external packages
module = [
# ML/DL Libraries
"torch.*",
"transformers.*",
# Testing
"pytest.*",
"setuptools.*",
# System & Monitoring
"psutil.*",
"prometheus_client.*",
# Web & API
"ratelimit.*",
"jwt.*",
"fastapi.*",
"fastapi.testclient.*",
"httpx.*",
"uvicorn.*",
# UI & File handling
"PyQt6.*",
"PyQt6.QtWidgets.*",
"PyQt6.QtCore.*",
"PyQt6.QtGui.*",
"fitz.*",
"aiofiles.*"
]
ignore_missing_imports = true
# Testing Configuration
[tool.pytest.ini_options]
# Test discovery and execution settings
minversion = "7.0"
addopts = "-ra -q --strict-markers --strict-config"
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"slow: marks tests that take longer than average to complete",
"integration: marks tests that check component interactions",
"unit: marks tests that check individual components",
"security: marks tests that verify security features",
]
# Code Coverage Settings
[tool.coverage.run]
# Configuration for code coverage measurement
branch = true # Track branch coverage
source = ["src"] # Only measure source code
[tool.coverage.report]
# Coverage report configuration
exclude_lines = [
"pragma: no cover", # Explicitly exclude lines
"def __repr__", # Skip representation methods
"raise NotImplementedError",
"if __name__ == .__main__.:",
"pass",
"raise AssertionError",
"raise ImportError",
]
# Security Analysis Configuration
[bandit]
# Security linter settings
exclude_dirs = [
"tests",
"venv",
".env",
".venv",
"examples",
"docs",
]
skips = ["B101"] # Skip assert checks in test files
[bandit.assert_used]
skips = ["*/test_*.py"]
# Security Policy Exceptions
[bandit.B301]
exclude_dirs = ["src/core/utils/io.py"] # Allow pickle in safe_load_torch with verification
[bandit.B403]
exclude_dirs = ["src/core/utils/io.py"] # Allow import of pickle in safe contexts
[bandit.B404]
exclude_dirs = ["scripts/install.py"] # Allow subprocess in install scripts
[bandit.B603]
exclude_dirs = ["scripts/install.py"] # Allow subprocess calls in install scripts
[bandit.B607]
exclude_dirs = ["scripts/install.py"] # Allow PATH searches in install scripts
[bandit.formatters]
output = "screen" # Output format for security reports
[bandit.config]
recursive = true # Scan directories recursively
aggregate = true # Aggregate security issues
number = 3 # Number of issues to show
level = "HIGH" # Minimum severity level
[bandit.profiles]
test = "all" # Security test profile