NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.29k stars 13.54k forks source link

add a pyproject.toml at the root to help write valid python scripts in nixpkgs #329519

Open teto opened 1 month ago

teto commented 1 month ago

Issue description

I edit from times to times python files in nixpkgs (vim updater, lately the docker stream builder script etc). The experience is a bit frustrating because nixpkgs enforces flake8 rules (the build fails if lines are too long for instance https://github.com/NixOS/nixpkgs/issues/269811) but nixpkgs lacks the configuration files for these tools, which would help pass the checks.

For instance flake8 limit line length at 80. the vim update.py recommends to use black (a python formatter) which by default doesn't care about line length or with a default different than 80. Could we add a flake8 / black configuration to help edit python files in a way that conforms to nixpkgs' check ?

Apparently black can be configured by pyproject.toml in a [tool.black] section. Note that line length is not something supported by editorconfig.

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

eclairevoyant commented 1 month ago

Note that line length is not something supported by editorconfig.

There's max_line_length, though it's a can of worms...