Commit 80d4e9f
Use prek and ruff for linting and update rule set (#1952)
This pull request updates code style tooling and configuration,
streamlines code formatting in notebooks, and improves import
organization and configuration files. The most impactful changes are the
modernization of the pre-commit setup and the consolidation of code
formatting tools, alongside broad cleanups and formatting
simplifications across Jupyter notebooks and Python files.
**Tooling and Configuration Updates:**
* Updated `.pre-commit-config.yaml` to use the latest `ruff-pre-commit`
repo, replaced `black` and `isort` with Ruff's formatter and import
sorter, and adjusted hooks and dependencies for consistency and modern
standards.
[[1]](diffhunk://#diff-63a9c44a44acf85fea213a857769990937107cf072831e1a26808cfde9d096b9L17-R28)
[[2]](diffhunk://#diff-63a9c44a44acf85fea213a857769990937107cf072831e1a26808cfde9d096b9L63-R58)
* Overhauled `pyproject.toml` to remove legacy `black` and `isort`
settings, expanded Ruff configuration for linting, formatting, and
per-file ignores, and added mypy configuration for static type checking.
[[1]](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L128-L132)
[[2]](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L185-R182)
[[3]](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L234-R259)
**Code Formatting and Import Organization:**
* Refactored multi-line imports and function calls into single lines in
both Python and Jupyter notebook files for improved readability and
consistency.
[[1]](diffhunk://#diff-008dcb3426febd767787b1521f1fe33086313b927ea37eaab86df5fa88a51698L182-R182)
[[2]](diffhunk://#diff-aa879055ed1e1322b67939f639d3bc3c12d5bc295d7c4e834effbc4f1a53fd47L36-R36)
[[3]](diffhunk://#diff-77d278999778b6ae6f7aeb8a0ea8d5abbaf3e79a4ff53526648d343874eaf098L7-R7)
* Standardized import order and grouping in multiple notebooks, moving
library imports to the top and ensuring proper separation between
standard, third-party, and local imports.
[[1]](diffhunk://#diff-9ec1db58f8064a03a3bd0a6f18fe17675093c4396bf1e3dd24e929b7f06a79cdL162-R165)
[[2]](diffhunk://#diff-c84d3a222eb8e8c95893972a3e136fb420615d6eba35e05fb8ac1fd0ab0fe2b5L424-R423)
[[3]](diffhunk://#diff-c84d3a222eb8e8c95893972a3e136fb420615d6eba35e05fb8ac1fd0ab0fe2b5L644-R646)
[[4]](diffhunk://#diff-f78c8ee0adaf4e4c73403184ec90e74ecc8704b06602e3ac283a4eb0aa31e189L52-R53)
[[5]](diffhunk://#diff-90f4d52ca00dc82b18fa350790970ad209a3b5648d5740c56ae215619a2677e2R165)
[[6]](diffhunk://#diff-90f4d52ca00dc82b18fa350790970ad209a3b5648d5740c56ae215619a2677e2L237-R242)
[[7]](diffhunk://#diff-c84d3a222eb8e8c95893972a3e136fb420615d6eba35e05fb8ac1fd0ab0fe2b5L945-R941)
**Notebook Code Simplification:**
* Simplified function calls and list comprehensions to single lines in
notebooks to enhance clarity and maintainability.
[[1]](diffhunk://#diff-7038db84d18585b0f7da5f29a8b74c49d11868f4dac32cff9c7b36b373873949L165-R166)
[[2]](diffhunk://#diff-43702435914ce70eb5b8f94e455bdadee7eef74f794db43c3b926618c870c586L431-R431)
[[3]](diffhunk://#diff-65cccf7b378e42bad759a58749367aefb5ef7d672bc8f1791c721865b8970456L3298-R3298)
[[4]](diffhunk://#diff-44ada6db5a5f3838c865cc4be02b2550cdeaa528f0379d1f2042455f5626b352L181-R181)
[[5]](diffhunk://#diff-780024224c8402230299f07fd7170df50dbcffa25a77718fd27f5ab40a9d746cL142-R142)
[[6]](diffhunk://#diff-49df280ccdfe00a9f5bb767c6e9a7cba44b992af016e9d7a0bed54d652477db1L311-R311)
[[7]](diffhunk://#diff-61f535306c629a7f07ad9a9c0e7b99d4bb808840d2a267a82fd86ce3e74ca697L45478-R45478)
[[8]](diffhunk://#diff-c84d3a222eb8e8c95893972a3e136fb420615d6eba35e05fb8ac1fd0ab0fe2b5L187-R187)
[[9]](diffhunk://#diff-c84d3a222eb8e8c95893972a3e136fb420615d6eba35e05fb8ac1fd0ab0fe2b5L745-R744)
[[10]](diffhunk://#diff-c84d3a222eb8e8c95893972a3e136fb420615d6eba35e05fb8ac1fd0ab0fe2b5L757-R754)
**Minor Code Quality Fixes:**
* Fixed logic and formatting errors, such as the generator length check
in `docs/source/conf.py` and string concatenation in CLI help messages,
improving correctness and clarity.
[[1]](diffhunk://#diff-008dcb3426febd767787b1521f1fe33086313b927ea37eaab86df5fa88a51698L182-R182)
[[2]](diffhunk://#diff-6f1f61fbe373037fdf31139d07acfd57161d3557eaf7369807fea9f6ec65293fL58-R58)
[[3]](diffhunk://#diff-6f1f61fbe373037fdf31139d07acfd57161d3557eaf7369807fea9f6ec65293fL114-R115)
[[4]](diffhunk://#diff-4357d21435d95de54958f2aa1214e0af88de1df968b314c3f0a1736cd91d8d8aL70-R70)
[[5]](diffhunk://#diff-4357d21435d95de54958f2aa1214e0af88de1df968b314c3f0a1736cd91d8d8aL79-R79)
**Dependency and Optional Package Updates:**
* Adjusted optional dependencies in `pyproject.toml`, removing
`pre-commit` and adding `prek` for development.
These changes collectively modernize the project's code style
infrastructure, simplify code in notebooks, and improve overall
maintainability and developer experience.
#1935
### Checklist
<!-- Put an 'x' in all the boxes that apply -->
- [ ] I have added tests to cover my changes or documented any manual
tests.
- [ ] I have updated the
[documentation](https://github.com/open-edge-platform/datumaro/tree/develop/docs)
accordingly
---------
Signed-off-by: Jort Bergfeld <[email protected]>
Signed-off-by: Albert van Houten <[email protected]>
Signed-off-by: Jort Bergfeld <[email protected]>
Co-authored-by: Albert van Houten <[email protected]>1 parent 8598868 commit 80d4e9f
File tree
330 files changed
+3414
-7508
lines changed- .github/workflows
- docs/source
- notebooks
- src/datumaro
- cli
- commands
- downloaders
- contexts
- helpers
- util
- components
- abstracts
- annotations
- contexts
- hl_ops
- merge
- experimental
- filtering
- tiling
- plugins
- data_formats
- arrow
- mapper
- ava
- celeba
- coco
- cvat
- datumaro_binary
- mapper
- datumaro
- icdar
- kaggle
- kitti_3d
- kitti_raw
- kitti
- mapillary_vistas
- mpii
- mvtec
- roboflow
- segment_anything
- sly_pointcloud
- synthia
- tf_detection_api
- voc
- yolo
- sampler
- algorithm
- tiling
- util
- tests
- integration
- cli
- experimental
- unit
- algorithms
- cli
- components
- data_formats
- arrow
- coco
- datumaro
- experimental
- operations
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
330 files changed
+3414
-7508
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
35 | 25 | | |
36 | 26 | | |
37 | 27 | | |
| |||
58 | 48 | | |
59 | 49 | | |
60 | 50 | | |
61 | | - | |
| 51 | + | |
62 | 52 | | |
63 | | - | |
64 | 53 | | |
65 | | - | |
| 54 | + | |
| 55 | + | |
66 | 56 | | |
67 | 57 | | |
68 | 58 | | |
69 | | - | |
| 59 | + | |
70 | 60 | | |
71 | 61 | | |
72 | 62 | | |
73 | 63 | | |
74 | 64 | | |
75 | 65 | | |
76 | | - | |
| 66 | + | |
77 | 67 | | |
78 | 68 | | |
79 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | | - | |
193 | | - | |
| 191 | + | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 165 | + | |
| 166 | + | |
171 | 167 | | |
172 | 168 | | |
173 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
431 | | - | |
432 | | - | |
433 | | - | |
| 431 | + | |
434 | 432 | | |
435 | 433 | | |
436 | 434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3295 | 3295 | | |
3296 | 3296 | | |
3297 | 3297 | | |
3298 | | - | |
3299 | | - | |
3300 | | - | |
| 3298 | + | |
3301 | 3299 | | |
3302 | 3300 | | |
3303 | 3301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
183 | | - | |
| 181 | + | |
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
144 | | - | |
| 142 | + | |
145 | 143 | | |
146 | 144 | | |
147 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | 162 | | |
| 163 | + | |
164 | 164 | | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
192 | | - | |
| 193 | + | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
| |||
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
231 | | - | |
| 232 | + | |
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
237 | | - | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
| |||
431 | 432 | | |
432 | 433 | | |
433 | 434 | | |
434 | | - | |
| 435 | + | |
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
| |||
0 commit comments