summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Henrique Oliveira <contato@diegoholiveira.com>2024-09-05 03:37:30 -0300
committerGitHub <noreply@github.com>2024-09-05 15:37:30 +0900
commita7ef1817b7aa06d0f80952ad530be87ad3c8f6e2 (patch)
tree537f36c4c8d5bdaeb10eb29ffc5bb8e18ef55065
parent954682108d21b412561fb32e3fa766c7ee539984 (diff)
downloadale-a7ef1817b7aa06d0f80952ad530be87ad3c8f6e2.zip
Improve support for python package manage: pipenv, poetry and uv (#4825)
-rw-r--r--ale_linters/python/bandit.vim8
-rw-r--r--ale_linters/python/flake8.vim8
-rw-r--r--ale_linters/python/flakehell.vim8
-rw-r--r--ale_linters/python/jedils.vim14
-rw-r--r--ale_linters/python/mypy.vim8
-rw-r--r--ale_linters/python/prospector.vim8
-rw-r--r--ale_linters/python/pycln.vim8
-rw-r--r--ale_linters/python/pycodestyle.vim8
-rw-r--r--ale_linters/python/pydocstyle.vim8
-rw-r--r--ale_linters/python/pyflakes.vim8
-rw-r--r--ale_linters/python/pylama.vim10
-rw-r--r--ale_linters/python/pylint.vim8
-rw-r--r--ale_linters/python/pylsp.vim8
-rw-r--r--ale_linters/python/pyre.vim8
-rw-r--r--ale_linters/python/pyright.vim8
-rw-r--r--ale_linters/python/refurb.vim8
-rw-r--r--ale_linters/python/ruff.vim10
-rw-r--r--ale_linters/python/unimport.vim8
-rw-r--r--ale_linters/python/vulture.vim20
-rw-r--r--autoload/ale/fixers/autoflake.vim38
-rw-r--r--autoload/ale/fixers/autoimport.vim38
-rw-r--r--autoload/ale/fixers/autopep8.vim38
-rw-r--r--autoload/ale/fixers/black.vim8
-rw-r--r--autoload/ale/fixers/isort.vim10
-rw-r--r--autoload/ale/fixers/pycln.vim10
-rw-r--r--autoload/ale/fixers/pyflyby.vim8
-rw-r--r--autoload/ale/fixers/reorder_python_imports.vim38
-rw-r--r--autoload/ale/fixers/ruff.vim10
-rw-r--r--autoload/ale/fixers/ruff_format.vim10
-rw-r--r--autoload/ale/fixers/yapf.vim38
-rw-r--r--autoload/ale/python.vim7
-rw-r--r--doc/ale-python.txt379
-rw-r--r--plugin/ale.vim3
-rw-r--r--test-files/python/no_uv/whatever.py0
-rw-r--r--test/fixers/test_autoflake_fixer_callback.vader42
-rw-r--r--test/fixers/test_autoimport_fixer_callback.vader46
-rw-r--r--test/fixers/test_autopep8_fixer_callback.vader39
-rw-r--r--test/fixers/test_black_fixer_callback.vader10
-rw-r--r--test/fixers/test_isort_fixer_callback.vader13
-rw-r--r--test/fixers/test_pycln_fixer_callback.vader13
-rw-r--r--test/fixers/test_pyflyby_fixer_callback.vader11
-rw-r--r--test/fixers/test_reorder_python_imports_fixer_callback.vader43
-rw-r--r--test/fixers/test_ruff_fixer_callback.vader14
-rw-r--r--test/fixers/test_ruff_format_fixer_callback.vader13
-rw-r--r--test/fixers/test_yapf_fixer_callback.vader44
-rw-r--r--test/linter/test_bandit.vader10
-rw-r--r--test/linter/test_flake8.vader7
-rw-r--r--test/linter/test_flakehell.vader7
-rw-r--r--test/linter/test_jedils.vader14
-rw-r--r--test/linter/test_mypy.vader8
-rw-r--r--test/linter/test_prospector.vader8
-rw-r--r--test/linter/test_pycln.vader8
-rw-r--r--test/linter/test_pycodestyle.vader7
-rw-r--r--test/linter/test_pydocstyle.vader6
-rw-r--r--test/linter/test_pyflakes.vader7
-rw-r--r--test/linter/test_pylama.vader6
-rw-r--r--test/linter/test_pylint.vader8
-rw-r--r--test/linter/test_pylsp.vader7
-rw-r--r--test/linter/test_pyre.vader7
-rw-r--r--test/linter/test_pyright.vader7
-rw-r--r--test/linter/test_refurb.vader7
-rw-r--r--test/linter/test_ruff.vader8
-rw-r--r--test/linter/test_unimport.vader7
-rw-r--r--test/linter/test_vulture.vader22
-rw-r--r--test/test-files/python/uv/.gitkeep0
-rw-r--r--test/test-files/python/uv/uv.lock0
-rw-r--r--test/test-files/python/uv/whatever.py0
-rw-r--r--test/test_python_uv.vader19
68 files changed, 1154 insertions, 123 deletions
diff --git a/ale_linters/python/bandit.vim b/ale_linters/python/bandit.vim
index 9cfca7c0..ba48c3a8 100644
--- a/ale_linters/python/bandit.vim
+++ b/ale_linters/python/bandit.vim
@@ -7,6 +7,7 @@ call ale#Set('python_bandit_use_config', 1)
call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_bandit_auto_pipenv', 0)
call ale#Set('python_bandit_auto_poetry', 0)
+call ale#Set('python_bandit_auto_uv', 0)
function! ale_linters#python#bandit#GetExecutable(buffer) abort
if (
@@ -23,6 +24,11 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_bandit_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit'])
endfunction
@@ -39,7 +45,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort
endif
endif
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run bandit'
\ : ''
diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim
index 9950614a..12dca84a 100644
--- a/ale_linters/python/flake8.vim
+++ b/ale_linters/python/flake8.vim
@@ -7,6 +7,7 @@ call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0
call ale#Set('python_flake8_change_directory', 'project')
call ale#Set('python_flake8_auto_pipenv', 0)
call ale#Set('python_flake8_auto_poetry', 0)
+call ale#Set('python_flake8_auto_uv', 0)
function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
@@ -23,6 +24,11 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flake8_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
if !s:UsingModule(a:buffer)
return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8'])
endif
@@ -68,7 +74,7 @@ endfunction
function! ale_linters#python#flake8#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run flake8'
\ : ''
diff --git a/ale_linters/python/flakehell.vim b/ale_linters/python/flakehell.vim
index ffe87e29..9ff0f18f 100644
--- a/ale_linters/python/flakehell.vim
+++ b/ale_linters/python/flakehell.vim
@@ -7,6 +7,7 @@ call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables'
call ale#Set('python_flakehell_change_directory', 'project')
call ale#Set('python_flakehell_auto_pipenv', 0)
call ale#Set('python_flakehell_auto_poetry', 0)
+call ale#Set('python_flakehell_auto_uv', 0)
function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python'
@@ -23,6 +24,11 @@ function! ale_linters#python#flakehell#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flakehell_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
if !s:UsingModule(a:buffer)
return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell'])
endif
@@ -68,7 +74,7 @@ endfunction
function! ale_linters#python#flakehell#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer)
- if (l:executable =~? 'pipenv\|poetry$')
+ if (l:executable =~? 'pipenv\|poetry\|uv$')
let l:exec_args = ' run flakehell'
elseif (l:executable is? 'python')
let l:exec_args = ' -m flakehell'
diff --git a/ale_linters/python/jedils.vim b/ale_linters/python/jedils.vim
index e82abd1b..46b2896b 100644
--- a/ale_linters/python/jedils.vim
+++ b/ale_linters/python/jedils.vim
@@ -4,6 +4,8 @@
call ale#Set('python_jedils_executable', 'jedi-language-server')
call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_jedils_auto_pipenv', 0)
+call ale#Set('python_jedils_auto_poetry', 0)
+call ale#Set('python_jedils_auto_uv', 0)
function! ale_linters#python#jedils#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv'))
@@ -11,12 +13,22 @@ function! ale_linters#python#jedils#GetExecutable(buffer) abort
return 'pipenv'
endif
+ if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_jedils_auto_poetry'))
+ \ && ale#python#PoetryPresent(a:buffer)
+ return 'poetry'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_jedils_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server'])
endfunction
function! ale_linters#python#jedils#GetCommand(buffer) abort
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run jedi-language-server'
\ : ''
let l:env_string = ''
diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim
index 9d469a1a..586a4381 100644
--- a/ale_linters/python/mypy.vim
+++ b/ale_linters/python/mypy.vim
@@ -8,6 +8,7 @@ call ale#Set('python_mypy_options', '')
call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_mypy_auto_pipenv', 0)
call ale#Set('python_mypy_auto_poetry', 0)
+call ale#Set('python_mypy_auto_uv', 0)
function! ale_linters#python#mypy#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv'))
@@ -20,6 +21,11 @@ function! ale_linters#python#mypy#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_mypy_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
endfunction
@@ -43,7 +49,7 @@ endfunction
function! ale_linters#python#mypy#GetCommand(buffer) abort
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run mypy'
\ : ''
diff --git a/ale_linters/python/prospector.vim b/ale_linters/python/prospector.vim
index 3623bda0..c40f25c5 100644
--- a/ale_linters/python/prospector.vim
+++ b/ale_linters/python/prospector.vim
@@ -3,6 +3,7 @@
call ale#Set('python_prospector_auto_pipenv', 0)
call ale#Set('python_prospector_auto_poetry', 0)
+call ale#Set('python_prospector_auto_uv', 0)
let g:ale_python_prospector_executable =
\ get(g:, 'ale_python_prospector_executable', 'prospector')
@@ -23,13 +24,18 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_prospector_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
endfunction
function! ale_linters#python#prospector#GetCommand(buffer) abort
let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run prospector'
\ : ''
diff --git a/ale_linters/python/pycln.vim b/ale_linters/python/pycln.vim
index 917a9757..774c6b04 100644
--- a/ale_linters/python/pycln.vim
+++ b/ale_linters/python/pycln.vim
@@ -7,6 +7,7 @@ call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_pycln_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0)
+call ale#Set('python_pycln_auto_uv', 0)
call ale#Set('python_pycln_config_file', '')
function! ale_linters#python#pycln#GetExecutable(buffer) abort
@@ -20,6 +21,11 @@ function! ale_linters#python#pycln#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction
@@ -36,7 +42,7 @@ endfunction
function! ale_linters#python#pycln#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pycln#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pycln'
\ : ''
diff --git a/ale_linters/python/pycodestyle.vim b/ale_linters/python/pycodestyle.vim
index 3fb94d69..bd3584b8 100644
--- a/ale_linters/python/pycodestyle.vim
+++ b/ale_linters/python/pycodestyle.vim
@@ -6,6 +6,7 @@ call ale#Set('python_pycodestyle_options', '')
call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pycodestyle_auto_pipenv', 0)
call ale#Set('python_pycodestyle_auto_poetry', 0)
+call ale#Set('python_pycodestyle_auto_uv', 0)
function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv'))
@@ -18,13 +19,18 @@ function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycodestyle_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
endfunction
function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pycodestyle'
\ : ''
diff --git a/ale_linters/python/pydocstyle.vim b/ale_linters/python/pydocstyle.vim
index ef0d818c..b012dd43 100644
--- a/ale_linters/python/pydocstyle.vim
+++ b/ale_linters/python/pydocstyle.vim
@@ -6,6 +6,7 @@ call ale#Set('python_pydocstyle_options', '')
call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pydocstyle_auto_pipenv', 0)
call ale#Set('python_pydocstyle_auto_poetry', 0)
+call ale#Set('python_pydocstyle_auto_uv', 0)
function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv'))
@@ -18,12 +19,17 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pydocstyle_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
endfunction
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pydocstyle'
\ : ''
diff --git a/ale_linters/python/pyflakes.vim b/ale_linters/python/pyflakes.vim
index 2567c533..fc0a3fa7 100644
--- a/ale_linters/python/pyflakes.vim
+++ b/ale_linters/python/pyflakes.vim
@@ -5,6 +5,7 @@ call ale#Set('python_pyflakes_executable', 'pyflakes')
call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyflakes_auto_pipenv', 0)
call ale#Set('python_pyflakes_auto_poetry', 0)
+call ale#Set('python_pyflakes_auto_uv', 0)
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv'))
@@ -17,13 +18,18 @@ function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflakes_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
endfunction
function! ale_linters#python#pyflakes#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pyflakes'
\ : ''
diff --git a/ale_linters/python/pylama.vim b/ale_linters/python/pylama.vim
index 14f8071a..6555b409 100644
--- a/ale_linters/python/pylama.vim
+++ b/ale_linters/python/pylama.vim
@@ -6,6 +6,7 @@ call ale#Set('python_pylama_options', '')
call ale#Set('python_pylama_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pylama_auto_pipenv', 0)
call ale#Set('python_pylama_auto_poetry', 0)
+call ale#Set('python_pylama_auto_uv', 0)
call ale#Set('python_pylama_change_directory', 1)
function! ale_linters#python#pylama#GetExecutable(buffer) abort
@@ -19,12 +20,17 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylama_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama'])
endfunction
function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylama'
\ : ''
@@ -53,7 +59,7 @@ endfunction
function! ale_linters#python#pylama#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylama'
\ : ''
diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim
index 2ce5376f..90aa5f1c 100644
--- a/ale_linters/python/pylint.vim
+++ b/ale_linters/python/pylint.vim
@@ -7,6 +7,7 @@ call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0
call ale#Set('python_pylint_change_directory', 1)
call ale#Set('python_pylint_auto_pipenv', 0)
call ale#Set('python_pylint_auto_poetry', 0)
+call ale#Set('python_pylint_auto_uv', 0)
call ale#Set('python_pylint_use_msg_id', 0)
function! ale_linters#python#pylint#GetExecutable(buffer) abort
@@ -20,6 +21,11 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylint_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
endfunction
@@ -38,7 +44,7 @@ endfunction
function! ale_linters#python#pylint#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylint'
\ : ''
diff --git a/ale_linters/python/pylsp.vim b/ale_linters/python/pylsp.vim
index a1c31018..d3db6e82 100644
--- a/ale_linters/python/pylsp.vim
+++ b/ale_linters/python/pylsp.vim
@@ -6,6 +6,7 @@ call ale#Set('python_pylsp_options', '')
call ale#Set('python_pylsp_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pylsp_auto_pipenv', 0)
call ale#Set('python_pylsp_auto_poetry', 0)
+call ale#Set('python_pylsp_auto_uv', 0)
call ale#Set('python_pylsp_config', {})
function! ale_linters#python#pylsp#GetExecutable(buffer) abort
@@ -19,6 +20,11 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylsp_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
endfunction
@@ -37,7 +43,7 @@ endfunction
function! ale_linters#python#pylsp#GetCommand(buffer) abort
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pylsp'
\ : ''
let l:env_string = ''
diff --git a/ale_linters/python/pyre.vim b/ale_linters/python/pyre.vim
index 5e5786f9..177f1cb5 100644
--- a/ale_linters/python/pyre.vim
+++ b/ale_linters/python/pyre.vim
@@ -5,6 +5,7 @@ call ale#Set('python_pyre_executable', 'pyre')
call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyre_auto_pipenv', 0)
call ale#Set('python_pyre_auto_poetry', 0)
+call ale#Set('python_pyre_auto_uv', 0)
function! ale_linters#python#pyre#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv'))
@@ -17,12 +18,17 @@ function! ale_linters#python#pyre#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyre_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre'])
endfunction
function! ale_linters#python#pyre#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer)
- let l:exec_args = (l:executable =~? 'pipenv\|poetry$' ? ' run pyre' : '') . ' persistent'
+ let l:exec_args = (l:executable =~? 'pipenv\|poetry\|uv$' ? ' run pyre' : '') . ' persistent'
return ale#Escape(l:executable) . l:exec_args
endfunction
diff --git a/ale_linters/python/pyright.vim b/ale_linters/python/pyright.vim
index e41f7f14..993ed075 100644
--- a/ale_linters/python/pyright.vim
+++ b/ale_linters/python/pyright.vim
@@ -3,6 +3,7 @@ call ale#Set('python_pyright_executable', 'pyright-langserver')
call ale#Set('python_pyright_config', {})
call ale#Set('python_pyright_auto_pipenv', 0)
call ale#Set('python_pyright_auto_poetry', 0)
+call ale#Set('python_pyright_auto_uv', 0)
" Force the cwd of the server to be the same as the project root to
" fix issues with treating local files matching first or third party library
@@ -59,12 +60,17 @@ function! ale_linters#python#pyright#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyright_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pyright', ['pyright-langserver'])
endfunction
function! ale_linters#python#pyright#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pyright-langserver'
\ : ''
let l:env_string = ''
diff --git a/ale_linters/python/refurb.vim b/ale_linters/python/refurb.vim
index 1ae77b77..7f92948a 100644
--- a/ale_linters/python/refurb.vim
+++ b/ale_linters/python/refurb.vim
@@ -7,6 +7,7 @@ call ale#Set('python_refurb_use_global', get(g:, 'ale_use_global_executables', 0
call ale#Set('python_refurb_change_directory', 1)
call ale#Set('python_refurb_auto_pipenv', 0)
call ale#Set('python_refurb_auto_poetry', 0)
+call ale#Set('python_refurb_auto_uv', 0)
function! ale_linters#python#refurb#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_refurb_auto_pipenv'))
@@ -19,6 +20,11 @@ function! ale_linters#python#refurb#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_refurb_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_refurb', ['refurb'])
endfunction
@@ -35,7 +41,7 @@ endfunction
function! ale_linters#python#refurb#GetCommand(buffer) abort
let l:executable = ale_linters#python#refurb#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run refurb'
\ : ''
diff --git a/ale_linters/python/ruff.vim b/ale_linters/python/ruff.vim
index f30d42c0..25ae2d91 100644
--- a/ale_linters/python/ruff.vim
+++ b/ale_linters/python/ruff.vim
@@ -7,6 +7,7 @@ call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_ruff_change_directory', 1)
call ale#Set('python_ruff_auto_pipenv', 0)
call ale#Set('python_ruff_auto_poetry', 0)
+call ale#Set('python_ruff_auto_uv', 0)
call ale#fix#registry#Add('ruff',
\ 'ale#fixers#ruff#Fix',
@@ -25,6 +26,11 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction
@@ -41,7 +47,7 @@ endfunction
function! ale_linters#python#ruff#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run ruff'
\ : ''
@@ -49,7 +55,7 @@ function! ale_linters#python#ruff#GetCommand(buffer, version) abort
let l:exec_args = l:exec_args
\ . (ale#semver#GTE(a:version, [0, 3, 0]) ? ' check' : '')
- " NOTE: ruff version `0.0.69` supports liniting input from stdin
+ " NOTE: ruff version `0.0.69` supports linting input from stdin
" NOTE: ruff version `0.1.0` deprecates `--format text`
return ale#Escape(l:executable) . l:exec_args . ' -q'
\ . ' --no-fix'
diff --git a/ale_linters/python/unimport.vim b/ale_linters/python/unimport.vim
index 71fd80f0..06dbc436 100644
--- a/ale_linters/python/unimport.vim
+++ b/ale_linters/python/unimport.vim
@@ -5,6 +5,7 @@ call ale#Set('python_unimport_options', '')
call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_unimport_auto_pipenv', 0)
call ale#Set('python_unimport_auto_poetry', 0)
+call ale#Set('python_unimport_auto_uv', 0)
function! ale_linters#python#unimport#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv'))
@@ -17,12 +18,17 @@ function! ale_linters#python#unimport#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_unimport_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
endfunction
function! ale_linters#python#unimport#GetCommand(buffer) abort
let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run unimport'
\ : ''
diff --git a/ale_linters/python/vulture.vim b/ale_linters/python/vulture.vim
index a7ba1860..2ac05e43 100644
--- a/ale_linters/python/vulture.vim
+++ b/ale_linters/python/vulture.vim
@@ -5,6 +5,9 @@ call ale#Set('python_vulture_executable', 'vulture')
call ale#Set('python_vulture_options', '')
call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_vulture_change_directory', 1)
+call ale#Set('python_vulture_auto_pipenv', 0)
+call ale#Set('python_vulture_auto_poetry', 0)
+call ale#Set('python_vulture_auto_uv', 0)
" The directory to change to before running vulture
function! s:GetDir(buffer) abort
@@ -16,6 +19,21 @@ function! s:GetDir(buffer) abort
endfunction
function! ale_linters#python#vulture#GetExecutable(buffer) abort
+ if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_vulture_auto_pipenv'))
+ \ && ale#python#PipenvPresent(a:buffer)
+ return 'pipenv'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_vulture_auto_poetry'))
+ \ && ale#python#PoetryPresent(a:buffer)
+ return 'poetry'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_vulture_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture'])
endfunction
@@ -29,7 +47,7 @@ endfunction
function! ale_linters#python#vulture#GetCommand(buffer) abort
let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run vulture'
\ : ''
let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory')
diff --git a/autoload/ale/fixers/autoflake.vim b/autoload/ale/fixers/autoflake.vim
index e2ad6536..c2530051 100644
--- a/autoload/ale/fixers/autoflake.vim
+++ b/autoload/ale/fixers/autoflake.vim
@@ -4,22 +4,40 @@
call ale#Set('python_autoflake_executable', 'autoflake')
call ale#Set('python_autoflake_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_autoflake_options', '')
+call ale#Set('python_autoflake_auto_pipenv', 0)
+call ale#Set('python_autoflake_auto_poetry', 0)
+call ale#Set('python_autoflake_auto_uv', 0)
-function! ale#fixers#autoflake#Fix(buffer) abort
- let l:executable = ale#python#FindExecutable(
- \ a:buffer,
- \ 'python_autoflake',
- \ ['autoflake'],
- \)
-
- if !executable(l:executable)
- return 0
+function! ale#fixers#autoflake#GetExecutable(buffer) abort
+ if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autoflake_auto_pipenv'))
+ \ && ale#python#PipenvPresent(a:buffer)
+ return 'pipenv'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autoflake_auto_poetry'))
+ \ && ale#python#PoetryPresent(a:buffer)
+ return 'poetry'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autoflake_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
endif
+ return ale#python#FindExecutable(a:buffer, 'python_autoflake', ['autoflake'])
+endfunction
+
+function! ale#fixers#autoflake#Fix(buffer) abort
+ let l:executable = ale#fixers#autoflake#GetExecutable(a:buffer)
+
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
+ \ ? ' run autoflake'
+ \ : ''
+
let l:options = ale#Var(a:buffer, 'python_autoflake_options')
return {
- \ 'command': ale#Escape(l:executable)
+ \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --in-place '
\ . ' %t',
diff --git a/autoload/ale/fixers/autoimport.vim b/autoload/ale/fixers/autoimport.vim
index 700d36b5..686da124 100644
--- a/autoload/ale/fixers/autoimport.vim
+++ b/autoload/ale/fixers/autoimport.vim
@@ -4,23 +4,41 @@
call ale#Set('python_autoimport_executable', 'autoimport')
call ale#Set('python_autoimport_options', '')
call ale#Set('python_autoimport_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('python_autoimport_auto_pipenv', 0)
+call ale#Set('python_autoimport_auto_poetry', 0)
+call ale#Set('python_autoimport_auto_uv', 0)
-function! ale#fixers#autoimport#Fix(buffer) abort
- let l:options = ale#Var(a:buffer, 'python_autoimport_options')
+function! ale#fixers#autoimport#GetExecutable(buffer) abort
+ if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autoimport_auto_pipenv'))
+ \ && ale#python#PipenvPresent(a:buffer)
+ return 'pipenv'
+ endif
- let l:executable = ale#python#FindExecutable(
- \ a:buffer,
- \ 'python_autoimport',
- \ ['autoimport'],
- \)
+ if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autoimport_auto_poetry'))
+ \ && ale#python#PoetryPresent(a:buffer)
+ return 'poetry'
+ endif
- if !executable(l:executable)
- return 0
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autoimport_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
endif
+ return ale#python#FindExecutable(a:buffer, 'python_autoimport', ['autoimport'])
+endfunction
+
+function! ale#fixers#autoimport#Fix(buffer) abort
+ let l:executable = ale#fixers#autoimport#GetExecutable(a:buffer)
+
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
+ \ ? ' run autoimport'
+ \ : ''
+
+ let l:options = ale#Var(a:buffer, 'python_autoimport_options')
+
return {
\ 'cwd': '%s:h',
- \ 'command': ale#Escape(l:executable)
+ \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}
diff --git a/autoload/ale/fixers/autopep8.vim b/autoload/ale/fixers/autopep8.vim
index 5798d827..6b5adfce 100644
--- a/autoload/ale/fixers/autopep8.vim
+++ b/autoload/ale/fixers/autopep8.vim
@@ -4,22 +4,40 @@
call ale#Set('python_autopep8_executable', 'autopep8')
call ale#Set('python_autopep8_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_autopep8_options', '')
+call ale#Set('python_autopep8_auto_pipenv', 0)
+call ale#Set('python_autopep8_auto_poetry', 0)
+call ale#Set('python_autopep8_auto_uv', 0)
-function! ale#fixers#autopep8#Fix(buffer) abort
- let l:executable = ale#python#FindExecutable(
- \ a:buffer,
- \ 'python_autopep8',
- \ ['autopep8'],
- \)
-
- if !executable(l:executable)
- return 0
+function! ale#fixers#autopep8#GetExecutable(buffer) abort
+ if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autopep8_auto_pipenv'))
+ \ && ale#python#PipenvPresent(a:buffer)
+ return 'pipenv'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autopep8_auto_poetry'))
+ \ && ale#python#PoetryPresent(a:buffer)
+ return 'poetry'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autopep8_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
endif
+ return ale#python#FindExecutable(a:buffer, 'python_autopep8', ['autopep8'])
+endfunction
+
+function! ale#fixers#autopep8#Fix(buffer) abort
+ let l:executable = ale#fixers#autopep8#GetExecutable(a:buffer)
+
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
+ \ ? ' run autopep8'
+ \ : ''
+
let l:options = ale#Var(a:buffer, 'python_autopep8_options')
return {
- \ 'command': ale#Escape(l:executable)
+ \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}
diff --git a/autoload/ale/fixers/black.vim b/autoload/ale/fixers/black.vim
index 4a88c5cd..4fe239ff 100644
--- a/autoload/ale/fixers/black.vim
+++ b/autoload/ale/fixers/black.vim
@@ -6,6 +6,7 @@ call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_black_options', '')
call ale#Set('python_black_auto_pipenv', 0)
call ale#Set('python_black_auto_poetry', 0)
+call ale#Set('python_black_auto_uv', 0)
call ale#Set('python_black_change_directory', 1)
function! ale#fixers#black#GetExecutable(buffer) abort
@@ -19,6 +20,11 @@ function! ale#fixers#black#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_black_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_black', ['black'])
endfunction
@@ -26,7 +32,7 @@ function! ale#fixers#black#Fix(buffer) abort
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
- if l:executable =~? 'pipenv\|poetry$'
+ if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'black'])
endif
diff --git a/autoload/ale/fixers/isort.vim b/autoload/ale/fixers/isort.vim
index 6eb6a67c..c4eef3cc 100644
--- a/autoload/ale/fixers/isort.vim
+++ b/autoload/ale/fixers/isort.vim
@@ -6,6 +6,7 @@ call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_isort_options', '')
call ale#Set('python_isort_auto_pipenv', 0)
call ale#Set('python_isort_auto_poetry', 0)
+call ale#Set('python_isort_auto_uv', 0)
function! ale#fixers#isort#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv'))
@@ -18,6 +19,11 @@ function! ale#fixers#isort#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_isort_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort'])
endfunction
@@ -25,7 +31,7 @@ function! ale#fixers#isort#GetCmd(buffer) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
- if l:executable =~? 'pipenv\|poetry$'
+ if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'isort'])
endif
@@ -36,7 +42,7 @@ function! ale#fixers#isort#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
- if l:executable =~? 'pipenv\|poetry$'
+ if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'isort'])
endif
diff --git a/autoload/ale/fixers/pycln.vim b/autoload/ale/fixers/pycln.vim
index 1f61d083..4ee2373d 100644
--- a/autoload/ale/fixers/pycln.vim
+++ b/autoload/ale/fixers/pycln.vim
@@ -7,6 +7,7 @@ call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0)
call ale#Set('python_pycln_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0)
+call ale#Set('python_pycln_auto_uv', 0)
call ale#Set('python_pycln_config_file', '')
function! ale#fixers#pycln#GetCwd(buffer) abort
@@ -31,12 +32,17 @@ function! ale#fixers#pycln#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction
function! ale#fixers#pycln#GetCommand(buffer) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pycln'
\ : ''
@@ -47,7 +53,7 @@ function! ale#fixers#pycln#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
- if l:executable =~? 'pipenv\|poetry$'
+ if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'pycln'])
endif
diff --git a/autoload/ale/fixers/pyflyby.vim b/autoload/ale/fixers/pyflyby.vim
index 81c0f05e..f6f289e3 100644
--- a/autoload/ale/fixers/pyflyby.vim
+++ b/autoload/ale/fixers/pyflyby.vim
@@ -7,6 +7,7 @@ call ale#Set('python_pyflyby_use_global', get(g:, 'ale_use_global_executables',
call ale#Set('python_pyflyby_options', '')
call ale#Set('python_pyflyby_auto_pipenv', 0)
call ale#Set('python_pyflyby_auto_poetry', 0)
+call ale#Set('python_pyflyby_auto_uv', 0)
function! ale#fixers#pyflyby#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflyby_auto_pipenv'))
@@ -19,6 +20,11 @@ function! ale#fixers#pyflyby#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflyby_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_pyflyby', ['tidy-imports'])
endfunction
@@ -27,7 +33,7 @@ function! ale#fixers#pyflyby#Fix(buffer) abort
let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
- if l:executable =~? 'pipenv\|poetry$'
+ if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'tidy-imports'])
endif
diff --git a/autoload/ale/fixers/reorder_python_imports.vim b/autoload/ale/fixers/reorder_python_imports.vim
index 42a0a6e2..3cc76a9f 100644
--- a/autoload/ale/fixers/reorder_python_imports.vim
+++ b/autoload/ale/fixers/reorder_python_imports.vim
@@ -4,22 +4,40 @@
call ale#Set('python_reorder_python_imports_executable', 'reorder-python-imports')
call ale#Set('python_reorder_python_imports_options', '')
call ale#Set('python_reorder_python_imports_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('python_reorder_python_imports_auto_pipenv', 0)
+call ale#Set('python_reorder_python_imports_auto_poetry', 0)
+call ale#Set('python_reorder_python_imports_auto_uv', 0)
-function! ale#fixers#reorder_python_imports#Fix(buffer) abort
- let l:executable = ale#python#FindExecutable(
- \ a:buffer,
- \ 'python_reorder_python_imports',
- \ ['reorder-python-imports'],
- \)
-
- if !executable(l:executable)
- return 0
+function! ale#fixers#reorder_python_imports#GetExecutable(buffer) abort
+ if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_pipenv'))
+ \ && ale#python#PipenvPresent(a:buffer)
+ return 'pipenv'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_poetry'))
+ \ && ale#python#PoetryPresent(a:buffer)
+ return 'poetry'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
endif
+ return ale#python#FindExecutable(a:buffer, 'python_reorder_python_imports', ['reorder-python-imports'])
+endfunction
+
+function! ale#fixers#reorder_python_imports#Fix(buffer) abort
+ let l:executable = ale#fixers#reorder_python_imports#GetExecutable(a:buffer)
+
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
+ \ ? ' run reorder-python-imports'
+ \ : ''
+
let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options')
return {
- \ 'command': ale#Escape(l:executable)
+ \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\}
endfunction
diff --git a/autoload/ale/fixers/ruff.vim b/autoload/ale/fixers/ruff.vim
index 275f79b0..c2bea3e3 100644
--- a/autoload/ale/fixers/ruff.vim
+++ b/autoload/ale/fixers/ruff.vim
@@ -7,6 +7,7 @@ call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_ruff_change_directory', 1)
call ale#Set('python_ruff_auto_pipenv', 0)
call ale#Set('python_ruff_auto_poetry', 0)
+call ale#Set('python_ruff_auto_uv', 0)
function! ale#fixers#ruff#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_change_directory')
@@ -30,12 +31,17 @@ function! ale#fixers#ruff#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction
function! ale#fixers#ruff#GetCommand(buffer) abort
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run ruff'
\ : ''
@@ -46,7 +52,7 @@ function! ale#fixers#ruff#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
- if l:executable =~? 'pipenv\|poetry$'
+ if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'ruff'])
endif
diff --git a/autoload/ale/fixers/ruff_format.vim b/autoload/ale/fixers/ruff_format.vim
index 86858745..e852dd24 100644
--- a/autoload/ale/fixers/ruff_format.vim
+++ b/autoload/ale/fixers/ruff_format.vim
@@ -7,6 +7,7 @@ call ale#Set('python_ruff_format_use_global', get(g:, 'ale_use_global_executable
call ale#Set('python_ruff_format_change_directory', 1)
call ale#Set('python_ruff_format_auto_pipenv', 0)
call ale#Set('python_ruff_format_auto_poetry', 0)
+call ale#Set('python_ruff_format_auto_uv', 0)
function! ale#fixers#ruff_format#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_format_change_directory')
@@ -30,12 +31,17 @@ function! ale#fixers#ruff_format#GetExecutable(buffer) abort
return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_format_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
return ale#python#FindExecutable(a:buffer, 'python_ruff_format', ['ruff'])
endfunction
function! ale#fixers#ruff_format#GetCommand(buffer) abort
let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv\|poetry$'
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run ruff'
\ : ''
@@ -46,7 +52,7 @@ function! ale#fixers#ruff_format#Fix(buffer) abort
let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
- if l:executable =~? 'pipenv\|poetry$'
+ if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'ruff'])
endif
diff --git a/autoload/ale/fixers/yapf.vim b/autoload/ale/fixers/yapf.vim
index f04bb1f9..22822a6e 100644
--- a/autoload/ale/fixers/yapf.vim
+++ b/autoload/ale/fixers/yapf.vim
@@ -3,24 +3,42 @@
call ale#Set('python_yapf_executable', 'yapf')
call ale#Set('python_yapf_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('python_yapf_auto_pipenv', 0)
+call ale#Set('python_yapf_auto_poetry', 0)
+call ale#Set('python_yapf_auto_uv', 0)
-function! ale#fixers#yapf#Fix(buffer) abort
- let l:executable = ale#python#FindExecutable(
- \ a:buffer,
- \ 'python_yapf',
- \ ['yapf'],
- \)
-
- if !executable(l:executable)
- return 0
+function! ale#fixers#yapf#GetExecutable(buffer) abort
+ if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_yapf_auto_pipenv'))
+ \ && ale#python#PipenvPresent(a:buffer)
+ return 'pipenv'
+ endif
+
+ if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_yapf_auto_poetry'))
+ \ && ale#python#PoetryPresent(a:buffer)
+ return 'poetry'
endif
+ if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_yapf_auto_uv'))
+ \ && ale#python#UvPresent(a:buffer)
+ return 'uv'
+ endif
+
+ return ale#python#FindExecutable(a:buffer, 'python_yapf', ['yapf'])
+endfunction
+
+function! ale#fixers#yapf#Fix(buffer) abort
+ let l:executable = ale#fixers#yapf#GetExecutable(a:buffer)
+
+ let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
+ \ ? ' run yapf'
+ \ : ''
+
let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf')
let l:config_options = !empty(l:config)
\ ? ' --no-local-style --style ' . ale#Escape(l:config)
\ : ''
return {
- \ 'command': ale#Escape(l:executable) . l:config_options,
+ \ 'command': ale#Escape(l:executable) . l:exec_args . l:config_options,
\}
endfunction
diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim
index 2c7e0049..9eb198fb 100644
--- a/autoload/ale/python.vim
+++ b/autoload/ale/python.vim
@@ -3,6 +3,7 @@
call ale#Set('python_auto_pipenv', '0')
call ale#Set('python_auto_poetry', '0')
+call ale#Set('python_auto_uv', '0')
let s:sep = has('win32') ? '\' : '/'
" bin is used for Unix virtualenv directories, and Scripts is for Windows.
@@ -43,6 +44,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/poetry.lock')
\|| filereadable(l:path . '/pyproject.toml')
\|| filereadable(l:path . '/.tool-versions')
+ \|| filereadable(l:path . '/uv.lock')
return l:path
endif
endfor
@@ -192,3 +194,8 @@ endfunction
function! ale#python#PoetryPresent(buffer) abort
return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
endfunction
+
+" Detects whether a poetry environment is present.
+function! ale#python#UvPresent(buffer) abort
+ return findfile('uv.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
+endfunction
diff --git a/doc/ale-python.txt b/doc/ale-python.txt
index ec118c5a..4798baaf 100644
--- a/doc/ale-python.txt
+++ b/doc/ale-python.txt
@@ -20,6 +20,15 @@ g:ale_python_auto_poetry *g:ale_python_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_auto_uv *g:ale_python_auto_uv*
+ *b:ale_python_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
g:ale_python_auto_virtualenv *g:ale_python_auto_virtualenv*
*b:ale_python_auto_virtualenv*
Type: |Number|
@@ -96,6 +105,33 @@ g:ale_python_autoflake_use_global *g:ale_python_autoflake_use_global*
See |ale-integrations-local-executables|
+g:ale_python_autoflake_auto_pipenv *g:ale_python_autoflake_auto_pipenv*
+ *b:ale_python_autoflake_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_autoflake_auto_poetry *g:ale_python_autoflake_auto_poetry*
+ *b:ale_python_autoflake_auto_poetry*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a poetry, and set the executable to `poetry`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_autoflake_auto_uv *g:ale_python_autoflake_auto_uv*
+ *b:ale_python_autoflake_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
autoimport *ale-python-autoimport*
@@ -123,6 +159,33 @@ g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_global*
See |ale-integrations-local-executables|
+g:ale_python_autoimport_auto_pipenv *g:ale_python_autoimport_auto_pipenv*
+ *b:ale_python_autoimport_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_autoimport_auto_poetry *g:ale_python_autoimport_auto_poetry*
+ *b:ale_python_autoimport_auto_poetry*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a poetry, and set the executable to `poetry`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_autoimport_auto_uv *g:ale_python_autoimport_auto_uv*
+ *b:ale_python_autoimport_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
autopep8 *ale-python-autopep8*
@@ -150,6 +213,33 @@ g:ale_python_autopep8_use_global *g:ale_python_autopep8_use_global*
See |ale-integrations-local-executables|
+g:ale_python_autopep8_auto_pipenv *g:ale_python_autopep8_auto_pipenv*
+ *b:ale_python_autopep8_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_autopep8_auto_poetry *g:ale_python_autopep8_auto_poetry*
+ *b:ale_python_autopep8_auto_poetry*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a poetry, and set the executable to `poetry`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_autopep8_auto_uv *g:ale_python_autopep8_auto_uv*
+ *b:ale_python_autopep8_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
bandit *ale-python-bandit*
@@ -210,6 +300,15 @@ g:ale_python_bandit_auto_poetry *g:ale_python_bandit_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_bandit_auto_uv *g:ale_python_bandit_auto_uv*
+ *b:ale_python_bandit_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
black *ale-python-black*
@@ -255,6 +354,15 @@ g:ale_python_black_auto_poetry *g:ale_python_black_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_black_auto_uv *g:ale_python_black_auto_uv*
+ *b:ale_python_black_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
g:ale_python_black_change_directory *g:ale_python_black_change_directory*
*b:ale_python_black_change_directory*
Type: |Number|
@@ -345,6 +453,15 @@ g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_flake8_auto_uv *g:ale_python_flake8_auto_uv*
+ *b:ale_python_flake8_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
flakehell *ale-python-flakehell*
@@ -410,6 +527,15 @@ g:ale_python_flakehell_auto_poetry *g:ale_python_flakehell_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_flakehell_auto_uv *g:ale_python_flakehell_auto_uv*
+ *b:ale_python_flakehell_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
isort *ale-python-isort*
@@ -455,6 +581,15 @@ g:ale_python_isort_auto_poetry *g:ale_python_isort_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_isort_auto_uv *g:ale_python_isort_auto_uv*
+ *b:ale_python_isort_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
mypy *ale-python-mypy*
@@ -483,6 +618,15 @@ g:ale_python_mypy_auto_poetry *g:ale_python_mypy_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_mypy_auto_uv *g:ale_python_mypy_auto_uv*
+ *b:ale_python_mypy_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
g:ale_python_mypy_executable *g:ale_python_mypy_executable*
*b:ale_python_mypy_executable*
Type: |String|
@@ -591,6 +735,15 @@ g:ale_python_prospector_auto_poetry *g:ale_python_prospector_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_prospector_auto_uv *g:ale_python_prospector_auto_uv*
+ *b:ale_python_prospector_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
pycln *ale-python-pycln*
@@ -663,6 +816,15 @@ g:ale_python_pycln_auto_poetry *g:ale_python_pycln_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pycln_auto_uv *g:ale_python_pycln_auto_uv*
+ *b:ale_python_pycln_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
pycodestyle *ale-python-pycodestyle*
@@ -712,6 +874,15 @@ g:ale_python_pycodestyle_auto_poetry *g:ale_python_pycodestyle_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pycodestyle_auto_uv *g:ale_python_pycodestyle_auto_uv*
+ *b:ale_python_pycodestyle_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
pydocstyle *ale-python-pydocstyle*
@@ -761,6 +932,15 @@ g:ale_python_pydocstyle_auto_poetry *g:ale_python_pydocstyle_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pydocstyle_auto_uv *g:ale_python_pydocstyle_auto_uv*
+ *b:ale_python_pydocstyle_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
pyflakes *ale-python-pyflakes*
@@ -793,6 +973,15 @@ g:ale_python_pyflakes_auto_poetry *g:ale_python_pyflakes_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pyflakes_auto_uv *g:ale_python_pyflakes_auto_uv*
+ *b:ale_python_pyflakes_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
pyflyby *ale-python-pyflyby*
@@ -839,6 +1028,15 @@ g:ale_python_pyflyby_auto_poetry *g:ale_python_pyflyby_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pyflyby_auto_uv *g:ale_python_pyflyby_auto_uv*
+ *b:ale_python_pyflyby_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
pylama *ale-python-pylama*
@@ -902,6 +1100,14 @@ g:ale_python_pylama_auto_poetry *g:ale_python_pylama_auto_poetry*
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
+g:ale_python_pylama_auto_uv *g:ale_python_pylama_auto_uv*
+ *b:ale_python_pylama_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
===============================================================================
pylint *ale-python-pylint*
@@ -976,6 +1182,15 @@ g:ale_python_pylint_auto_poetry *g:ale_python_pylint_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pylint_auto_uv *g:ale_python_pylint_auto_uv*
+ *b:ale_python_pylint_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id*
*b:ale_python_pylint_use_msg_id*
Type: |Number|
@@ -1028,6 +1243,15 @@ g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pylsp_auto_uv *g:ale_python_pylsp_auto_uv*
+ *b:ale_python_pylsp_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
g:ale_python_pylsp_config *g:ale_python_pylsp_config*
*b:ale_python_pylsp_config*
Type: |Dictionary|
@@ -1109,6 +1333,15 @@ g:ale_python_pyre_auto_poetry *g:ale_python_pyre_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_pyre_auto_uv *g:ale_python_pyre_auto_uv*
+ *b:ale_python_pyre_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
pyright *ale-python-pyright*
@@ -1168,6 +1401,33 @@ g:ale_python_pyright_config *g:ale_python_pyright_config*
\}
<
+g:ale_python_pyright_auto_pipenv *g:ale_python_pyright_auto_pipenv*
+ *b:ale_python_pyright_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_pyright_auto_poetry *g:ale_python_pyright_auto_poetry*
+ *b:ale_python_pyright_auto_poetry*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a poetry, and set the executable to `poetry`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_pyright_auto_uv *g:ale_python_pyright_auto_uv*
+ *b:ale_python_pyright_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
refurb *ale-python-refurb*
@@ -1229,6 +1489,15 @@ g:ale_python_refurb_auto_poetry *g:ale_python_refurb_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_refurb_auto_uv *g:ale_python_refurb_auto_uv*
+ *b:ale_python_refurb_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
reorder-python-imports *ale-python-reorder_python_imports*
@@ -1259,6 +1528,36 @@ g:ale_python_reorder_python_imports_use_global
See |ale-integrations-local-executables|
+g:ale_python_reorder_python_imports_auto_pipenv
+ *g:ale_python_reorder_python_imports_auto_pipenv*
+ *b:ale_python_reorder_python_imports_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_reorder_python_imports_auto_poetry
+ *g:ale_python_reorder_python_imports_auto_poetry*
+ *b:ale_python_reorder_python_imports_auto_poetry*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a poetry, and set the executable to `poetry`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_reorder_python_imports_auto_uv
+ *g:ale_python_reorder_python_imports_auto_uv*
+ *b:ale_python_reorder_python_imports_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
ruff *ale-python-ruff*
@@ -1322,6 +1621,15 @@ g:ale_python_ruff_auto_poetry *g:ale_python_ruff_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_ruff_auto_uv *g:ale_python_ruff_auto_uv*
+ *b:ale_python_ruff_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
ruff-format *ale-python-ruff-format*
@@ -1386,6 +1694,15 @@ g:ale_python_ruff_format_auto_poetry *g:ale_python_ruff_format_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_ruff_format_auto_uv *g:ale_python_ruff_format_auto_uv*
+ *b:ale_python_ruff_format_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
unimport *ale-python-unimport*
@@ -1410,6 +1727,15 @@ g:ale_python_unimport_auto_poetry *g:ale_python_unimport_auto_poetry*
if true. This is overridden by a manually-set executable.
+g:ale_python_unimport_auto_uv *g:ale_python_unimport_auto_uv*
+ *b:ale_python_unimport_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
g:ale_python_unimport_executable *g:ale_python_unimport_executable*
*b:ale_python_unimport_executable*
Type: |String|
@@ -1476,6 +1802,32 @@ g:ale_python_vulture_use_global *g:ale_python_vulture_use_global*
See |ale-integrations-local-executables|
+g:ale_python_vulture_auto_pipenv *g:ale_python_vulture_auto_pipenv*
+ *b:ale_python_vulture_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_vulture_auto_poetry *g:ale_python_vulture_auto_poetry*
+ *b:ale_python_vulture_auto_poetry*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a poetry, and set the executable to `poetry`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_vulture_auto_uv *g:ale_python_vulture_auto_uv*
+ *b:ale_python_vulture_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
===============================================================================
yapf *ale-python-yapf*
@@ -1496,5 +1848,32 @@ g:ale_python_yapf_use_global *g:ale_python_yapf_use_global*
See |ale-integrations-local-executables|
+g:ale_python_yapf_auto_pipenv *g:ale_python_yapf_auto_pipenv*
+ *b:ale_python_yapf_auto_pipenv*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a pipenv, and set the executable to `pipenv`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_yapf_auto_poetry *g:ale_python_yapf_auto_poetry*
+ *b:ale_python_yapf_auto_poetry*
+ Type: |Number|
+ Default: `0`
+
+ Detect whether the file is inside a poetry, and set the executable to `poetry`
+ if true. This is overridden by a manually-set executable.
+
+
+g:ale_python_yapf_auto_uv *g:ale_python_yapf_auto_uv*
+ *b:ale_python_yapf_auto_uv*
+ Type: |Number|
+ Default: `0`
+
+ Set the executable to `uv` if true. This is overridden by a manually-set
+ executable.
+
+
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/plugin/ale.vim b/plugin/ale.vim
index 47934fa0..054e9596 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -183,6 +183,9 @@ let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0)
" Enable automatic detection of poetry for Python linters.
let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0)
+" Enable automatic detection of uv for Python linters.
+let g:ale_python_auto_uv = get(g:, 'ale_python_auto_uv', 0)
+
" Enable automatic adjustment of environment variables for Python linters.
" The variables are set based on ALE's virtualenv detection.
let g:ale_python_auto_virtualenv = get(g:, 'ale_python_auto_virtualenv', 0)
diff --git a/test-files/python/no_uv/whatever.py b/test-files/python/no_uv/whatever.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test-files/python/no_uv/whatever.py
diff --git a/test/fixers/test_autoflake_fixer_callback.vader b/test/fixers/test_autoflake_fixer_callback.vader
index 91fc62b5..2abe5fc7 100644
--- a/test/fixers/test_autoflake_fixer_callback.vader
+++ b/test/fixers/test_autoflake_fixer_callback.vader
@@ -18,32 +18,52 @@ After:
call ale#test#RestoreDirectory()
-Execute(The autoflake callback should return the correct default values):
- AssertEqual
- \ 0,
- \ ale#fixers#autoflake#Fix(bufnr(''))
+Execute(The autoflake callback should include options):
+ let g:ale_python_autoflake_options = '--some-option'
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual
\ {
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoflake'))
+ \ . ' --some-option'
\ . ' --in-place '
\ . ' %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#autoflake#Fix(bufnr(''))
+Execute(pipenv is detected when python_autoflake_auto_pipenv is set):
+ let g:ale_python_autoflake_auto_pipenv = 1
-Execute(The autoflake callback should include options):
- let g:ale_python_autoflake_options = '--some-option'
+ call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
- silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual
\ {
- \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autoflake'))
- \ . ' --some-option'
- \ . ' --in-place '
- \ . ' %t',
+ \ 'command': ale#Escape('pipenv') . ' run autoflake --in-place %t',
+ \ 'read_temporary_file': 1,
+ \ },
+ \ ale#fixers#autoflake#Fix(bufnr(''))
+
+Execute(Poetry is detected when python_autoflake_auto_poetry is set):
+ let g:ale_python_autoflake_auto_poetry = 1
+
+ call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('poetry') . ' run autoflake --in-place %t',
+ \ 'read_temporary_file': 1,
+ \ },
+ \ ale#fixers#autoflake#Fix(bufnr(''))
+
+Execute(uv is detected when python_autoflake_auto_uv is set):
+ let g:ale_python_autoflake_auto_uv = 1
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('uv') . ' run autoflake --in-place %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#autoflake#Fix(bufnr(''))
diff --git a/test/fixers/test_autoimport_fixer_callback.vader b/test/fixers/test_autoimport_fixer_callback.vader
index edca5c38..785f4f65 100644
--- a/test/fixers/test_autoimport_fixer_callback.vader
+++ b/test/fixers/test_autoimport_fixer_callback.vader
@@ -18,11 +18,8 @@ After:
call ale#test#RestoreDirectory()
Execute(The autoimport callback should return the correct default values):
- AssertEqual
- \ 0,
- \ ale#fixers#autoimport#Fix(bufnr(''))
-
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
+
AssertEqual
\ {
\ 'cwd': '%s:h',
@@ -33,11 +30,8 @@ Execute(The autoimport callback should return the correct default values):
Execute(The autoimport callback should respect custom options):
let g:ale_python_autoimport_options = '--multi-line=3 --trailing-comma'
- AssertEqual
- \ 0,
- \ ale#fixers#autoimport#Fix(bufnr(''))
-
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
+
AssertEqual
\ {
\ 'cwd': '%s:h',
@@ -45,3 +39,39 @@ Execute(The autoimport callback should respect custom options):
\ . ' --multi-line=3 --trailing-comma -',
\ },
\ ale#fixers#autoimport#Fix(bufnr(''))
+
+Execute(pipenv is detected when python_autoimport_auto_pipenv is set):
+ let g:ale_python_autoimport_auto_pipenv = 1
+
+ call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('pipenv') . ' run autoimport -',
+ \ },
+ \ ale#fixers#autoimport#Fix(bufnr(''))
+
+Execute(Poetry is detected when python_autoimport_auto_poetry is set):
+ let g:ale_python_autoimport_auto_poetry = 1
+
+ call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('poetry') . ' run autoimport -',
+ \ },
+ \ ale#fixers#autoimport#Fix(bufnr(''))
+
+Execute(uv is detected when python_autoimport_auto_uv is set):
+ let g:ale_python_autoimport_auto_uv = 1
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('uv') . ' run autoimport -',
+ \ },
+ \ ale#fixers#autoimport#Fix(bufnr(''))
diff --git a/test/fixers/test_autopep8_fixer_callback.vader b/test/fixers/test_autopep8_fixer_callback.vader
index 46671eda..094677f3 100644
--- a/test/fixers/test_autopep8_fixer_callback.vader
+++ b/test/fixers/test_autopep8_fixer_callback.vader
@@ -19,11 +19,8 @@ After:
call ale#test#RestoreDirectory()
Execute(The autopep8 callback should return the correct default values):
- AssertEqual
- \ 0,
- \ ale#fixers#autopep8#Fix(bufnr(''))
-
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
+
AssertEqual
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
\ ale#fixers#autopep8#Fix(bufnr(''))
@@ -32,6 +29,40 @@ Execute(The autopep8 callback should include options):
let g:ale_python_autopep8_options = '--some-option'
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
+
AssertEqual
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' },
\ ale#fixers#autopep8#Fix(bufnr(''))
+
+Execute(pipenv is detected when python_autopep8_auto_pipenv is set):
+ let g:ale_python_autopep8_auto_pipenv = 1
+
+ call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('pipenv') . ' run autopep8 -',
+ \ },
+ \ ale#fixers#autopep8#Fix(bufnr(''))
+
+Execute(Poetry is detected when python_autopep8_auto_poetry is set):
+ let g:ale_python_autopep8_auto_poetry = 1
+
+ call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('poetry') . ' run autopep8 -',
+ \ },
+ \ ale#fixers#autopep8#Fix(bufnr(''))
+
+Execute(uv is detected when python_autopep8_auto_uv is set):
+ let g:ale_python_autopep8_auto_uv = 1
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('uv') . ' run autopep8 -',
+ \ },
+ \ ale#fixers#autopep8#Fix(bufnr(''))
diff --git a/test/fixers/test_black_fixer_callback.vader b/test/fixers/test_black_fixer_callback.vader
index bb76a1fe..079f5f8f 100644
--- a/test/fixers/test_black_fixer_callback.vader
+++ b/test/fixers/test_black_fixer_callback.vader
@@ -65,3 +65,13 @@ Execute(Poetry is detected when python_black_auto_poetry is set):
AssertEqual
\ {'command': ale#Escape('poetry') . ' run black -'},
\ ale#fixers#black#Fix(bufnr(''))
+
+Execute(uv is detected when python_black_auto_uv is set):
+ let g:ale_python_black_auto_uv = 1
+ let g:ale_python_black_change_directory = 0
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertEqual
+ \ {'command': ale#Escape('uv') . ' run black -'},
+ \ ale#fixers#black#Fix(bufnr(''))
diff --git a/test/fixers/test_isort_fixer_callback.vader b/test/fixers/test_isort_fixer_callback.vader
index 8b665d6b..ce42dca6 100644
--- a/test/fixers/test_isort_fixer_callback.vader
+++ b/test/fixers/test_isort_fixer_callback.vader
@@ -58,6 +58,19 @@ Execute(Poetry is detected when python_isort_auto_poetry is set):
\ 'command': ale#Escape('poetry') . ' run isort' . ' --filename %s' . ' -'
\ }
+Execute(uv is detected when python_isort_auto_uv is set):
+ let g:ale_python_isort_auto_uv = 1
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ GivenCommandOutput ['VERSION 5.7.0']
+ AssertFixer
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('uv') . ' run isort' . ' --filename %s' . ' -'
+ \ }
+
+
Execute(The isort callback should not use --filename for older versions):
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
diff --git a/test/fixers/test_pycln_fixer_callback.vader b/test/fixers/test_pycln_fixer_callback.vader
index 30cfaa3b..b0fb22b9 100644
--- a/test/fixers/test_pycln_fixer_callback.vader
+++ b/test/fixers/test_pycln_fixer_callback.vader
@@ -106,6 +106,19 @@ Execute(Poetry is detected when python_pycln_auto_poetry is set, and cwd respect
\ 'command': ale#Escape('poetry') . ' run pycln' . b:cmd_tail . ' -'
\ }
+Execute(uv is detected when python_pycln_auto_uv is set):
+ let g:ale_python_pycln_auto_uv = 1
+ let g:ale_python_pycln_change_directory = 0
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ GivenCommandOutput ['pycln, version 1.3.0']
+ AssertFixer
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('uv') . ' run pycln' . b:cmd_tail . ' -'
+ \ }
+
Execute(configuration files set in _config should be supported):
let g:ale_python_pycln_change_directory = 0
let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')
diff --git a/test/fixers/test_pyflyby_fixer_callback.vader b/test/fixers/test_pyflyby_fixer_callback.vader
index d017572e..4dcf16d5 100644
--- a/test/fixers/test_pyflyby_fixer_callback.vader
+++ b/test/fixers/test_pyflyby_fixer_callback.vader
@@ -36,3 +36,14 @@ Execute(Poetry is detected when python_pyflyby_auto_poetry is set):
\ {
\ 'command': ale#Escape('poetry') . ' run tidy-imports'
\ }
+
+Execute(uv is detected when python_pyflyby_auto_uv is set):
+ let g:ale_python_pyflyby_auto_uv = 1
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ GivenCommandOutput ['VERSION 5.7.0']
+ AssertFixer
+ \ {
+ \ 'command': ale#Escape('uv') . ' run tidy-imports'
+ \ }
diff --git a/test/fixers/test_reorder_python_imports_fixer_callback.vader b/test/fixers/test_reorder_python_imports_fixer_callback.vader
index ead2da77..82e4b84d 100644
--- a/test/fixers/test_reorder_python_imports_fixer_callback.vader
+++ b/test/fixers/test_reorder_python_imports_fixer_callback.vader
@@ -18,11 +18,8 @@ After:
call ale#test#RestoreDirectory()
Execute(The reorder_python_imports callback should return the correct default values):
- AssertEqual
- \ 0,
- \ ale#fixers#reorder_python_imports#Fix(bufnr(''))
-
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
+
AssertEqual
\ {
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/'
@@ -33,14 +30,44 @@ Execute(The reorder_python_imports callback should return the correct default va
Execute(The reorder_python_imports callback should respect custom options):
let g:ale_python_reorder_python_imports_options = '--py3-plus'
- AssertEqual
- \ 0,
- \ ale#fixers#reorder_python_imports#Fix(bufnr(''))
-
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
+
AssertEqual
\ {
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/'
\ . b:bin_dir . '/reorder-python-imports')) . ' --py3-plus -',
\ },
\ ale#fixers#reorder_python_imports#Fix(bufnr(''))
+
+Execute(pipenv is detected when python_reorder_python_imports_auto_pipenv is set):
+ let g:ale_python_reorder_python_imports_auto_pipenv = 1
+
+ call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('pipenv') . ' run reorder-python-imports -',
+ \ },
+ \ ale#fixers#reorder_python_imports#Fix(bufnr(''))
+
+Execute(Poetry is detected when python_reorder_python_imports_auto_poetry is set):
+ let g:ale_python_reorder_python_imports_auto_poetry = 1
+
+ call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('poetry') . ' run reorder-python-imports -',
+ \ },
+ \ ale#fixers#reorder_python_imports#Fix(bufnr(''))
+
+Execute(uv is detected when python_reorder_python_imports_auto_uv is set):
+ let g:ale_python_reorder_python_imports_auto_uv = 1
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('uv') . ' run reorder-python-imports -',
+ \ },
+ \ ale#fixers#reorder_python_imports#Fix(bufnr(''))
diff --git a/test/fixers/test_ruff_fixer_callback.vader b/test/fixers/test_ruff_fixer_callback.vader
index abe5860e..82a0383a 100644
--- a/test/fixers/test_ruff_fixer_callback.vader
+++ b/test/fixers/test_ruff_fixer_callback.vader
@@ -134,3 +134,17 @@ Execute(Poetry is detected when python_ruff_auto_poetry is set, and cwd respects
\ 'command': ale#Escape('poetry') . ' run ruff --stdin-filename ' . fname . ' --fix -'
\ }
+Execute(uv is detected when python_ruff_auto_uv is set):
+ let g:ale_python_ruff_auto_uv = 1
+ let g:ale_python_ruff_change_directory = 0
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ let fname = ale#Escape(ale#path#Simplify(g:dir .'/../test-files/python/uv/whatever.py'))
+
+ GivenCommandOutput ['ruff 0.0.72']
+ AssertFixer
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('uv') . ' run ruff --stdin-filename ' . fname . ' --fix -'
+ \ }
diff --git a/test/fixers/test_ruff_format_fixer_callback.vader b/test/fixers/test_ruff_format_fixer_callback.vader
index 3cf5fd52..7672ee3e 100644
--- a/test/fixers/test_ruff_format_fixer_callback.vader
+++ b/test/fixers/test_ruff_format_fixer_callback.vader
@@ -84,3 +84,16 @@ Execute(Poetry is detected when python_ruff_format_auto_poetry is set, and cwd r
\ 'command': ale#Escape('poetry') . ' run ruff format --stdin-filename ' . fname . ' -'
\ }
+Execute(uv is detected when python_ruff_format_auto_uv is set):
+ let g:ale_python_ruff_format_auto_uv = 1
+ let g:ale_python_ruff_format_change_directory = 0
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ let fname = ale#Escape(ale#path#Simplify(g:dir .'/../test-files/python/uv/whatever.py'))
+
+ AssertFixer
+ \ {
+ \ 'cwd': '%s:h',
+ \ 'command': ale#Escape('uv') . ' run ruff format --stdin-filename ' . fname . ' -'
+ \ }
diff --git a/test/fixers/test_yapf_fixer_callback.vader b/test/fixers/test_yapf_fixer_callback.vader
index a7fcc07b..8d88d423 100644
--- a/test/fixers/test_yapf_fixer_callback.vader
+++ b/test/fixers/test_yapf_fixer_callback.vader
@@ -15,17 +15,6 @@ After:
call ale#test#RestoreDirectory()
-Execute(The yapf callback should return the correct default values):
- AssertEqual
- \ 0,
- \ ale#fixers#yapf#Fix(bufnr(''))
-
- call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
-
- AssertEqual
- \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/yapf'))},
- \ ale#fixers#yapf#Fix(bufnr(''))
- \
Execute(The yapf should include the .style.yapf file if present):
call ale#test#SetFilename('../test-files/python/with_virtualenv/dir_with_yapf_config/foo/bar.py')
@@ -37,3 +26,36 @@ Execute(The yapf should include the .style.yapf file if present):
\ . ' --style ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/dir_with_yapf_config/.style.yapf')),
\ },
\ ale#fixers#yapf#Fix(bufnr(''))
+
+Execute(pipenv is detected when python_yapf_auto_pipenv is set):
+ let g:ale_python_yapf_auto_pipenv = 1
+
+ call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('pipenv') . ' run yapf',
+ \ },
+ \ ale#fixers#yapf#Fix(bufnr(''))
+
+Execute(Poetry is detected when python_yapf_auto_poetry is set):
+ let g:ale_python_yapf_auto_poetry = 1
+
+ call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('poetry') . ' run yapf',
+ \ },
+ \ ale#fixers#yapf#Fix(bufnr(''))
+
+Execute(uv is detected when python_yapf_auto_uv is set):
+ let g:ale_python_yapf_auto_uv = 1
+
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('uv') . ' run yapf',
+ \ },
+ \ ale#fixers#yapf#Fix(bufnr(''))
diff --git a/test/linter/test_bandit.vader b/test/linter/test_bandit.vader
index e9488c00..803e3bf2 100644
--- a/test/linter/test_bandit.vader
+++ b/test/linter/test_bandit.vader
@@ -67,6 +67,16 @@ Execute(Poetry is detected when python_bandit_auto_poetry is set):
\ . b:bandit_flags
\ . ' -'
+Execute(uv is used when python_bandit_auto_uv is set):
+ let g:ale_python_bandit_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv')
+ \ . ' run bandit'
+ \ . b:bandit_flags
+ \ . ' -'
+
Execute(The bandit command callback should add .bandit by default):
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py')
diff --git a/test/linter/test_flake8.vader b/test/linter/test_flake8.vader
index 53b40b29..d59c9e06 100644
--- a/test/linter/test_flake8.vader
+++ b/test/linter/test_flake8.vader
@@ -217,3 +217,10 @@ Execute(poetry is detected when python_flake8_auto_poetry is set):
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run flake8 --format=default --stdin-display-name %s -'
+
+Execute(uv is detected when python_flake8_auto_uv is set):
+ let g:ale_python_flake8_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run flake8 --format=default --stdin-display-name %s -'
diff --git a/test/linter/test_flakehell.vader b/test/linter/test_flakehell.vader
index 98314408..8a159f0d 100644
--- a/test/linter/test_flakehell.vader
+++ b/test/linter/test_flakehell.vader
@@ -201,3 +201,10 @@ Execute(poetry is detected when python_flakehell_auto_poetry is set):
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run flakehell lint --format=default --stdin-display-name %s -'
+
+Execute(uv is detected when python_flakehell_auto_uv is set):
+ let g:ale_python_flakehell_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run flakehell lint --format=default --stdin-display-name %s -'
diff --git a/test/linter/test_jedils.vader b/test/linter/test_jedils.vader
index 5ffd22d8..a86d80d6 100644
--- a/test/linter/test_jedils.vader
+++ b/test/linter/test_jedils.vader
@@ -47,3 +47,17 @@ Execute(Setting executable to 'pipenv' appends 'run jedi-language-server'):
call ale#test#SetFilename('../test-files/dummy')
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run jedi-language-server'
+
+Execute(poetry is detected when python_jedils_auto_poetry is set):
+ let g:ale_python_jedils_auto_poetry = 1
+ call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
+
+ AssertLinter 'poetry',
+ \ ale#Escape('poetry') . ' run jedi-language-server'
+
+Execute(uv is detected when python_jedils_auto_uv is set):
+ let g:ale_python_jedils_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run jedi-language-server'
diff --git a/test/linter/test_mypy.vader b/test/linter/test_mypy.vader
index bac59d92..3cad6c3e 100644
--- a/test/linter/test_mypy.vader
+++ b/test/linter/test_mypy.vader
@@ -104,3 +104,11 @@ Execute(Poetry is detected when python_mypy_auto_poetry is set):
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
+
+Execute(uv is detected when python_mypy_auto_uv is set):
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+ let g:ale_python_mypy_auto_uv = 1
+
+ AssertLinterCwd expand('#' . bufnr('') . ':p:h')
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
diff --git a/test/linter/test_prospector.vader b/test/linter/test_prospector.vader
index 82e1596d..934849a7 100644
--- a/test/linter/test_prospector.vader
+++ b/test/linter/test_prospector.vader
@@ -33,3 +33,11 @@ Execute(Poetry is detected when python_prospector_auto_poetry is set):
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run prospector'
\ . ' --messages-only --absolute-paths --zero-exit --output-format json %s'
+
+Execute(uv is detected when python_prospector_auto_uv is set):
+ let g:ale_python_prospector_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run prospector'
+ \ . ' --messages-only --absolute-paths --zero-exit --output-format json %s'
diff --git a/test/linter/test_pycln.vader b/test/linter/test_pycln.vader
index eb04f3d5..3d48ee7b 100644
--- a/test/linter/test_pycln.vader
+++ b/test/linter/test_pycln.vader
@@ -97,6 +97,14 @@ Execute(poetry is detected when python_pycln_auto_poetry is set):
AssertLinter 'poetry', ale#Escape('poetry') . ' run pycln'
\ . b:cmd_tail
+Execute(uv is detected when python_pycln_auto_uv is set):
+ let g:ale_python_pycln_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinterCwd expand('%:p:h')
+ AssertLinter 'uv', ale#Escape('uv') . ' run pycln'
+ \ . b:cmd_tail
+
Execute(configuration files set in _config should be supported):
let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')
diff --git a/test/linter/test_pycodestyle.vader b/test/linter/test_pycodestyle.vader
index fac53d9f..85983122 100644
--- a/test/linter/test_pycodestyle.vader
+++ b/test/linter/test_pycodestyle.vader
@@ -44,3 +44,10 @@ Execute(Poetry is detected when python_pycodestyle_auto_poetry is set):
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pycodestyle -'
+
+Execute(uv is detected when python_pycodestyle_auto_uv is set):
+ let g:ale_python_pycodestyle_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run pycodestyle -'
diff --git a/test/linter/test_pydocstyle.vader b/test/linter/test_pydocstyle.vader
index fc7fbbf2..cdc36885 100644
--- a/test/linter/test_pydocstyle.vader
+++ b/test/linter/test_pydocstyle.vader
@@ -43,3 +43,9 @@ Execute(Poetry is detected when python_pydocstyle_auto_poetry is set):
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertLinter 'poetry', ale#Escape('poetry') . ' run pydocstyle %s'
+
+Execute(uv is detected when python_pydocstyle_auto_uv is set):
+ let g:ale_python_pydocstyle_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv', ale#Escape('uv') . ' run pydocstyle %s'
diff --git a/test/linter/test_pyflakes.vader b/test/linter/test_pyflakes.vader
index 61aee562..09272620 100644
--- a/test/linter/test_pyflakes.vader
+++ b/test/linter/test_pyflakes.vader
@@ -58,3 +58,10 @@ Execute(Poetry is detected when python_pyflakes_auto_poetry is set):
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyflakes %t'
+
+Execute(uv is detected when python_pyflakes_auto_uv is set):
+ let g:ale_python_pyflakes_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run pyflakes %t'
diff --git a/test/linter/test_pylama.vader b/test/linter/test_pylama.vader
index 3c6a6efa..6e0aa293 100644
--- a/test/linter/test_pylama.vader
+++ b/test/linter/test_pylama.vader
@@ -86,3 +86,9 @@ Execute(poetry is detected when python_pylama_auto_poetry is set):
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylama' . b:command_tail
+
+Execute(uv is detected when python_pylama_auto_uv is set):
+ let g:ale_python_pylama_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv', ale#Escape('uv') . ' run pylama' . b:command_tail
diff --git a/test/linter/test_pylint.vader b/test/linter/test_pylint.vader
index d15161e6..73e792fb 100644
--- a/test/linter/test_pylint.vader
+++ b/test/linter/test_pylint.vader
@@ -94,3 +94,11 @@ Execute(poetry is detected when python_pylint_auto_poetry is set):
AssertLinterCwd expand('%:p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylint'
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
+
+Execute(uv is detected when python_pylint_auto_uv is set):
+ let g:ale_python_pylint_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinterCwd expand('%:p:h')
+ AssertLinter 'uv', ale#Escape('uv') . ' run pylint'
+ \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
diff --git a/test/linter/test_pylsp.vader b/test/linter/test_pylsp.vader
index c46c53a4..dd92d70a 100644
--- a/test/linter/test_pylsp.vader
+++ b/test/linter/test_pylsp.vader
@@ -85,6 +85,13 @@ Execute(poetry is detected when python_pylsp_auto_poetry is set):
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pylsp'
+Execute(uv is detected when python_pylsp_auto_uv is set):
+ let g:ale_python_pylsp_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run pylsp'
+
Execute(Should accept configuration settings):
AssertLSPConfig {}
let b:ale_python_pylsp_config = {'pylsp': {'plugins': {'preload': {'enabled': v:false}}}}
diff --git a/test/linter/test_pyre.vader b/test/linter/test_pyre.vader
index 053ef12f..c46bc034 100644
--- a/test/linter/test_pyre.vader
+++ b/test/linter/test_pyre.vader
@@ -61,6 +61,13 @@ Execute(Poetry is detected when python_pyre_auto_poetry is set):
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyre persistent'
+Execute(uv is detected when python_pyre_auto_uv is set):
+ let g:ale_python_pyre_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run pyre persistent'
+
Execute(The FindProjectRoot should detect the project root directory for namespace package via .pyre_configuration.local):
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/pyre_configuration_dir/foo/bar.py')
diff --git a/test/linter/test_pyright.vader b/test/linter/test_pyright.vader
index 45e9765e..91a715e2 100644
--- a/test/linter/test_pyright.vader
+++ b/test/linter/test_pyright.vader
@@ -179,3 +179,10 @@ Execute(poetry is detected when python_pyright_auto_poetry is set):
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyright-langserver --stdio'
+
+Execute(uv is detected when python_pyright_auto_uv is set):
+ let g:ale_python_pyright_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run pyright-langserver --stdio'
diff --git a/test/linter/test_refurb.vader b/test/linter/test_refurb.vader
index a1f066eb..c36fe49c 100644
--- a/test/linter/test_refurb.vader
+++ b/test/linter/test_refurb.vader
@@ -83,3 +83,10 @@ Execute(poetry is detected when python_refurb_auto_poetry is set):
AssertLinterCwd expand('%:p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run refurb %s'
+
+Execute(uv is detected when python_refurb_auto_uv is set):
+ let g:ale_python_refurb_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinterCwd expand('%:p:h')
+ AssertLinter 'uv', ale#Escape('uv') . ' run refurb %s'
diff --git a/test/linter/test_ruff.vader b/test/linter/test_ruff.vader
index bca2af75..07f3b1c4 100644
--- a/test/linter/test_ruff.vader
+++ b/test/linter/test_ruff.vader
@@ -117,3 +117,11 @@ Execute(poetry is detected when python_ruff_auto_poetry is set):
AssertLinterCwd expand('%:p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run ruff -q --no-fix'
\ . b:command_tail
+
+Execute(uv is detected when python_ruff_auto_uv is set):
+ let g:ale_python_ruff_auto_uv = 1
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+
+ AssertLinterCwd expand('%:p:h')
+ AssertLinter 'uv', ale#Escape('uv') . ' run ruff -q --no-fix'
+ \ . b:command_tail
diff --git a/test/linter/test_unimport.vader b/test/linter/test_unimport.vader
index a5607ce9..9e8e9112 100644
--- a/test/linter/test_unimport.vader
+++ b/test/linter/test_unimport.vader
@@ -69,3 +69,10 @@ Execute(Poetry is detected when python_unimport_auto_poetry is set):
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run unimport --check %t'
+
+Execute(uv is detected when python_unimport_auto_uv is set):
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+ let g:ale_python_unimport_auto_uv = 1
+
+ AssertLinterCwd expand('#' . bufnr('') . ':p:h')
+ AssertLinter 'uv', ale#Escape('uv') . ' run unimport --check %t'
diff --git a/test/linter/test_vulture.vader b/test/linter/test_vulture.vader
index 94e61158..abc8514b 100644
--- a/test/linter/test_vulture.vader
+++ b/test/linter/test_vulture.vader
@@ -61,3 +61,25 @@ Execute(Setting executable to 'poetry' appends 'run vulture'):
let g:ale_python_vulture_executable = 'path/to/poetry'
AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run vulture' . ' .'
+
+Execute(pipenv is detected when python_vulture_auto_pipenv is set):
+ call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
+ let g:ale_python_vulture_auto_pipenv = 1
+
+ AssertLinter 'pipenv',
+ \ ale#Escape('pipenv') . ' run vulture' . ' .'
+
+
+Execute(poetry is detected when python_vulture_auto_poetry is set):
+ call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
+ let g:ale_python_vulture_auto_poetry = 1
+
+ AssertLinter 'poetry',
+ \ ale#Escape('poetry') . ' run vulture' . ' .'
+
+Execute(uv is detected when python_vulture_auto_uv is set):
+ call ale#test#SetFilename('../test-files/python/uv/whatever.py')
+ let g:ale_python_vulture_auto_uv = 1
+
+ AssertLinter 'uv',
+ \ ale#Escape('uv') . ' run vulture' . ' .'
diff --git a/test/test-files/python/uv/.gitkeep b/test/test-files/python/uv/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test-files/python/uv/.gitkeep
diff --git a/test/test-files/python/uv/uv.lock b/test/test-files/python/uv/uv.lock
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test-files/python/uv/uv.lock
diff --git a/test/test-files/python/uv/whatever.py b/test/test-files/python/uv/whatever.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test-files/python/uv/whatever.py
diff --git a/test/test_python_uv.vader b/test/test_python_uv.vader
new file mode 100644
index 00000000..11d202fd
--- /dev/null
+++ b/test/test_python_uv.vader
@@ -0,0 +1,19 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+
+After:
+ call ale#test#RestoreDirectory()
+
+Execute(ale#python#UvPresent is true when a uv environment is present):
+ call ale#test#SetFilename('test-files/python/uv/whatever.py')
+
+ AssertEqual
+ \ ale#python#UvPresent(bufnr('%')),
+ \ 1
+
+Execute(ale#python#UvPresent is false when no uv environment is present):
+ call ale#test#SetFilename('test-files/python/no_uv/whatever.py')
+
+ AssertEqual
+ \ ale#python#UvPresent(bufnr('%')),
+ \ 0