Improve support for python package manage: pipenv, poetry and uv (#4825)

This commit is contained in:
Diego Henrique Oliveira 2024-09-05 03:37:30 -03:00 committed by GitHub
parent 954682108d
commit a7ef1817b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
68 changed files with 1156 additions and 125 deletions

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_bandit_auto_pipenv', 0) call ale#Set('python_bandit_auto_pipenv', 0)
call ale#Set('python_bandit_auto_poetry', 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 function! ale_linters#python#bandit#GetExecutable(buffer) abort
if ( if (
@ -23,6 +24,11 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit'])
endfunction endfunction
@ -39,7 +45,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort
endif endif
endif endif
let l:exec_args = l:executable =~? 'pipenv\|poetry$' let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run bandit' \ ? ' run bandit'
\ : '' \ : ''

View File

@ -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_change_directory', 'project')
call ale#Set('python_flake8_auto_pipenv', 0) call ale#Set('python_flake8_auto_pipenv', 0)
call ale#Set('python_flake8_auto_poetry', 0) call ale#Set('python_flake8_auto_poetry', 0)
call ale#Set('python_flake8_auto_uv', 0)
function! s:UsingModule(buffer) abort function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
@ -23,6 +24,11 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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) if !s:UsingModule(a:buffer)
return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8']) return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8'])
endif endif
@ -68,7 +74,7 @@ endfunction
function! ale_linters#python#flake8#GetCommand(buffer, version) abort function! ale_linters#python#flake8#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) 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' \ ? ' run flake8'
\ : '' \ : ''

View File

@ -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_change_directory', 'project')
call ale#Set('python_flakehell_auto_pipenv', 0) call ale#Set('python_flakehell_auto_pipenv', 0)
call ale#Set('python_flakehell_auto_poetry', 0) call ale#Set('python_flakehell_auto_poetry', 0)
call ale#Set('python_flakehell_auto_uv', 0)
function! s:UsingModule(buffer) abort function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python' return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python'
@ -23,6 +24,11 @@ function! ale_linters#python#flakehell#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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) if !s:UsingModule(a:buffer)
return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell']) return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell'])
endif endif
@ -68,7 +74,7 @@ endfunction
function! ale_linters#python#flakehell#GetCommand(buffer, version) abort function! ale_linters#python#flakehell#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer) 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' let l:exec_args = ' run flakehell'
elseif (l:executable is? 'python') elseif (l:executable is? 'python')
let l:exec_args = ' -m flakehell' let l:exec_args = ' -m flakehell'

View File

@ -4,6 +4,8 @@
call ale#Set('python_jedils_executable', 'jedi-language-server') 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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_jedils_auto_pipenv', 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 function! ale_linters#python#jedils#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv')) 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' return 'pipenv'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server'])
endfunction endfunction
function! ale_linters#python#jedils#GetCommand(buffer) abort function! ale_linters#python#jedils#GetCommand(buffer) abort
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer) 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' \ ? ' run jedi-language-server'
\ : '' \ : ''
let l:env_string = '' let l:env_string = ''

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_mypy_auto_pipenv', 0) call ale#Set('python_mypy_auto_pipenv', 0)
call ale#Set('python_mypy_auto_poetry', 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 function! ale_linters#python#mypy#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
endfunction endfunction
@ -43,7 +49,7 @@ endfunction
function! ale_linters#python#mypy#GetCommand(buffer) abort function! ale_linters#python#mypy#GetCommand(buffer) abort
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer) 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' \ ? ' run mypy'
\ : '' \ : ''

View File

@ -3,6 +3,7 @@
call ale#Set('python_prospector_auto_pipenv', 0) call ale#Set('python_prospector_auto_pipenv', 0)
call ale#Set('python_prospector_auto_poetry', 0) call ale#Set('python_prospector_auto_poetry', 0)
call ale#Set('python_prospector_auto_uv', 0)
let g:ale_python_prospector_executable = let g:ale_python_prospector_executable =
\ get(g:, 'ale_python_prospector_executable', 'prospector') \ get(g:, 'ale_python_prospector_executable', 'prospector')
@ -23,13 +24,18 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
endfunction endfunction
function! ale_linters#python#prospector#GetCommand(buffer) abort function! ale_linters#python#prospector#GetCommand(buffer) abort
let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer) 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' \ ? ' run prospector'
\ : '' \ : ''

