-
-
Notifications
You must be signed in to change notification settings - Fork 607
/
subsystem.py
37 lines (32 loc) · 1.26 KB
/
subsystem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
from pants.option.custom_types import file_option, shell_str
class Isort(PythonToolBase):
"""The Python import sorter tool (https://timothycrosley.github.io/isort/)."""
options_scope = "isort"
default_version = "isort>=5.0.0,<6.0"
default_extra_requirements = ["setuptools<45"] # NB: `<45` is for Python 2 support
default_entry_point = "isort.main"
@classmethod
def register_options(cls, register):
super().register_options(register)
register(
"--skip",
type=bool,
default=False,
help="Don't use isort when running `./pants fmt` and `./pants lint`",
)
register(
"--args",
type=list,
member_type=shell_str,
help="Arguments to pass directly to isort, e.g. "
'`--isort-args="--case-sensitive --trailing-comma"`',
)
register(
"--config",
type=list,
member_type=file_option,
help="Path to `isort.cfg` or alternative isort config file(s)",
)