Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
261 lines (240 loc) · 9.56 KB
/
Copy pathpyproject.toml
File metadata and controls
261 lines (240 loc) · 9.56 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
[build-system]
requires = [
"setuptools >= 84.0.0",
"setuptools-scm >= 8",
]
build-backend = "setuptools.build_meta"
[project]
# The distribution is `reef-infra`; the import package remains `reef`.
name = "reef-infra"
dynamic = ["version"]
description = "A framework-agnostic runtime for continuously improving agents"
readme = "README.md"
license = "Apache-2.0"
authors = [{ name = "Human-Agent-Society" }]
requires-python = ">=3.12"
classifiers = [
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: System :: Distributed Computing",
]
# Reef core dependencies. Keep this list free of training and GPU packages:
# `pip install reef-infra` must support the base `recipe` configuration on CPU.
dependencies = [
"aiohttp>=3.14", # web.RequestKey
"alembic>=1.13,<2",
"huggingface_hub",
# Harbor's environment contract backs reef.execution.sandbox; task directory rollouts, the task player and the
# generator service play Harbor tasks with reef-eval.
"harbor>=0.20,<0.25",
"pyyaml",
"reef-client>=0.2.0",
"reef-eval>=0.1.1",
"sqlalchemy>=2.0,<3",
"tomli-w",
]
[project.optional-dependencies]
# Python-side inference adapters; install native SGLang in its GPU environment.
sglang = ["httpx", "requests", "ray[default]", "sglang-router>=0.3.2", "psutil>=5.9"]
# Python-side vLLM adapter; install native vLLM in its GPU environment.
vllm = ["httpx", "requests", "ray[default]", "psutil>=5.9"]
tinker = [
"tinker==0.35.0",
# Converts Tinker checkpoints into PEFT adapters for a local engine (pulls torch).
"tinker-cookbook==0.5.8",
"jinja2>=3.1.0",
]
postgres = ["psycopg[binary]>=3.1,<4"]
# Reads s3:// sources of an artifact import (storage.artifact_sources).
s3 = ["boto3"]
# Cloud sandboxes for evaluation rollouts and the Reefine agent: E2B, and Modal. Harbor's extra of each
# environment adds what its sandbox needs to build a task's image (dockerfile-parse).
e2b = ["harbor[e2b]", "e2b>=2.46", "connectrpc>=0.11.1,<0.13"]
modal = ["harbor[modal]", "modal>=1.6"]
# Provider-neutral experiment tracking. Non-Slime training backends can opt in
# without installing the Slime/GPU dependency stack.
wandb = [
"wandb>=0.29.0",
]
# Record tracing over OTLP/HTTP (observability.tracing); any OpenTelemetry-compatible backend receives it.
opentelemetry = [
"opentelemetry-sdk>=1.25",
"opentelemetry-exporter-otlp-proto-http>=1.25",
]
# Python-side dependencies used by the Slime backend. The runtime source pin
# lives in the `runtime` dependency group below.
# torch / SGLang / Megatron-Core / FlashAttention remain supplied by the
# supported slimerl/slime GPU image because their versions are CUDA-specific.
slime = [
"e2b",
"httpx[http2]",
"memray",
"omegaconf",
"peft",
"pillow",
"psutil>=5.9",
"pylatexenc",
"qwen_vl_utils",
"requests",
"ray[default]",
"safetensors",
"sglang-router>=0.3.2",
"tensorboard",
"transformers",
"wandb>=0.29.0",
]
# Local dev toolchain: `pip install -e .[dev]`. Versions of the lint
# tools stay in sync with .pre-commit-config.yaml revs.
dev = [
"mypy",
"pre-commit",
"pytest",
# CI measures coverage against the [tool.coverage.report] floor below.
"pytest-cov",
# Runs the suite in parallel, as CI does (-n 8; addopts selects --dist worksteal).
"pytest-xdist==3.8.0",
"ruff==0.17.2",
]
[dependency-groups]
# Source-installed runtime pins used by development, CI, and images. Keeping
# them out of package metadata lets GPU environments install them with
# `--no-deps` without replacing their CUDA-matched dependency stack.
runtime = [
"slime @ git+https://github.com/THUDM/slime.git@540ea919e45b8b929198abce008a103be9cfc779",
]
[project.urls]
Homepage = "https://github.com/Human-Agent-Society/reef"
[project.scripts]
reef = "reef.cli:main"
reef-native = "reef.harness.runners.native.__main__:main"
[project.entry-points."sglang.srt.plugins"]
reef = "reef.inference.sglang.plugin:install_sglang_plugin"
[tool.setuptools]
include-package-data = true
[tool.setuptools_scm]
fallback_version = "0.0.0.dev0"
# reef-client is now a separate repo (Human-Agent-Society/reef-client) and a
# declared dependency; the reef wheel must not ship its source.
# `reef` is the shared machinery. The sibling `recipes` tree is a cookbook,
# not package code, so neither its methods nor its runnable examples ship.
# runtime/ intentionally contains only its five modules and executor/ (PEP 420).
[tool.setuptools.packages.find]
namespaces = true
include = ["reef", "reef.*"]
[tool.setuptools.package-data]
reef = [
"harness/adapters/*/adapter.yaml",
"harness/adapters/codex/default_instructions.md",
"harness/adapters/codex/bundled_models.json",
"train/harness_backend/agent/protocol.md",
]
[tool.isort]
profile = "black" # black-compatible
line_length = 119 # should match black parameters
ignore_whitespace = true # ignore whitespace for compatibility with the initial style
py_version = 312 # sync with requires-python in [project]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
default_section = "THIRDPARTY"
known_first_party = ["reef", "recipes"]
known_third_party = ["megatron", "wandb", "ray", "transformers"]
src_paths = ["reef", "recipes"]
# Files no formatter touches (vendored benchmark content, saved result programs)
# are listed once, in .pre-commit-config.yaml's top-level `exclude`.
[tool.black]
line_length = 119
[tool.ruff]
target-version = "py312" # sync with requires-python in [project]
line-length = 119 # sync with [tool.black] and [tool.isort]
[tool.ruff.lint]
select = [
"E", "W", # pycodestyle
"F", # pyflakes
"B", # flake8-bugbear
"UP", # pyupgrade
"C4", # flake8-comprehensions
"SIM", # flake8-simplify
"PIE", # flake8-pie
"ISC", # flake8-implicit-str-concat
"RSE", # flake8-raise
"RET", # flake8-return
"PERF", # perflint
"LOG", # flake8-logging
"N", # pep8-naming
"RUF", # ruff
]
ignore = [
# E402: module-import-not-at-top-of-file
"E402",
# E501: line too long - black handles wrapping; long strings and URLs stay readable
"E501",
# N818: existing public exception names omit an Error suffix; renaming them would break callers
"N818",
# UP046/UP047: PEP 695 type parameter syntax; the codebase declares TypeVars, and mypy reads both forms
"UP046",
"UP047",
]
# Math notation in the RL objective docstrings: SAO's alpha/gamma, and the
# true minus sign used alongside other Unicode math (∇, π, Â) in the SAO loss
# derivation. Other Greek symbols (theta, pi, epsilon, lambda, delta) are not
# flagged; these three only trip RUF002/003 because they have ASCII lookalikes.
allowed-confusables = ["α", "γ", "−"]
[tool.ruff.lint.per-file-ignores]
# Test code: perf lint and strict class/branch shape rules add churn, not safety.
"tests/**/*.py" = ["N806", "PERF", "RUF012", "SIM108"]
# The Top-K objective follows the mathematical notation used in its derivation.
"recipes/openclawrl/slime/objective.py" = ["N802", "N803", "N806"]
[tool.mypy]
# Reef's training adapters are checked with the rest of the package; the
# runtime remains a separately installed distribution.
files = ["reef"]
python_version = "3.12" # sync with requires-python in [project]
ignore_missing_imports = true
# The training runtime and its GPU dependencies do not ship type information
# with Reef.
[[tool.mypy.overrides]]
module = ["slime.*", "slime_plugins.*", "vllm.*"]
ignore_missing_imports = true
[tool.coverage.run]
source = ["reef"]
# Coverage from the GitHub and Blacksmith checkouts is combined in one gate.
relative_files = true
# Reef-authored training control flow counts toward the CPU coverage gate. These
# three modules execute only inside a live Megatron/CUDA worker; their useful
# validation is the GPU integration suite, not import-only CPU mocks.
omit = [
"reef/train/slime_backend/reef_adapters/megatron/hf_export.py",
"reef/train/slime_backend/reef_adapters/megatron/model_provider.py",
"reef/train/slime_backend/reef_adapters/megatron/train_actor.py",
]
[tool.coverage.report]
skip_empty = true
precision = 1
# Floor just under the 82 percent baseline: prevents silent decay while the
# team decides a real target.
fail_under = 80
[tool.pytest.ini_options]
# Report the 20 slowest tests; --durations=0 lists every test.
# With -n, worksteal spreads single tests over the workers and moves queued
# tests from a busy worker to an idle one, so one slow file cannot hold the run.
# Every test must therefore pass alone and in any order. Without -n, --dist has no effect.
addopts = "--verbose --pyargs --durations=20 --strict-markers --import-mode=importlib --dist worksteal"
testpaths = ["./tests"] # must be an explicit path to avoid importing another "tests" module
# directories to ignore when discovering tests
norecursedirs = [
"examples",
"*.egg",
".*",
"_darcs",
"build",
"CVS",
"dist",
"venv",
"{arch}",
]
# markers to select tests, use `pytest --markers` to see all available markers, `pytest -m "<marker>"` to select tests
markers = [
"sandbox: requires real nested bubblewrap jails on the GitHub CI runner",
"unit: marks unit test, i.e. testing a single, well isolated functionality (deselect with '-m \"not unit\"')",
"integration: marks test checking the elements when integrated into subsystems (deselect with '-m \"not integration\"')",
"acceptance: marks test checking whether the developed product/model passes the user defined acceptance criteria (deselect with '-m \"not acceptance\"')",
]