dotfiles/hm/dev/python.nix
Geoffrey “Frogeye” Preud'homme bc6a91128d ruff: Don't default to 79 chars
Not what we want for other projects.
Could put a pyproject.toml here to enforce it,
but then it removes all the defaults set in user configuration, 
so uuuuuh
2025-05-15 22:33:09 +02:00

65 lines
1.7 KiB
Nix

{
pkgs,
lib,
config,
...
}:
{
config = lib.mkIf config.frogeye.dev.python {
home = {
packages = with pkgs; [
python3
python3Packages.ipython
];
sessionVariables = {
PYTHONSTARTUP = ./pythonstartup.py;
};
};
programs = {
bash.shellAliases = {
ipython = "ipython --no-confirm-exit --pdb";
};
ruff = {
enable = true;
settings = {
target-version = "py311"; # Matches Debian 12
lint = {
select = [ "ALL" ];
ignore = [
# Things only relevant in proper applications, but not scripts
"CPY" # Copyright
"D1" # missing docstring
"ERA" # commented out code
"FIX002" # enforce TODOs
"T20" # print
"TD" # TODOs convention
"INP" # missing __init__.py
"S603" # subproces untrusted input (broken?)
"S101" # asserts
# Allow nix-shell
"EXE003"
"EXE005"
# Conflict with formatter
"COM"
"ISC001"
];
pydocstyle.convention = "pep257";
};
};
};
nixvim.plugins.lsp.servers = lib.mkIf config.frogeye.dev.python {
ruff.enable = true;
basedpyright = {
enable = true;
settings.basedpyright = {
analysis = {
ignore = [ "*" ]; # Handled by ruff
typeCheckingMode = "standard"; # Should not be an hassle for scripting with untyped libraries
};
disableOrganizeImports = true; # Handled by ruff
};
};
};
};
};
}