静态填充“已知第三方”的“isort”设置。
seed-isort-config的Python项目详细描述
种子isort配置
静态填充known_third_party
isort
设置。
^{
^{
为什么不直接使用^{isort
(有意)提供的一些功能。
这个脚本所做的是种子known_third_party
isort配置
自动
安装
pip install seed-isort-config
用法
seed-isort-config
提供同名的单个可执行文件。运行它
在git
存储库中。
要指定自定义应用程序根(例如使用src
模式),请传递
冒号分隔的--application-directories
参数。
可以使用--exclude
标志将文件从进程中排除。
此参数采用python正则表达式。
有关参数的完整列表,请参见seed-isort-config --help
。
开始
在一个 isort配置文件。它将修改如果存在,否则将 创建一个全新的.isort.cfg
文件。最简单的方法就是添加一个空白known_third_party =
isort配置的部分(或者known_third_party = []
,如果您是
使用pyproject.toml
)。
与预提交一起使用
当与^{
-repo:https://github.com/asottile/seed-isort-configrev:v1.9.2hooks:-id:seed-isort-config-repo:https://github.com/pre-commit/mirrors-isortrev:v4.3.20hooks:-id:isort
在此配置中,seed-isort-config
将调整known_third_party
运行isort
之前的isort
配置部分!
请注意,seed-isort-config
不像普通的预提交linter,所以
必须通过args: [--exclude=...]
来配置文件排除。
例如:args: [--exclude=tests/.*\.py]
。