brioche-dev / brioche-packages

Brioche packages, which get auto-published to the Brioche Registry
MIT License
20 stars 1 forks source link

feat: Add ruff package #77

Closed jaudiger closed 1 month ago

jaudiger commented 1 month ago

Add ruff tool. Based on @kylewlacy's comment https://github.com/brioche-dev/brioche/issues/103#issuecomment-2241778792.

Tested with:

bash-5.2$ brioche install -p packages/ruff     
[17205]    Compiling ruff_linter v0.5.3 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bff
eb3f7ee9ed26c61c43572c8/work/crates/ruff_linter)                                                       
[17205]    Compiling clap_complete_command v0.6.1                                                      
[17205]    Compiling cachedir v0.3.1                                                                   
[17205]    Compiling bincode v1.3.3                                                                    
[17205]    Compiling wild v2.2.1                                                                       
[17205]    Compiling ruff_workspace v0.0.0 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00
bffeb3f7ee9ed26c61c43572c8/work/crates/ruff_workspace)                                                 
[17205]    Compiling ruff_server v0.2.2 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bff
eb3f7ee9ed26c61c43572c8/work/crates/ruff_server)                                                       
[17205]    Compiling tikv-jemallocator v0.6.0                                                          
[17205]     Finished `release` profile [optimized] target(s) in 7m 54s                                 
[17205]   Installing /home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26c61c4357
2c8/.local/share/brioche/outputs/output-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26c61c43572c
8/bin/ruff                                                                                             
[17205]    Installed package `ruff v0.5.3 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00b
ffeb3f7ee9ed26c61c43572c8/work/crates/ruff)` (executable `ruff`)                                       

Process 17205 [7:55.1 Exited 0]
Process 17167 [17.92s Exited 0]
Process 17165 [173.1ms Exited 0]
Build finished, completed 5 jobs in 9:18.8
Writing output
Wrote output to /home/container/.local/share/brioche/installed

bash-5.2$ ruff --version
ruff 0.5.3
kylewlacy commented 1 month ago

Ah, looks like there will need to be an extra .toDirectory() method added to the std.process(...) call

jaudiger commented 1 month ago

Woah, I'm surprised how I tested it successfully (see PR's description). Nevertheless, I did the modification and here we go for the output:

bash-5.2$ brioche install -p packages/ruff
[179]    Compiling jod-thread v0.1.2                                                                                                                                                              
[179]    Compiling argfile v0.2.0                                                                                                                                                                 
[179]    Compiling notify v6.1.1                                                                                                                                                                  
[179]    Compiling clearscreen v3.0.0                                                                                                                                                             
[179]    Compiling rayon v1.10.0                                                                                                                                                                  
[179]    Compiling clap_complete_command v0.6.1                                                                                                                                                   
[179]    Compiling cachedir v0.3.1                                                                                                                                                                
[179]    Compiling ruff_linter v0.5.3 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26c61c43572c8/work/crates/ruff_linter)                                             
[179]    Compiling bincode v1.3.3                                                                                                                                                                 
[179]    Compiling wild v2.2.1                                                                                                                                                                    
[179]    Compiling ruff_workspace v0.0.0 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26c61c43572c8/work/crates/ruff_workspace)                                       
[179]    Compiling ruff_server v0.2.2 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26c61c43572c8/work/crates/ruff_server)                                             
[179]    Compiling tikv-jemallocator v0.6.0                                                                                                                                                       
[179]     Finished `release` profile [optimized] target(s) in 7m 39s                                                                                                                              
[179]   Installing /home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26c61c43572c8/.local/share/brioche/outputs/output-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26
c61c43572c8/bin/ruff                                                                                                                                                                              
[179]    Installed package `ruff v0.5.3 (/home/brioche-runner-d5be76f5f48436b982fa26da047d369eb7ce00bffeb3f7ee9ed26c61c43572c8/work/crates/ruff)` (executable `ruff`)                             

Process 179 [7:39.4 Exited 0]
Process 129 [12.39s Exited 0]
Process 123 [164.7ms Exited 0]
Build finished, completed 6 jobs in 8:56.9
Writing output
Wrote output to /home/container/.local/share/brioche/installed
bash-5.2$ ruff --version
ruff 0.5.3
kylewlacy commented 1 month ago

Woah, I'm surprised how I tested it successfully (see PR's description)

Typechecking is skipped by default when you call brioche build (unless you pass --check), so that’s probably what happened here, just a type error instead of a runtime error