View File

@ -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_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0) call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0) call ale#Set('python_pycln_auto_poetry', 0)
call ale#Set('python_pycln_auto_uv', 0)
call ale#Set('python_pycln_config_file', '') call ale#Set('python_pycln_config_file', '')
function! ale_linters#python#pycln#GetExecutable(buffer) abort function! ale_linters#python#pycln#GetExecutable(buffer) abort
@ -20,6 +21,11 @@ function! ale_linters#python#pycln#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction endfunction
@ -36,7 +42,7 @@ endfunction
function! ale_linters#python#pycln#GetCommand(buffer, version) abort function! ale_linters#python#pycln#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pycln#GetExecutable(a:buffer) 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' \ ? ' run pycln'
\ : '' \ : ''

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pycodestyle_auto_pipenv', 0) call ale#Set('python_pycodestyle_auto_pipenv', 0)
call ale#Set('python_pycodestyle_auto_poetry', 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 function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
endfunction endfunction
function! ale_linters#python#pycodestyle#GetCommand(buffer) abort function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer) 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' \ ? ' run pycodestyle'
\ : '' \ : ''

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pydocstyle_auto_pipenv', 0) call ale#Set('python_pydocstyle_auto_pipenv', 0)
call ale#Set('python_pydocstyle_auto_poetry', 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 function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
endfunction endfunction
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer) 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' \ ? ' run pydocstyle'
\ : '' \ : ''

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyflakes_auto_pipenv', 0) call ale#Set('python_pyflakes_auto_pipenv', 0)
call ale#Set('python_pyflakes_auto_poetry', 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 function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
endfunction endfunction
function! ale_linters#python#pyflakes#GetCommand(buffer) abort function! ale_linters#python#pyflakes#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer) 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' \ ? ' run pyflakes'
\ : '' \ : ''

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pylama_auto_pipenv', 0) call ale#Set('python_pylama_auto_pipenv', 0)
call ale#Set('python_pylama_auto_poetry', 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) call ale#Set('python_pylama_change_directory', 1)
function! ale_linters#python#pylama#GetExecutable(buffer) abort function! ale_linters#python#pylama#GetExecutable(buffer) abort
@ -19,12 +20,17 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama'])
endfunction endfunction
function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) 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' \ ? ' run pylama'
\ : '' \ : ''
@ -53,7 +59,7 @@ endfunction
function! ale_linters#python#pylama#GetCommand(buffer, version) abort function! ale_linters#python#pylama#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) 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' \ ? ' run pylama'
\ : '' \ : ''

View File

@ -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_change_directory', 1)
call ale#Set('python_pylint_auto_pipenv', 0) call ale#Set('python_pylint_auto_pipenv', 0)
call ale#Set('python_pylint_auto_poetry', 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) call ale#Set('python_pylint_use_msg_id', 0)
function! ale_linters#python#pylint#GetExecutable(buffer) abort function! ale_linters#python#pylint#GetExecutable(buffer) abort
@ -20,6 +21,11 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
endfunction endfunction
@ -38,7 +44,7 @@ endfunction
function! ale_linters#python#pylint#GetCommand(buffer, version) abort function! ale_linters#python#pylint#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer) 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' \ ? ' run pylint'
\ : '' \ : ''

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pylsp_auto_pipenv', 0) call ale#Set('python_pylsp_auto_pipenv', 0)
call ale#Set('python_pylsp_auto_poetry', 0) call ale#Set('python_pylsp_auto_poetry', 0)
call ale#Set('python_pylsp_auto_uv', 0)
call ale#Set('python_pylsp_config', {}) call ale#Set('python_pylsp_config', {})
function! ale_linters#python#pylsp#GetExecutable(buffer) abort function! ale_linters#python#pylsp#GetExecutable(buffer) abort
@ -19,6 +20,11 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
endfunction endfunction
@ -37,7 +43,7 @@ endfunction
function! ale_linters#python#pylsp#GetCommand(buffer) abort function! ale_linters#python#pylsp#GetCommand(buffer) abort
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer) 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' \ ? ' run pylsp'
\ : '' \ : ''
let l:env_string = '' let l:env_string = ''

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyre_auto_pipenv', 0) call ale#Set('python_pyre_auto_pipenv', 0)
call ale#Set('python_pyre_auto_poetry', 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 function! ale_linters#python#pyre#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre'])
endfunction endfunction
function! ale_linters#python#pyre#GetCommand(buffer) abort function! ale_linters#python#pyre#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer) 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 return ale#Escape(l:executable) . l:exec_args
endfunction endfunction

