Use ruff for Python development

This commit is contained in:
Geoffrey Frogeye 2025-05-08 16:37:22 +02:00
parent 9c7919b87b
commit 6573ecd6ad

View file

@ -12,29 +12,34 @@
python3Packages.ipython python3Packages.ipython
]; ];
sessionVariables = { sessionVariables = {
PYTHONSTARTUP = "${config.xdg.configHome}/pythonstartup.py"; PYTHONSTARTUP = ./pythonstartup.py;
}; };
}; };
programs.bash.shellAliases = { programs = {
bash.shellAliases = {
ipython = "ipython --no-confirm-exit --pdb"; ipython = "ipython --no-confirm-exit --pdb";
}; };
programs.nixvim.plugins.lsp.servers.pylsp = { ruff = {
enable = true;
settings = {
lint = {
select = [
# Original
"F" # pyflakes
"I" # isort
"C90" # mccabe (complexity)
"E" # pycodestyle error
"W" # pycodestyle warning
"PL" # pylint
];
};
};
};
nixvim.plugins.lsp.servers.pylsp = {
# Python # Python
enable = config.frogeye.dev.python; enable = config.frogeye.dev.python;
settings.plugins = { settings.plugins = {
black.enabled = true; ruff.enabled = true;
flake8 = {
enabled = true;
maxLineLength = 88; # Compatibility with Black
};
isort.enabled = true;
mccabe.enabled = true;
pycodestyle = {
enabled = true;
maxLineLength = 88; # Compatibility with Black
};
pyflakes.enabled = true;
pylint.enabled = true;
pylsp_mypy = { pylsp_mypy = {
enabled = true; enabled = true;
overrides = [ overrides = [
@ -50,10 +55,6 @@
# TODO Could add some, could also remove some # TODO Could add some, could also remove some
}; };
}; };
xdg.configFile = {
"pythonstartup.py" = {
text = (builtins.readFile ./pythonstartup.py);
};
}; };
}; };
} }