Use ruff for Python development
This commit is contained in:
parent
9c7919b87b
commit
6573ecd6ad
1 changed files with 39 additions and 38 deletions
|
@ -12,47 +12,48 @@
|
|||
python3Packages.ipython
|
||||
];
|
||||
sessionVariables = {
|
||||
PYTHONSTARTUP = "${config.xdg.configHome}/pythonstartup.py";
|
||||
PYTHONSTARTUP = ./pythonstartup.py;
|
||||
};
|
||||
};
|
||||
programs.bash.shellAliases = {
|
||||
ipython = "ipython --no-confirm-exit --pdb";
|
||||
};
|
||||
programs.nixvim.plugins.lsp.servers.pylsp = {
|
||||
# Python
|
||||
enable = config.frogeye.dev.python;
|
||||
settings.plugins = {
|
||||
black.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 = {
|
||||
enabled = true;
|
||||
overrides = [
|
||||
"--cache-dir=${config.xdg.cacheHome}/mypy"
|
||||
"--ignore-missing-imports"
|
||||
"--disallow-untyped-defs"
|
||||
"--disallow-untyped-calls"
|
||||
"--disallow-incomplete-defs"
|
||||
"--disallow-untyped-decorators"
|
||||
true
|
||||
];
|
||||
};
|
||||
# TODO Could add some, could also remove some
|
||||
programs = {
|
||||
bash.shellAliases = {
|
||||
ipython = "ipython --no-confirm-exit --pdb";
|
||||
};
|
||||
};
|
||||
xdg.configFile = {
|
||||
"pythonstartup.py" = {
|
||||
text = (builtins.readFile ./pythonstartup.py);
|
||||
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
|
||||
enable = config.frogeye.dev.python;
|
||||
settings.plugins = {
|
||||
ruff.enabled = true;
|
||||
pylsp_mypy = {
|
||||
enabled = true;
|
||||
overrides = [
|
||||
"--cache-dir=${config.xdg.cacheHome}/mypy"
|
||||
"--ignore-missing-imports"
|
||||
"--disallow-untyped-defs"
|
||||
"--disallow-untyped-calls"
|
||||
"--disallow-incomplete-defs"
|
||||
"--disallow-untyped-decorators"
|
||||
true
|
||||
];
|
||||
};
|
||||
# TODO Could add some, could also remove some
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue