Add pre-commit hook for nix users that does auto formatting + check with ruff and other improvements.#97
Conversation
|
Taking a look at prek this could actually be used for non-nix as it accepts another file, a prek.toml, for setting it up, which would allow for both the nix pre-commit git hooks to run with .pre-commit-config.yaml and have pre-commit hooks for non-nix users. It can also be installed with pip also. See: https://prek.j178.dev/quickstart/#new-to-pre-commit-style-workflows This would basically mean that once this is set up, we could autorun the ruff.sh script :> before committing (which happens on nix). So if you decided you wanted a pre-commit hook set up outside of Nix stuff, we still could. Could modify the venv activate script to install the pre-commit on run. only thin is there might need to be something to run a diff pre-commit script for windows right? |
|
Latest commit is lwk important for the devshell, I realised that direnv doesn't reload unless you change the main flake.nix file. So had to add to the .envrc to watch src and nix dirs so they get reloaded right. |
|
This one is a nice qol that will now always have the correct version in the nix package when building, figured out how to pull it from the pyproject.toml lol. I append the -git just cos it is building from the git main src. |
|
I fixed the pip devshell! Now we have the good one back :> |
|
I'm going to be real I have no interest in learning nix stuff right now & don't know much about nix flakes/packages. That being said, if you have no more changes to commit I'll merge it. |
|
Yeah, no more changes lol it's good 2 go |
Also on this note, I'm happy to maintain the nix package I made lol. Imma keep this package installed so that if it break I know. I'll also see if I can gently get myself back into contributing towards the python side again. :> |
Wishing you luck |
Another pr lol. Further this should help with nix users to format code up to standard and also run the ruff.sh script as well! I had to modify it to use
#!/usr/bin/env bashthough, which I believe is best practice for scripts anyway as not everyone has bash installed in/bin/bash, but I think env is univeral across unix systems I believe.Only thing with this is I'm not sure what would need to be done if you wanted to use AND have a separate pre-commit. Could add a generator for the yaml file ig. Although I can't see we use pre-commit on this without nix anyway.