swe-lab 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. swe_lab-0.1.0/.gitignore +61 -0
  2. swe_lab-0.1.0/LICENSE +202 -0
  3. swe_lab-0.1.0/PKG-INFO +92 -0
  4. swe_lab-0.1.0/README.md +65 -0
  5. swe_lab-0.1.0/pyproject.toml +174 -0
  6. swe_lab-0.1.0/src/swe_lab/__init__.py +14 -0
  7. swe_lab-0.1.0/src/swe_lab/__main__.py +5 -0
  8. swe_lab-0.1.0/src/swe_lab/cli/__init__.py +29 -0
  9. swe_lab-0.1.0/src/swe_lab/cli/eval.py +95 -0
  10. swe_lab-0.1.0/src/swe_lab/cli/rollout.py +173 -0
  11. swe_lab-0.1.0/src/swe_lab/cli/verify.py +506 -0
  12. swe_lab-0.1.0/src/swe_lab/conversation/__init__.py +39 -0
  13. swe_lab-0.1.0/src/swe_lab/conversation/model.py +100 -0
  14. swe_lab-0.1.0/src/swe_lab/conversation/observer.py +95 -0
  15. swe_lab-0.1.0/src/swe_lab/datasets/__init__.py +21 -0
  16. swe_lab-0.1.0/src/swe_lab/datasets/loader.py +165 -0
  17. swe_lab-0.1.0/src/swe_lab/datasets/swebench_pro/__init__.py +19 -0
  18. swe_lab-0.1.0/src/swe_lab/datasets/swebench_pro/constants.py +59 -0
  19. swe_lab-0.1.0/src/swe_lab/datasets/swebench_pro/execution.py +73 -0
  20. swe_lab-0.1.0/src/swe_lab/datasets/swebench_pro/patches.py +79 -0
  21. swe_lab-0.1.0/src/swe_lab/datasets/swebench_pro/record.py +148 -0
  22. swe_lab-0.1.0/src/swe_lab/datasets/swebench_pro/unit_test.py +267 -0
  23. swe_lab-0.1.0/src/swe_lab/evaluation/__init__.py +10 -0
  24. swe_lab-0.1.0/src/swe_lab/evaluation/methods/__init__.py +5 -0
  25. swe_lab-0.1.0/src/swe_lab/evaluation/methods/unit_test/__init__.py +5 -0
  26. swe_lab-0.1.0/src/swe_lab/evaluation/methods/unit_test/run.py +98 -0
  27. swe_lab-0.1.0/src/swe_lab/evaluation/verdict.py +70 -0
  28. swe_lab-0.1.0/src/swe_lab/harnesses/__init__.py +9 -0
  29. swe_lab-0.1.0/src/swe_lab/harnesses/base.py +40 -0
  30. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/__init__.py +23 -0
  31. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/binary.py +145 -0
  32. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/capture.py +19 -0
  33. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/constants.py +46 -0
  34. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/convert.py +245 -0
  35. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/errors.py +117 -0
  36. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/harness.py +167 -0
  37. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/proxy.py +164 -0
  38. swe_lab-0.1.0/src/swe_lab/harnesses/claude_code/trace.py +305 -0
  39. swe_lab-0.1.0/src/swe_lab/paths.py +67 -0
  40. swe_lab-0.1.0/src/swe_lab/pipelines/__init__.py +1 -0
  41. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/README.md +79 -0
  42. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/__init__.py +44 -0
  43. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/__main__.py +74 -0
  44. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/agent_run.py +543 -0
  45. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/agent_validator.py +191 -0
  46. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/aggregator.py +148 -0
  47. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/annotation_prompt.py +131 -0
  48. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/annotator.py +84 -0
  49. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/combine.py +167 -0
  50. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/pipeline.py +215 -0
  51. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/schema.py +141 -0
  52. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/storage.py +136 -0
  53. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/traces.py +484 -0
  54. swe_lab-0.1.0/src/swe_lab/pipelines/related_files/workspace.py +92 -0
  55. swe_lab-0.1.0/src/swe_lab/repo/__init__.py +17 -0
  56. swe_lab-0.1.0/src/swe_lab/repo/provider.py +231 -0
  57. swe_lab-0.1.0/src/swe_lab/sandbox/__init__.py +49 -0
  58. swe_lab-0.1.0/src/swe_lab/sandbox/backend.py +142 -0
  59. swe_lab-0.1.0/src/swe_lab/sandbox/backends/__init__.py +62 -0
  60. swe_lab-0.1.0/src/swe_lab/sandbox/backends/ghjob.py +184 -0
  61. swe_lab-0.1.0/src/swe_lab/sandbox/backends/host.py +275 -0
  62. swe_lab-0.1.0/src/swe_lab/sandbox/errors.py +7 -0
  63. swe_lab-0.1.0/src/swe_lab/sandbox/manager.py +294 -0
  64. swe_lab-0.1.0/src/swe_lab/sandbox/mounts.py +65 -0
  65. swe_lab-0.1.0/src/swe_lab/sandbox/observer.py +114 -0
  66. swe_lab-0.1.0/src/swe_lab/sandbox/observers/__init__.py +5 -0
  67. swe_lab-0.1.0/src/swe_lab/sandbox/observers/diff_extract.py +93 -0
  68. swe_lab-0.1.0/src/swe_lab/sandbox/patch.py +187 -0
  69. swe_lab-0.1.0/src/swe_lab/sandbox/resources.py +105 -0
  70. swe_lab-0.1.0/src/swe_lab/sandbox/result.py +88 -0
  71. swe_lab-0.1.0/src/swe_lab/sandbox/spec.py +28 -0
  72. swe_lab-0.1.0/src/swe_lab/sandbox/testing.py +168 -0
  73. swe_lab-0.1.0/src/swe_lab/solve.py +180 -0