View File

@ -3,6 +3,7 @@ call ale#Set('python_pyright_executable', 'pyright-langserver')
call ale#Set('python_pyright_config', {}) call ale#Set('python_pyright_config', {})
call ale#Set('python_pyright_auto_pipenv', 0) call ale#Set('python_pyright_auto_pipenv', 0)
call ale#Set('python_pyright_auto_poetry', 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 " 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 " 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pyright', ['pyright-langserver'])
endfunction endfunction
function! ale_linters#python#pyright#GetCommand(buffer) abort function! ale_linters#python#pyright#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer) 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' \ ? ' run pyright-langserver'
\ : '' \ : ''
let l:env_string = '' let l:env_string = ''

View File

@ -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_change_directory', 1)
call ale#Set('python_refurb_auto_pipenv', 0) call ale#Set('python_refurb_auto_pipenv', 0)
call ale#Set('python_refurb_auto_poetry', 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 function! ale_linters#python#refurb#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_refurb_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_refurb', ['refurb'])
endfunction endfunction
@ -35,7 +41,7 @@ endfunction
function! ale_linters#python#refurb#GetCommand(buffer) abort function! ale_linters#python#refurb#GetCommand(buffer) abort
let l:executable = ale_linters#python#refurb#GetExecutable(a:buffer) 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' \ ? ' run refurb'
\ : '' \ : ''

View File

@ -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_change_directory', 1)
call ale#Set('python_ruff_auto_pipenv', 0) call ale#Set('python_ruff_auto_pipenv', 0)
call ale#Set('python_ruff_auto_poetry', 0) call ale#Set('python_ruff_auto_poetry', 0)
call ale#Set('python_ruff_auto_uv', 0)
call ale#fix#registry#Add('ruff', call ale#fix#registry#Add('ruff',
\ 'ale#fixers#ruff#Fix', \ 'ale#fixers#ruff#Fix',
@ -25,6 +26,11 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction endfunction
@ -41,7 +47,7 @@ endfunction
function! ale_linters#python#ruff#GetCommand(buffer, version) abort function! ale_linters#python#ruff#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer) 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' \ ? ' run ruff'
\ : '' \ : ''
@ -49,7 +55,7 @@ function! ale_linters#python#ruff#GetCommand(buffer, version) abort
let l:exec_args = l:exec_args let l:exec_args = l:exec_args
\ . (ale#semver#GTE(a:version, [0, 3, 0]) ? ' check' : '') \ . (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` " NOTE: ruff version `0.1.0` deprecates `--format text`
return ale#Escape(l:executable) . l:exec_args . ' -q' return ale#Escape(l:executable) . l:exec_args . ' -q'
\ . ' --no-fix' \ . ' --no-fix'

View File

@ -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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_unimport_auto_pipenv', 0) call ale#Set('python_unimport_auto_pipenv', 0)
call ale#Set('python_unimport_auto_poetry', 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 function! ale_linters#python#unimport#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
endfunction endfunction
function! ale_linters#python#unimport#GetCommand(buffer) abort function! ale_linters#python#unimport#GetCommand(buffer) abort
let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer) 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' \ ? ' run unimport'
\ : '' \ : ''

View File

@ -5,6 +5,9 @@ call ale#Set('python_vulture_executable', 'vulture')
call ale#Set('python_vulture_options', '') 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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_vulture_change_directory', 1) 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 " The directory to change to before running vulture
function! s:GetDir(buffer) abort function! s:GetDir(buffer) abort
@ -16,6 +19,21 @@ function! s:GetDir(buffer) abort
endfunction endfunction
function! ale_linters#python#vulture#GetExecutable(buffer) abort 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']) return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture'])
endfunction endfunction
@ -29,7 +47,7 @@ endfunction
function! ale_linters#python#vulture#GetCommand(buffer) abort function! ale_linters#python#vulture#GetCommand(buffer) abort
let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer) 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' \ ? ' run vulture'
\ : '' \ : ''
let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory') let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory')

View File

