Skip to content

Commit 8e5fb0a

Browse files
committed
feat: change settings of autolabel script
1 parent cb9a372 commit 8e5fb0a

File tree

1 file changed

+55
-25
lines changed

1 file changed

+55
-25
lines changed

scripts/autolabel.lean

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ open Lean System
6060
namespace AutoLabel
6161

6262
/-- Maximal number of labels which can be added. If more are applicable, nothing will be added. -/
63-
def MAX_LABELS := 1
63+
def MAX_LABELS := 2
6464

6565
/-- Mathlib's Github topic labels -/
6666
inductive Label where
@@ -175,37 +175,51 @@ def mathlibLabelData : (l : Label) → LabelData l
175175
"Mathlib" / "Algebra",
176176
"Mathlib" / "FieldTheory",
177177
"Mathlib" / "RepresentationTheory",
178-
"Mathlib" / "LinearAlgebra"] }
178+
"Mathlib" / "LinearAlgebra"]
179+
dependencies := #[.«t-data»] }
179180
| .«t-algebraic-geometry» => {
180181
dirs := #[
181182
"Mathlib" / "AlgebraicGeometry",
182-
"Mathlib" / "Geometry" / "RingedSpace"] }
183-
| .«t-algebraic-topology» => {}
184-
| .«t-analysis» => {}
185-
| .«t-category-theory» => {}
186-
| .«t-combinatorics» => {}
187-
| .«t-computability» => {}
188-
| .«t-condensed» => {}
183+
"Mathlib" / "Geometry" / "RingedSpace"]
184+
dependencies := #[.«t-ring-theory», .«t-category-theory»] }
185+
| .«t-algebraic-topology» => {
186+
dependencies := #[.«t-algebra», .«t-category-theory»] }
187+
| .«t-analysis» => {
188+
dependencies := #[.«t-data»] }
189+
| .«t-category-theory» => {
190+
dependencies := #[.«t-data»] }
191+
| .«t-combinatorics» => {
192+
dependencies := #[.«t-data»] }
193+
| .«t-computability» => {
194+
dependencies := #[.«t-data»] }
195+
| .«t-condensed» => {
196+
dependencies := #[.«t-category-theory»] }
189197
| .«t-convex-geometry» => {
190-
dirs := #["Mathlib" / "Geometry" / "Convex"] }
198+
dirs := #["Mathlib" / "Geometry" / "Convex"]
199+
dependencies := #[.«t-data»] }
191200
| .«t-data» => {
192201
dirs := #[
193202
"Mathlib" / "Control",
194-
"Mathlib" / "Data"] }
203+
"Mathlib" / "Data"]
204+
dependencies := #[.«t-logic»] }
195205
| .«t-differential-geometry» => {
196-
dirs := #["Mathlib" / "Geometry" / "Manifold"] }
197-
| .«t-dynamics» => {}
206+
dirs := #["Mathlib" / "Geometry" / "Manifold"]
207+
dependencies := #[.«t-analysis»] }
208+
| .«t-dynamics» => {
209+
dependencies := #[.«t-analysis»] }
198210
| .«t-euclidean-geometry» => {
199-
dirs := #["Mathlib" / "Geometry" / "Euclidean"] }
211+
dirs := #["Mathlib" / "Geometry" / "Euclidean"]
212+
dependencies := #[.«t-algebra», .«t-analysis»] }
200213
| .«t-geometric-group-theory» => {
201-
dirs := #["Mathlib" / "Geometry" / "Group"] }
202-
| .«t-group-theory» => {}
214+
dirs := #["Mathlib" / "Geometry" / "Group"]
215+
dependencies := #[.«t-group-theory»] }
216+
| .«t-group-theory» => {
217+
dependencies := #[.«t-algebra»] }
203218
| .«t-linter» => {
204219
dirs := #[
205220
"Mathlib" / "Tactic" / "Linter",
206221
"scripts" / "lint-style.lean",
207-
"scripts" / "lint-style.py",
208-
] }
222+
"scripts" / "lint-style.py"] }
209223
| .«t-logic» => {
210224
dirs := #[
211225
"Mathlib" / "Logic",
@@ -214,19 +228,25 @@ def mathlibLabelData : (l : Label) → LabelData l
214228
dirs := #[
215229
"Mathlib" / "MeasureTheory",
216230
"Mathlib" / "Probability",
217-
"Mathlib" / "InformationTheory"] }
231+
"Mathlib" / "InformationTheory"]
232+
dependencies := #[.«t-analysis»] }
218233
| .«t-meta» => {
219234
dirs := #[
220235
"Mathlib" / "Lean",
221236
"Mathlib" / "Mathport",
222237
"Mathlib" / "Tactic",
223-
"Mathlib" / "Util"],
238+
"Mathlib" / "Util"]
224239
exclusions := #["Mathlib" / "Tactic" / "Linter"] }
225-
| .«t-number-theory» => {}
226-
| .«t-order» => {}
227-
| .«t-ring-theory» => {}
228-
| .«t-set-theory» => {}
229-
| .«t-topology» => {}
240+
| .«t-number-theory» => {
241+
dependencies := #[.«t-data»] }
242+
| .«t-order» => {
243+
dependencies := #[.«t-data»] }
244+
| .«t-ring-theory» => {
245+
dependencies := #[.«t-algebra»] }
246+
| .«t-set-theory» => {
247+
dependencies := #[.«t-data»] }
248+
| .«t-topology» => {
249+
dependencies := #[.«t-algebra»] }
230250
| .«CI» => {
231251
dirs := #[
232252
".github",
@@ -317,6 +337,16 @@ section Tests
317337
"scripts" / "lint-style.lean", "scripts" / "lint-style.py"] == #[.«t-linter»]
318338
#guard getMatchingLabels #["scripts" / "noshake.json"] == #[]
319339

340+
-- Test dropping labels works
341+
#guard dropDependentLabels
342+
#[.«t-ring-theory», .«t-data», .«t-algebra»] == #[.«t-ring-theory»]
343+
#guard dropDependentLabels
344+
#[.«CI», .«t-algebraic-topology», .«t-algebra», .«t-order»] ==
345+
#[.«CI», .«t-algebraic-topology», .«t-order»]
346+
#guard dropDependentLabels
347+
#[.«t-ring-theory», .«t-data», .«t-algebra», .«t-category-theory», .«t-order»] ==
348+
#[.«t-ring-theory», .«t-category-theory», .«t-order»]
349+
320350
/-- Testing function to ensure the labels defined in `mathlibLabels` cover all
321351
subfolders of `Mathlib/`. -/
322352
partial def findUncoveredPaths (path : FilePath) (exceptions : Array FilePath := #[]) :

0 commit comments

Comments
 (0)