generated from allenai/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
219 lines (197 loc) · 5.05 KB
/
pyproject.toml
File metadata and controls
219 lines (197 loc) · 5.05 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
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "olmix"
description = "A Python project for research and development"
readme = "README.md"
license = {text = "Apache-2.0"}
authors = [
{name = "Kyle Lo", email = "kylel@allenai.org"}
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
requires-python = ">=3.11"
dependencies = [
# Core dependencies
# Pin to main branch for reproducibility
"ai2-olmo-core[eval] @ git+https://github.com/allenai/OLMo-core.git@add-inloop-evals",
"boto3",
"click",
"cvxpy",
"datasets>=3,<4",
"ecos",
"gcsfs",
"lightgbm",
"matplotlib",
"numpy",
"pandas",
"pyarrow<21",
"pydantic",
"pyyaml",
"s3fs",
"scikit-learn",
"scipy",
"seaborn",
"statsmodels",
"torch",
"tqdm",
"wandb",
"yaspin",
]
dynamic = ["version"]
[project.scripts]
olmix = "olmix.cli:cli"
olmix-fit = "olmix.fit.cli:fit"
[project.urls]
Homepage = "https://github.com/allenai/olmix"
Repository = "https://github.com/allenai/olmix"
Issues = "https://github.com/allenai/olmix/issues"
[project.optional-dependencies]
beaker = [
"beaker-py>=1,<2",
"GitPython>=3.0,<4.0",
]
dev = [
# Testing
"pytest>=7.4.0",
"pytest-cov>=4.1.0",
"pytest-asyncio>=0.21.0",
"pytest-timeout>=2.1.0",
"flaky>=3.7.0",
# Code formatting and linting (ruff does both)
"ruff>=0.1.5",
# Type checking
"pyright>=1.1.350",
# Pre-commit hooks
"pre-commit>=3.3.3",
"mypy>=1.0,<1.4",
"black>=23.1,<24.0",
"isort>=5.12,<5.13",
]
all = [
"olmix[dev]",
"olmix[beaker]",
]
[tool.setuptools.packages.find]
where = ["."]
include = ["olmix*"]
[tool.setuptools.dynamic]
version = {attr = "olmix.version.__version__"}
# Ruff configuration (handles both linting and formatting)
[tool.ruff]
line-length = 120
target-version = "py311"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"W", # pycodestyle warnings
"UP", # pyupgrade
"B", # flake8-bugbear
"C90", # mccabe complexity
"RUF", # ruff specific rules
]
ignore = [
"E501", # line too long (handled by formatter)
"E711", # comparison to None
"E712", # comparison to True/False
"B007", # loop control variable not used
"B008", # do not perform function calls in argument defaults
"B023", # function definition does not bind loop variable
"B904", # raise from err
"B905", # `zip()` without an explicit `strict=` parameter
"C901", # function too complex
"F811", # redefinition of unused name
"N803", # argument name should be lowercase
"N806", # variable in function should be lowercase
"UP007", # use X | Y for type annotations
"E402", # module level import not at top
"RUF001", # ambiguous unicode character in string
"RUF003", # ambiguous unicode character in comment
"RUF012", # mutable class attributes should be annotated with ClassVar
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"] # Allow unused imports in __init__ files
"tests/*" = ["S101"] # Allow assert statements in tests
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.isort]
known-first-party = ["olmix"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
# Pyright configuration
[tool.pyright]
pythonVersion = "3.11"
typeCheckingMode = "basic"
reportMissingImports = false
reportMissingTypeStubs = false
exclude = [
"**/__pycache__",
".venv",
"build",
"dist",
"docs",
]
# Pytest configuration
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--strict-markers",
"--tb=short",
"--disable-warnings",
"-v",
]
markers = [
"unit: Unit tests that don't require external resources",
"integration: Integration tests that may require external resources",
"slow: Tests that take a long time to run",
"gpu: Tests that require GPU",
]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning",
]
# Coverage configuration
[tool.coverage.run]
branch = true
source = ["olmix"]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__init__.py",
"*/conftest.py",
"*/version.py",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if TYPE_CHECKING:",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if False:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@abstractmethod",
]
precision = 2
show_missing = true
skip_covered = false
[tool.coverage.html]
directory = "htmlcov"