@ -4,22 +4,40 @@
call ale#Set('python_autoflake_executable', 'autoflake') 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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_autoflake_options', '') 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#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 function! ale#fixers#autoflake#Fix(buffer) abort
let l:executable = ale#python#FindExecutable( let l:executable = ale#fixers#autoflake#GetExecutable(a:buffer)
\ a:buffer,
\ 'python_autoflake',
\ ['autoflake'],
\)
if !executable(l:executable) let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
return 0 \ ? ' run autoflake'
endif \ : ''
let l:options = ale#Var(a:buffer, 'python_autoflake_options') let l:options = ale#Var(a:buffer, 'python_autoflake_options')
return { return {
\ 'command': ale#Escape(l:executable) \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --in-place ' \ . ' --in-place '
\ . ' %t', \ . ' %t',

View File

@ -4,23 +4,41 @@
call ale#Set('python_autoimport_executable', 'autoimport') call ale#Set('python_autoimport_executable', 'autoimport')
call ale#Set('python_autoimport_options', '') 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_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#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
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 (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 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') let l:options = ale#Var(a:buffer, 'python_autoimport_options')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_autoimport',
\ ['autoimport'],
\)
if !executable(l:executable)
return 0
endif
return { return {
\ 'cwd': '%s:h', \ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable) \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -', \ . ' -',
\} \}

View File

@ -4,22 +4,40 @@
call ale#Set('python_autopep8_executable', 'autopep8') 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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_autopep8_options', '') 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#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 function! ale#fixers#autopep8#Fix(buffer) abort
let l:executable = ale#python#FindExecutable( let l:executable = ale#fixers#autopep8#GetExecutable(a:buffer)
\ a:buffer,
\ 'python_autopep8',
\ ['autopep8'],
\)
if !executable(l:executable) let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
return 0 \ ? ' run autopep8'
endif \ : ''
let l:options = ale#Var(a:buffer, 'python_autopep8_options') let l:options = ale#Var(a:buffer, 'python_autopep8_options')
return { return {
\ 'command': ale#Escape(l:executable) \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -', \ . ' -',
\} \}

View File

@ -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_options', '')
call ale#Set('python_black_auto_pipenv', 0) call ale#Set('python_black_auto_pipenv', 0)
call ale#Set('python_black_auto_poetry', 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) call ale#Set('python_black_change_directory', 1)
function! ale#fixers#black#GetExecutable(buffer) abort function! ale#fixers#black#GetExecutable(buffer) abort
@ -19,6 +20,11 @@ function! ale#fixers#black#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_black', ['black'])
endfunction endfunction
@ -26,7 +32,7 @@ function! ale#fixers#black#Fix(buffer) abort
let l:executable = ale#fixers#black#GetExecutable(a:buffer) let l:executable = ale#fixers#black#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$' if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'black']) call extend(l:cmd, ['run', 'black'])
endif endif

View File

@ -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_options', '')
call ale#Set('python_isort_auto_pipenv', 0) call ale#Set('python_isort_auto_pipenv', 0)
call ale#Set('python_isort_auto_poetry', 0) call ale#Set('python_isort_auto_poetry', 0)
call ale#Set('python_isort_auto_uv', 0)
function! ale#fixers#isort#GetExecutable(buffer) abort function! ale#fixers#isort#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort'])
endfunction endfunction
@ -25,7 +31,7 @@ function! ale#fixers#isort#GetCmd(buffer) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer) let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$' if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'isort']) call extend(l:cmd, ['run', 'isort'])
endif endif
@ -36,7 +42,7 @@ function! ale#fixers#isort#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#isort#GetExecutable(a:buffer) let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$' if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'isort']) call extend(l:cmd, ['run', 'isort'])
endif endif

View File

@ -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_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0) call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0) call ale#Set('python_pycln_auto_poetry', 0)
call ale#Set('python_pycln_auto_uv', 0)
call ale#Set('python_pycln_config_file', '') call ale#Set('python_pycln_config_file', '')
function! ale#fixers#pycln#GetCwd(buffer) abort function! ale#fixers#pycln#GetCwd(buffer) abort
@ -31,12 +32,17 @@ function! ale#fixers#pycln#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction endfunction
function! ale#fixers#pycln#GetCommand(buffer) abort function! ale#fixers#pycln#GetCommand(buffer) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer) 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' \ ? ' 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:executable = ale#fixers#pycln#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$' if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'pycln']) call extend(l:cmd, ['run', 'pycln'])
endif endif