@@ -0,0 +1,61 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual environment
13
+ .venv/
14
+ venv/
15
+
16
+ # uv
17
+ # (uv.lock is committed on purpose)
18
+
19
+ # Tooling caches
20
+ .ruff_cache/
21
+ .pytest_cache/
22
+ .mypy_cache/
23
+ .pyright/
24
+
25
+ # Provisioned repo checkouts (RepoProvider cache)
26
+ .cache/
27
+
28
+ # direnv local overrides
29
+ .envrc.local
30
+
31
+ # Datasets: track per-dataset READMEs, ignore the downloaded data files
32
+ datasets/**/data/
33
+
34
+ # Task outputs are the committed deliverable: per-instance runs under
35
+ # outputs/related_files/<dataset>/intermediate/<instance_id>/ (candidate +
36
+ # aggregate annotations) plus the combined
37
+ # outputs/related_files/<dataset>/annotations.parquet built from them by the
38
+ # `combine` binary. Proxy logs and other scratch stay under the gitignored
39
+ # .cache/.
40
+ #
41
+ # Full-conversation trace records are large, so they live off-repo in a HF
42
+ # dataset repo (see `traces.py`), NOT in git. Only the small
43
+ # `traces_manifest.json` (sha256 + size + repo id/revision per trace) is tracked,
44
+ # so any trace can be fetched and integrity-checked on demand.
45
+ outputs/**/*.last_exchange.json
46
+
47
+ # Jupyter
48
+ .ipynb_checkpoints/
49
+
50
+ # OS / editor
51
+ .DS_Store
52
+ *.swp
53
+
54
+ # Experiment proxy logs are large and regenerable — never commit them
55
+ experiments/related_files/prompt_variance/runs/**/*.proxy.jsonl
56
+
57
+ # Claude Code: ignore personal + runtime state, but KEEP shareable project
58
+ # config trackable (.claude/settings.json, commands/, agents/, skills/) — do
59
+ # NOT blanket-ignore .claude/.
60
+ .claude/settings.local.json
61
+ .claude/scheduled_tasks.lock
swe_lab-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
swe_lab-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: swe-lab
3
+ Version: 0.1.0
4
+ Summary: Tooling to enrich and audit SWE-Bench evaluation data (related-files annotation, and more)
5
+ Project-URL: Homepage, https://github.com/Luolc/swe-lab
6
+ Project-URL: Repository, https://github.com/Luolc/swe-lab
7
+ Project-URL: Issues, https://github.com/Luolc/swe-lab/issues
8
+ Author-email: Liangchen Luo <luolc.witty@gmail.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: agent,coding-agent,dataset,evaluation,llm,sandbox,swe-bench,swe-bench-pro
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Testing
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: <3.14,>=3.13
22
+ Requires-Dist: huggingface-hub>=1.22.0
23
+ Requires-Dist: polars>=1.42.1
24
+ Requires-Dist: pydantic>=2.10
25
+ Requires-Dist: typer>=0.27.0
26
+ Description-Content-Type: text/markdown
27
+
28
+ # SWE Lab
29
+
30
+ Tooling to **build, run, enrich, audit and fix SWE (a.k.a. coding agent) evaluation data**.
31
+
32
+ ## Tasks
33
+
34
+ - **Related-files annotation** (`src/swe_lab/pipelines/related_files/`) —
35
+ for each task instance, produce a ground-truth list of the code snippets a
36
+ model needs to read to solve it. **Shipped**: 100 instances annotated & QA'd.
37
+ See [`pipelines/related_files/README.md`](src/swe_lab/pipelines/related_files/README.md).
38
+
39
+ - **Quality auditing** *(planned)* — flag "skewed" eval examples that no longer
40
+ measure real capability (ambiguous specs vs. overly-specific tests, broken
41
+ environments, contamination, brittle graders), in the spirit of OpenAI's
42
+ [*Separating signal from noise in coding evaluations*](https://openai.com/index/separating-signal-from-noise-coding-evaluations/).
43
+ Not started; it will land as a sibling under `pipelines/`.
44
+
45
+ The overall roadmap and design live in [`docs/README.md`](docs/README.md).
46
+
47
+ ## Setup
48
+
49
+ ### Prerequisites
50
+
51
+ - [uv](https://docs.astral.sh/uv/) for environment and dependency management
52
+ - [direnv](https://direnv.net/) for auto-activating the environment
53
+ - Python 3.13 (uv will install it automatically if missing)
54
+
55
+ ### 1. Clone
56
+
57
+ ```bash
58
+ git clone https://github.com/Luolc/swe-lab.git
59
+ cd swe-lab
60
+ ```
61
+
62
+ Optional — the `--capture proxy` mode compiles the standalone
63
+ [`cc-reverse-proxy`](https://github.com/Luolc/cc-reverse-proxy) Go project. It is
64
+ **not** a submodule: by default it is looked up as a sibling checkout next to
65
+ this repo (`../cc-reverse-proxy/reverse_proxy.go`); clone it there, or point
66
+ `CC_REVERSE_PROXY_SRC` at its `reverse_proxy.go`. The default `stream` capture
67
+ needs none of this.
68
+
69
+ ### 2. Set up the environment
70
+
71
+ ```bash
72
+ uv sync # create .venv and install all (incl. dev) dependencies
73
+ direnv allow # auto-activate the venv on cd (uses .envrc)
74
+ ```
75
+
76
+ If you don't use direnv, activate manually with `source .venv/bin/activate`.
77
+
78
+ Install the pre-commit hooks (ruff, pyink, isort, basedpyright, uv-lock):
79
+
80
+ ```bash
81
+ uv run pre-commit install
82
+ ```
83
+
84
+ ### 3. Download the datasets
85
+
86
+ Dataset data files are gitignored and must be downloaded locally. See
87
+ [`datasets/README.md`](datasets/README.md) for the list of available datasets
88
+ and per-dataset download instructions.
89
+
90
+ ## [Disclaimer](DISCLAIMER.md)
91
+
92
+ This is a personal project and is not affiliated with any company. The content does not reflect any specific company's projects, products or internal work.
@@ -0,0 +1,65 @@
1
+ # SWE Lab
2
+
3
+ Tooling to **build, run, enrich, audit and fix SWE (a.k.a. coding agent) evaluation data**.
4
+
5
+ ## Tasks
6
+
7
+ - **Related-files annotation** (`src/swe_lab/pipelines/related_files/`) —
8
+ for each task instance, produce a ground-truth list of the code snippets a
9
+ model needs to read to solve it. **Shipped**: 100 instances annotated & QA'd.
10
+ See [`pipelines/related_files/README.md`](src/swe_lab/pipelines/related_files/README.md).
11
+
12
+ - **Quality auditing** *(planned)* — flag "skewed" eval examples that no longer
13
+ measure real capability (ambiguous specs vs. overly-specific tests, broken
14
+ environments, contamination, brittle graders), in the spirit of OpenAI's
15
+ [*Separating signal from noise in coding evaluations*](https://openai.com/index/separating-signal-from-noise-coding-evaluations/).
16
+ Not started; it will land as a sibling under `pipelines/`.
17
+
18
+ The overall roadmap and design live in [`docs/README.md`](docs/README.md).
19
+
20
+ ## Setup
21
+
22
+ ### Prerequisites
23
+
24
+ - [uv](https://docs.astral.sh/uv/) for environment and dependency management
25
+ - [direnv](https://direnv.net/) for auto-activating the environment
26
+ - Python 3.13 (uv will install it automatically if missing)
27
+
28
+ ### 1. Clone
29
+
30
+ ```bash
31
+ git clone https://github.com/Luolc/swe-lab.git
32
+ cd swe-lab
33
+ ```
34
+
35
+ Optional — the `--capture proxy` mode compiles the standalone
36
+ [`cc-reverse-proxy`](https://github.com/Luolc/cc-reverse-proxy) Go project. It is
37
+ **not** a submodule: by default it is looked up as a sibling checkout next to
38
+ this repo (`../cc-reverse-proxy/reverse_proxy.go`); clone it there, or point
39
+ `CC_REVERSE_PROXY_SRC` at its `reverse_proxy.go`. The default `stream` capture
40
+ needs none of this.
41
+
42
+ ### 2. Set up the environment
43
+
44
+ ```bash
45
+ uv sync # create .venv and install all (incl. dev) dependencies
46
+ direnv allow # auto-activate the venv on cd (uses .envrc)
47
+ ```
48
+
49
+ If you don't use direnv, activate manually with `source .venv/bin/activate`.
50
+
51
+ Install the pre-commit hooks (ruff, pyink, isort, basedpyright, uv-lock):
52
+
53
+ ```bash
54
+ uv run pre-commit install
55
+ ```
56
+
57
+ ### 3. Download the datasets
58
+
59
+ Dataset data files are gitignored and must be downloaded locally. See
60
+ [`datasets/README.md`](datasets/README.md) for the list of available datasets
61
+ and per-dataset download instructions.
62
+
63
+ ## [Disclaimer](DISCLAIMER.md)
64
+
65
+ This is a personal project and is not affiliated with any company. The content does not reflect any specific company's projects, products or internal work.
@@ -0,0 +1,174 @@
1
+ [project]
2
+ name = "swe-lab"
3
+ version = "0.1.0"
4
+ description = "Tooling to enrich and audit SWE-Bench evaluation data (related-files annotation, and more)"
5
+ readme = "README.md"
6
+ authors = [{ name = "Liangchen Luo", email = "luolc.witty@gmail.com" }]
7
+ requires-python = ">=3.13,<3.14"
8
+ license = "Apache-2.0"
9
+ license-files = ["LICENSE"]
10
+ keywords = [
11
+ "swe-bench",
12
+ "swe-bench-pro",
13
+ "evaluation",
14
+ "llm",
15
+ "agent",
16
+ "coding-agent",
17
+ "sandbox",
18
+ "dataset",
19
+ ]
20
+ classifiers = [
21
+ "Development Status :: 3 - Alpha",
22
+ "Intended Audience :: Developers",
23
+ "Intended Audience :: Science/Research",
24
+ "Operating System :: OS Independent",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
28
+ "Topic :: Software Development :: Testing",
29
+ "Typing :: Typed",
30
+ ]
31
+ dependencies = [
32
+ "huggingface-hub>=1.22.0",
33
+ "polars>=1.42.1",
34
+ "pydantic>=2.10",
35
+ "typer>=0.27.0",
36
+ ]
37
+
38
+ [project.scripts]
39
+ swe-lab = "swe_lab.cli:app"
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/Luolc/swe-lab"
43
+ Repository = "https://github.com/Luolc/swe-lab"
44
+ Issues = "https://github.com/Luolc/swe-lab/issues"
45
+
46
+ [build-system]
47
+ requires = ["hatchling"]
48
+ build-backend = "hatchling.build"
49
+
50
+ [tool.hatch.build.targets.wheel]
51
+ packages = ["src/swe_lab"]
52
+
53
+ # Keep the sdist to what's needed to build + verify the package — the package
54
+ # source, tests, and the project metadata files. Without this, hatchling's
55
+ # default sweeps in docs/, experiments/, and the committed outputs/ (~3.6 MB).
56
+ [tool.hatch.build.targets.sdist]
57
+ include = [
58
+ "src/swe_lab",
59
+ "/README.md",
60
+ "/LICENSE",
61
+ "/pyproject.toml",
62
+ ]
63
+
64
+ [dependency-groups]
65
+ dev = [
66
+ "basedpyright>=1.39.0",
67
+ "pre-commit>=4.5.1",
68
+ "pytest>=9.0.3",
69
+ "ruff>=0.15.7",
70
+ "pylint>=4.0.5",
71
+ "pyink>=25.12.0",
72
+ "isort>=8.0.1",
73
+ ]
74
+
75
+ [tool.pytest.ini_options]
76
+ markers = [
77
+ "docker: integration test that needs a usable Docker daemon; auto-skipped when Docker is absent (see tests/conftest.py)",
78
+ ]
79
+
80
+ [tool.basedpyright]
81
+ venvPath = "."
82
+ venv = ".venv"
83
+ include = ["src", "tests"]
84
+ exclude = ["**/__pycache__", "build"]
85
+ reportAny = false
86
+ reportExplicitAny = false
87
+ reportImplicitStringConcatenation = false
88
+ reportMissingTypeStubs = false
89
+ reportPrivateUsage = false
90
+ # Common in unit tests.
91
+ reportUninitializedInstanceVariable = false
92
+ # Many reports from built-in and third-party libraries
93
+ reportUnknownArgumentType = false
94
+ reportUnknownMemberType = false
95
+ # Too strict
96
+ reportUnknownVariableType = false
97
+ # False positives even with TYPE_CHECKING.
98
+ reportImportCycles = false
99
+
100
+ # Tests routinely call functions for their side effects or to assert on the
101
+ # exceptions they raise, so an unused return value is expected there.
102
+ [[tool.basedpyright.executionEnvironments]]
103
+ root = "tests"
104
+ reportUnusedCallResult = false
105
+
106
+ [tool.pyink]
107
+ line-length = 80
108
+ pyink-indentation = 2
109
+ pyink-use-majority-quotes = true
110
+ target_version = ["py313"]
111
+
112
+ [tool.isort]
113
+ profile = "black"
114
+ line_length = 80
115
+ force_sort_within_sections = true
116
+ lexicographical = true
117
+ order_by_type = false
118
+ group_by_package = true
119
+ extra_standard_library = ["typing_extensions"]
120
+
121
+ [tool.ruff]
122
+ line-length = 80
123
+ indent-width = 2
124
+ target-version = "py313"
125
+
126
+ [tool.ruff.lint]
127
+ select = [
128
+ "B", # flake8-bugbear
129
+ "C", # flake8-comprehensions, mccabe (C90: max-complexity below)
130
+ "D", # pydocstyle — Google convention (see [tool.ruff.lint.pydocstyle])
131
+ "D401", # imperative mood: repo-wide choice; google convention would drop it
132
+ "E", # pycodestyle errors
133
+ "F", # pyflakes
134
+ "ISC001", # single-line-implicit-string-concatenation
135
+ "N", # pep8-naming
136
+ "W", # pycodestyle warnings
137
+ "W505", # doc-line-too-long (max-doc-length below)
138
+ "RUF008", # mutable-dataclass-default
139
+ "UP", # pyupgrade
140
+ "SIM", # flake8-simplify
141
+ ]
142
+ ignore = [
143
+ "E111", # indentation is not a multiple of 4
144
+ "E114", # indentation is not a multiple of 4 (comment)
145
+ "E117", # over-indented
146
+ "W191", # indentation contains tabs
147
+ # Trivial dunders are self-evident (guide §3.8.3 requires docstrings only
148
+ # for public API / nontrivial / non-obvious functions).
149
+ "D105",
150
+ ]
151
+
152
+ [tool.ruff.lint.pydocstyle]
153
+ convention = "google"
154
+
155
+ [tool.ruff.lint.mccabe]
156
+ max-complexity = 10
157
+
158
+ [tool.ruff.lint.pycodestyle]
159
+ max-doc-length = 80
160
+
161
+ [tool.ruff.lint.per-file-ignores]
162
+ # Google style §3.8.2.1: test modules need no docstrings (format rules still apply).
163
+ "tests/**" = ["D1"]
164
+
165
+ [tool.ruff.format]
166
+ # Disable ruff formatting. Use pyink in this project.
167
+ # Add any other file patterns if your project uses them (e.g., "**/*.ipynb" for Jupyter notebooks)
168
+ exclude = ["**/*.py", "**/*.pyi"]
169
+
170
+ [tool.pydoclint]
171
+ # Reconcile pydoclint with ruff's D107 (undocumented-public-init): D107
172
+ # requires an __init__ docstring, while pydoclint's default (DOC301) forbids
173
+ # one. Allow __init__ docstrings; pydoclint still checks their contents.
174
+ allow-init-docstring = true
@@ -0,0 +1,14 @@
1
+ """Annotation tooling for SWE-Bench related files."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .datasets import Dataset, load_dataset, SweBenchProInstance
6
+ from .repo import GitCheckoutProvider, RepoProvider
7
+
8
+ __all__ = [
9
+ "Dataset",
10
+ "GitCheckoutProvider",
11
+ "RepoProvider",
12
+ "SweBenchProInstance",
13
+ "load_dataset",
14
+ ]
@@ -0,0 +1,5 @@
1
+ """``python -m swe_lab`` entry point."""
2
+
3
+ from .cli import app
4
+
5
+ app()
@@ -0,0 +1,29 @@
1
+ """The ``swe_lab`` command-line interface.
2
+
3
+ One Typer app; each subcommand is a typed function in its own module (the
4
+ dispatcher stays a thin table so it never grows into one giant file). Run it as
5
+ ``python -m swe_lab <subcommand>``.
6
+ """
7
+
8
+ import typer
9
+
10
+ from .eval import eval_cmd
11
+ from .rollout import rollout_in_docker
12
+ from .verify import verify_cmd
13
+
14
+ app = typer.Typer(add_completion=False, no_args_is_help=True)
15
+
16
+
17
+ @app.callback()
18
+ def root() -> None:
19
+ """swe-lab: build, run, and evaluate SWE-agent evaluation data."""
20
+ # A top-level callback keeps this a multi-command group: subcommands are
21
+ # required even while `eval` is the only one registered (Typer otherwise
22
+ # collapses a single-command app into that command).
23
+
24
+
25
+ _ = app.command("eval")(eval_cmd)
26
+ _ = app.command("rollout")(rollout_in_docker)
27
+ _ = app.command("verify")(verify_cmd)
28
+
29
+ __all__ = ["app"]