-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
203 lines (182 loc) · 4.38 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
[tool.poetry]
name = "llm_w_mlx"
version = "0.1.0"
description = ""
authors = ["vitorhcsousa <[email protected]>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
mlx = "^0.0.6"
numpy = "^1.26.2"
torch = "^2.1.2"
sentencepiece = "^0.1.99"
safetensors = "^0.4.1"
typer = "^0.9.0"
[tool.poetry.group.dev.dependencies]
ruff = "^0.1.9"
black = "^23.12.1"
mypy = "^1.8.0"
pre-commit = "^3.6.0"
docformatter = "^1.7.5"
docstr-coverage = "^2.3.0"
[tool.poetry.group.test.dependencies]
pytest = "^7.4.3"
pytest-cov = "^4.1.0"
pytest-sugar = "^0.9.7"
pytest-xdist = "^3.5.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.extras]
dev = [
"black",
"ruff",
"mypy",
"pre-commit",
"docformatter",
"docstr-coverage",
"twine",
]
test = ["pytest", "pytest-cov", "pytest-sugar", "pytest-xdist"]
[tool.ruff]
src = ["src"]
line-length = 120
# Enable auto fix
fix = true
# Enable Pyflakes `E` and `F` codes by default.
select = ["B", "C", "E", "F", "W", "I001", "I002", "D101", "D102"]
ignore = ["E501", "D103", "F401", "C901", "B905", "E741"]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"__pycache__",
"docs/source/conf.py",
"bin",
"lib",
".cicd",
]
#per-file-ignores = {}
# Allow unused variables when underscore-prefixed.
#dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.10.
target-version = "py310"
[tool.ruff.isort]
known-first-party = ["src"]
[tool.ruff.mccabe]
max-complexity = 18
[tool.coverage.run]
branch = true
dynamic_context = "test_function"
source = ["src/mlx_llm"]
# omit = ["src/mlx_llm/__init__.py", "src/mlx_llm/visualization/*.py"]
[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self\\.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
]
[tool.coverage.html]
directory = "htmlcov"
show_contexts = true
[tool.black]
line-length = 120
include = '\.pyi?$|\.ipynb$'
exclude = '''
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.nox
| \.tox
| \.venv
| venv
| \.svn
| \.ipynb_checkpoints
| _build
| buck-out
| build
| dist
| __pypackages__
| \.env
| env
| \.vscode
| \.ruff_cache
| docs
| bin
| lib
| \.cicd
| src/mlx_llm/\.resources
)/
'''
[tool.pytest.ini_options]
testpaths = ["tests"]
log_file = "tests/logs/pytest-logs.log"
log_file_level = "DEBUG"
log_file_format = "%(asctime)s | %(levelname)-8s | %(module)-20s | %(funcName)-20s | %(thread)-8d ; %(message)s"
log_file_date_format = "%Y-%m-%d %H:%M:%S"
[tool.mypy]
python_version = "3.10"
files = ["./src/**/*.py", "./tests/**/*.py"]
exclude = [
'venv',
'.venv',
'env',
'.env',
'docs',
'bin',
'lib',
'.cicd',
"tests",
]
# enables PEP 420 style namespace packages.
namespace_packages = true
# follows all imports normally and type checks all top level code
# (as well as the bodies of all functions and methods with at least one type annotation in the signature).
follow_imports = "normal"
# raises an error whene imports cannot be resolved
ignore_missing_imports = true
# raises an error for functions without type annotations or with incomplete type annotations.
disallow_untyped_defs = true
# nicer output in error messages
pretty = true
# warns useless # type: ignore commands
warn_unused_ignores = true
# shows errors for missing return statements on some execution paths.
warn_no_return = true
# shows a warning when encountering any code inferred to be unreachable or redundant after performing type analysis.
warn_unreachable = true
# prefixes each error with the relevant context.
show_error_context = true
# shows column numbers in error messages.
show_column_numbers = true
# hides error codes in error messages
hide_error_codes = false
# causes mypy to treat arguments with a None default value as having an implicit Optional type.
implicit_optional = false