View File

@ -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_options', '')
call ale#Set('python_pyflyby_auto_pipenv', 0) call ale#Set('python_pyflyby_auto_pipenv', 0)
call ale#Set('python_pyflyby_auto_poetry', 0) call ale#Set('python_pyflyby_auto_poetry', 0)
call ale#Set('python_pyflyby_auto_uv', 0)
function! ale#fixers#pyflyby#GetExecutable(buffer) abort function! ale#fixers#pyflyby#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflyby_auto_pipenv')) 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' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_pyflyby', ['tidy-imports'])
endfunction endfunction
@ -27,7 +33,7 @@ function! ale#fixers#pyflyby#Fix(buffer) abort
let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer) let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] 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']) call extend(l:cmd, ['run', 'tidy-imports'])
endif endif

View File

@ -4,22 +4,40 @@
call ale#Set('python_reorder_python_imports_executable', 'reorder-python-imports') 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_options', '')
call ale#Set('python_reorder_python_imports_use_global', get(g:, 'ale_use_global_executables', 0)) 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#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 function! ale#fixers#reorder_python_imports#Fix(buffer) abort
let l:executable = ale#python#FindExecutable( let l:executable = ale#fixers#reorder_python_imports#GetExecutable(a:buffer)
\ a:buffer,
\ 'python_reorder_python_imports',
\ ['reorder-python-imports'],
\)
if !executable(l:executable) let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
return 0 \ ? ' run reorder-python-imports'
endif \ : ''
let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options') let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options')
return { return {
\ 'command': ale#Escape(l:executable) \ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -', \ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\} \}
endfunction endfunction

View File

@ -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_change_directory', 1)
call ale#Set('python_ruff_auto_pipenv', 0) call ale#Set('python_ruff_auto_pipenv', 0)
call ale#Set('python_ruff_auto_poetry', 0) call ale#Set('python_ruff_auto_poetry', 0)
call ale#Set('python_ruff_auto_uv', 0)
function! ale#fixers#ruff#GetCwd(buffer) abort function! ale#fixers#ruff#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_change_directory') if ale#Var(a:buffer, 'python_ruff_change_directory')
@ -30,12 +31,17 @@ function! ale#fixers#ruff#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction endfunction
function! ale#fixers#ruff#GetCommand(buffer) abort function! ale#fixers#ruff#GetCommand(buffer) abort
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer) 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' \ ? ' 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:executable = ale#fixers#ruff#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$' if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'ruff']) call extend(l:cmd, ['run', 'ruff'])
endif endif

View File

@ -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_change_directory', 1)
call ale#Set('python_ruff_format_auto_pipenv', 0) 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_poetry', 0)
call ale#Set('python_ruff_format_auto_uv', 0)
function! ale#fixers#ruff_format#GetCwd(buffer) abort function! ale#fixers#ruff_format#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_format_change_directory') if ale#Var(a:buffer, 'python_ruff_format_change_directory')
@ -30,12 +31,17 @@ function! ale#fixers#ruff_format#GetExecutable(buffer) abort
return 'poetry' return 'poetry'
endif 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']) return ale#python#FindExecutable(a:buffer, 'python_ruff_format', ['ruff'])
endfunction endfunction
function! ale#fixers#ruff_format#GetCommand(buffer) abort function! ale#fixers#ruff_format#GetCommand(buffer) abort
let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer) 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' \ ? ' 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:executable = ale#fixers#ruff_format#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)] let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$' if l:executable =~? 'pipenv\|poetry\|uv$'
call extend(l:cmd, ['run', 'ruff']) call extend(l:cmd, ['run', 'ruff'])
endif endif

View File

@ -3,17 +3,35 @@
call ale#Set('python_yapf_executable', 'yapf') 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_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#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 function! ale#fixers#yapf#Fix(buffer) abort
let l:executable = ale#python#FindExecutable( let l:executable = ale#fixers#yapf#GetExecutable(a:buffer)
\ a:buffer,
\ 'python_yapf',
\ ['yapf'],
\)
if !executable(l:executable) let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
return 0 \ ? ' run yapf'
endif \ : ''
let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf') let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf')
let l:config_options = !empty(l:config) let l:config_options = !empty(l:config)
@ -21,6 +39,6 @@ function! ale#fixers#yapf#Fix(buffer) abort
\ : '' \ : ''
return { return {
\ 'command': ale#Escape(l:executable) . l:config_options, \ 'command': ale#Escape(l:executable) . l:exec_args . l:config_options,
\} \}
endfunction endfunction

View File

@ -3,6 +3,7 @@
call ale#Set('python_auto_pipenv', '0') call ale#Set('python_auto_pipenv', '0')
call ale#Set('python_auto_poetry', '0') call ale#Set('python_auto_poetry', '0')
call ale#Set('python_auto_uv', '0')
let s:sep = has('win32') ? '\' : '/' let s:sep = has('win32') ? '\' : '/'
" bin is used for Unix virtualenv directories, and Scripts is for Windows. " 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 . '/poetry.lock')
\|| filereadable(l:path . '/pyproject.toml') \|| filereadable(l:path . '/pyproject.toml')
\|| filereadable(l:path . '/.tool-versions') \|| filereadable(l:path . '/.tool-versions')
\|| filereadable(l:path . '/uv.lock')
return l:path return l:path
endif endif
endfor endfor
@ -192,3 +194,8 @@ endfunction
function! ale#python#PoetryPresent(buffer) abort function! ale#python#PoetryPresent(buffer) abort
return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
endfunction 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

View File

@ -20,6 +20,15 @@ g:ale_python_auto_poetry *g:ale_python_auto_poetry*
if true. This is overridden by a manually-set executable. 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* g:ale_python_auto_virtualenv *g:ale_python_auto_virtualenv*
*b:ale_python_auto_virtualenv* *b:ale_python_auto_virtualenv*
Type: |Number| Type: |Number|
@ -96,6 +105,33 @@ g:ale_python_autoflake_use_global *g:ale_python_autoflake_use_global*
See |ale-integrations-local-executables| 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* 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| 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* 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| 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* 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. 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* 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. 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* g:ale_python_black_change_directory *g:ale_python_black_change_directory*
*b:ale_python_black_change_directory* *b:ale_python_black_change_directory*
Type: |Number| 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. 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* 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. 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* 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. 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* 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. 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* g:ale_python_mypy_executable *g:ale_python_mypy_executable*
*b:ale_python_mypy_executable* *b:ale_python_mypy_executable*
Type: |String| 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. 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* 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. 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* 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. 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* 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. 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* 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. 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* 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. 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* 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` Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable. 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* 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. 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* g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id*
*b:ale_python_pylint_use_msg_id* *b:ale_python_pylint_use_msg_id*
Type: |Number| 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. 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* g:ale_python_pylsp_config *g:ale_python_pylsp_config*
*b:ale_python_pylsp_config* *b:ale_python_pylsp_config*
Type: |Dictionary| 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. 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* 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* 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. 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* 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| 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* 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. 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* 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. 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* 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. 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* g:ale_python_unimport_executable *g:ale_python_unimport_executable*
*b:ale_python_unimport_executable* *b:ale_python_unimport_executable*
Type: |String| Type: |String|
@ -1476,6 +1802,32 @@ g:ale_python_vulture_use_global *g:ale_python_vulture_use_global*
See |ale-integrations-local-executables| 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* 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| 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: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -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. " Enable automatic detection of poetry for Python linters.
let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0) 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. " Enable automatic adjustment of environment variables for Python linters.
" The variables are set based on ALE's virtualenv detection. " The variables are set based on ALE's virtualenv detection.
let g:ale_python_auto_virtualenv = get(g:, 'ale_python_auto_virtualenv', 0) let g:ale_python_auto_virtualenv = get(g:, 'ale_python_auto_virtualenv', 0)

View File

View File

@ -18,22 +18,6 @@ After:
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
Execute(The autoflake callback should return the correct default values):
AssertEqual
\ 0,
\ ale#fixers#autoflake#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 . '/autoflake'))
\ . ' --in-place '
\ . ' %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#autoflake#Fix(bufnr(''))
Execute(The autoflake callback should include options): Execute(The autoflake callback should include options):
let g:ale_python_autoflake_options = '--some-option' let g:ale_python_autoflake_options = '--some-option'
@ -47,3 +31,39 @@ Execute(The autoflake callback should include options):
\ 'read_temporary_file': 1, \ 'read_temporary_file': 1,
\ }, \ },
\ ale#fixers#autoflake#Fix(bufnr('')) \ ale#fixers#autoflake#Fix(bufnr(''))
Execute(pipenv is detected when python_autoflake_auto_pipenv is set):
let g:ale_python_autoflake_auto_pipenv = 1
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
AssertEqual
\ {
\ '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(''))

View File

@ -18,11 +18,8 @@ After:
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
Execute(The autoimport callback should return the correct default values): 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual AssertEqual
\ { \ {
\ 'cwd': '%s:h', \ '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): Execute(The autoimport callback should respect custom options):
let g:ale_python_autoimport_options = '--multi-line=3 --trailing-comma' 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual AssertEqual
\ { \ {
\ 'cwd': '%s:h', \ 'cwd': '%s:h',
@ -45,3 +39,39 @@ Execute(The autoimport callback should respect custom options):
\ . ' --multi-line=3 --trailing-comma -', \ . ' --multi-line=3 --trailing-comma -',
\ }, \ },
\ ale#fixers#autoimport#Fix(bufnr('')) \ 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(''))

View File

@ -19,11 +19,8 @@ After:
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
Execute(The autopep8 callback should return the correct default values): 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual AssertEqual
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'}, \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' -'},
\ ale#fixers#autopep8#Fix(bufnr('')) \ ale#fixers#autopep8#Fix(bufnr(''))
@ -32,6 +29,40 @@ Execute(The autopep8 callback should include options):
let g:ale_python_autopep8_options = '--some-option' let g:ale_python_autopep8_options = '--some-option'
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual AssertEqual
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/autopep8')) . ' --some-option -' }, \ {'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('')) \ 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(''))

View File

@ -65,3 +65,13 @@ Execute(Poetry is detected when python_black_auto_poetry is set):
AssertEqual AssertEqual
\ {'command': ale#Escape('poetry') . ' run black -'}, \ {'command': ale#Escape('poetry') . ' run black -'},
\ ale#fixers#black#Fix(bufnr('')) \ 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(''))

View File

@ -58,6 +58,19 @@ Execute(Poetry is detected when python_isort_auto_poetry is set):
\ 'command': ale#Escape('poetry') . ' run isort' . ' --filename %s' . ' -' \ '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): 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')

View File

@ -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 . ' -' \ '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): Execute(configuration files set in _config should be supported):
let g:ale_python_pycln_change_directory = 0 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') let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')

View File

@ -36,3 +36,14 @@ Execute(Poetry is detected when python_pyflyby_auto_poetry is set):
\ { \ {
\ 'command': ale#Escape('poetry') . ' run tidy-imports' \ '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'
\ }

View File

@ -18,11 +18,8 @@ After:
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
Execute(The reorder_python_imports callback should return the correct default values): 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual AssertEqual
\ { \ {
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' \ '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): Execute(The reorder_python_imports callback should respect custom options):
let g:ale_python_reorder_python_imports_options = '--py3-plus' 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertEqual AssertEqual
\ { \ {
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/'
\ . b:bin_dir . '/reorder-python-imports')) . ' --py3-plus -', \ . b:bin_dir . '/reorder-python-imports')) . ' --py3-plus -',
\ }, \ },
\ ale#fixers#reorder_python_imports#Fix(bufnr('')) \ 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(''))

View File

@ -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 -' \ '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 -'
\ }

View File

@ -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 . ' -' \ '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 . ' -'
\ }

View File

@ -15,17 +15,6 @@ After:
call ale#test#RestoreDirectory() 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): 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') 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')), \ . ' --style ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/dir_with_yapf_config/.style.yapf')),
\ }, \ },
\ ale#fixers#yapf#Fix(bufnr('')) \ 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(''))

View File

@ -67,6 +67,16 @@ Execute(Poetry is detected when python_bandit_auto_poetry is set):
\ . b:bandit_flags \ . 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): 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py')

View File

@ -217,3 +217,10 @@ Execute(poetry is detected when python_flake8_auto_poetry is set):
AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run flake8 --format=default --stdin-display-name %s -' \ 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 -'

View File

@ -201,3 +201,10 @@ Execute(poetry is detected when python_flakehell_auto_poetry is set):
AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run flakehell lint --format=default --stdin-display-name %s -' \ 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 -'

View File

@ -47,3 +47,17 @@ Execute(Setting executable to 'pipenv' appends 'run jedi-language-server'):
call ale#test#SetFilename('../test-files/dummy') call ale#test#SetFilename('../test-files/dummy')
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run jedi-language-server' 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'

View File

@ -104,3 +104,11 @@ Execute(Poetry is detected when python_mypy_auto_poetry is set):
AssertLinterCwd expand('#' . bufnr('') . ':p:h') AssertLinterCwd expand('#' . bufnr('') . ':p:h')
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run mypy --show-column-numbers --shadow-file %s %t %s' \ 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'

View File

@ -33,3 +33,11 @@ Execute(Poetry is detected when python_prospector_auto_poetry is set):
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run prospector' \ ale#Escape('poetry') . ' run prospector'
\ . ' --messages-only --absolute-paths --zero-exit --output-format json %s' \ . ' --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'

View File

@ -97,6 +97,14 @@ Execute(poetry is detected when python_pycln_auto_poetry is set):
AssertLinter 'poetry', ale#Escape('poetry') . ' run pycln' AssertLinter 'poetry', ale#Escape('poetry') . ' run pycln'
\ . b:cmd_tail \ . 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): 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') let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')

View File

@ -44,3 +44,10 @@ Execute(Poetry is detected when python_pycodestyle_auto_poetry is set):
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pycodestyle -' \ 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 -'

View File

@ -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') call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertLinter 'poetry', ale#Escape('poetry') . ' run pydocstyle %s' 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'

View File

@ -58,3 +58,10 @@ Execute(Poetry is detected when python_pyflakes_auto_poetry is set):
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyflakes %t' \ 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'

View File

@ -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') call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylama' . b:command_tail 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

View File

@ -94,3 +94,11 @@ Execute(poetry is detected when python_pylint_auto_poetry is set):
AssertLinterCwd expand('%:p:h') AssertLinterCwd expand('%:p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylint' AssertLinter 'poetry', ale#Escape('poetry') . ' run pylint'
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' \ . ' --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'

View File

@ -85,6 +85,13 @@ Execute(poetry is detected when python_pylsp_auto_poetry is set):
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pylsp' \ 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): Execute(Should accept configuration settings):
AssertLSPConfig {} AssertLSPConfig {}
let b:ale_python_pylsp_config = {'pylsp': {'plugins': {'preload': {'enabled': v:false}}}} let b:ale_python_pylsp_config = {'pylsp': {'plugins': {'preload': {'enabled': v:false}}}}

View File

@ -61,6 +61,13 @@ Execute(Poetry is detected when python_pyre_auto_poetry is set):
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyre persistent' \ 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): 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') silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/pyre_configuration_dir/foo/bar.py')

View File

@ -179,3 +179,10 @@ Execute(poetry is detected when python_pyright_auto_poetry is set):
AssertLinterCwd ale#python#FindProjectRootIni(bufnr('')) AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
AssertLinter 'poetry', AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyright-langserver --stdio' \ 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'

View File

@ -83,3 +83,10 @@ Execute(poetry is detected when python_refurb_auto_poetry is set):
AssertLinterCwd expand('%:p:h') AssertLinterCwd expand('%:p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run refurb %s' 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'

View File

@ -117,3 +117,11 @@ Execute(poetry is detected when python_ruff_auto_poetry is set):
AssertLinterCwd expand('%:p:h') AssertLinterCwd expand('%:p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run ruff -q --no-fix' AssertLinter 'poetry', ale#Escape('poetry') . ' run ruff -q --no-fix'
\ . b:command_tail \ . 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

View File

@ -69,3 +69,10 @@ Execute(Poetry is detected when python_unimport_auto_poetry is set):
AssertLinterCwd expand('#' . bufnr('') . ':p:h') AssertLinterCwd expand('#' . bufnr('') . ':p:h')
AssertLinter 'poetry', ale#Escape('poetry') . ' run unimport --check %t' 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'

View File

@ -61,3 +61,25 @@ Execute(Setting executable to 'poetry' appends 'run vulture'):
let g:ale_python_vulture_executable = 'path/to/poetry' let g:ale_python_vulture_executable = 'path/to/poetry'
AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run vulture' . ' .' 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' . ' .'

View File

View File

View File

19
test/test_python_uv.vader Normal file
View File

@ -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