duty ¤
duty package.
A simple task runner.
Modules:
-
callables
–Module containing callables for many tools.
-
cli
–Deprecated. Import from
duty
directly. -
collection
–Deprecated. Import from
duty
directly. -
context
–Deprecated. Import from
duty
directly. -
decorator
–Deprecated. Import from
duty
directly. -
exceptions
–Deprecated. Import from
duty
directly. -
lazy
–Deprecated. Import from
failprint
directly. -
tools
–Our collection of tools.
-
validation
–Deprecated. Import from
duty
directly.
Classes:
-
Collection
–A collection of duties.
-
Context
–A simple context class.
-
Duty
–The main duty class.
-
DutyFailure
–An exception raised when a duty fails.
-
LazyStderr
–Lazy stderr buffer.
-
LazyStdout
–Lazy stdout buffer.
-
ParamsCaster
–A helper class to cast parameters based on a function's signature annotations.
-
Tool
–Base class for tools.
Functions:
-
cast_arg
–Cast an argument using a type annotation.
-
create_duty
–Register a duty in the collection.
-
duty
–Decorate a callable to transform it and register it as a duty.
-
get_duty_parser
–Get a duty-specific options parser.
-
get_parser
–Return the CLI argument parser.
-
main
–Run the main program.
-
parse_args
–Parse the positional and keyword arguments of a duty.
-
parse_commands
–Parse argument lists into ready-to-run duties.
-
parse_options
–Parse options for a duty.
-
print_help
–Print general help or duties help.
-
specified_options
–Cast an argparse Namespace into a dictionary of options.
-
split_args
–Split command line arguments into duty commands.
-
to_bool
–Convert a string to a boolean.
-
validate
–Validate positional and keyword arguments against a function.
Attributes:
-
CmdType
–Type of a command that can be run in a subprocess or as a Python callable.
-
DutyListType
–Type of a list of duties, which can be a list of strings, callables, or Duty instances.
-
default_duties_file
–Default path to the duties file, relative to the current working directory.
-
empty
–Empty value for a parameter's default value.
CmdType module-attribute
¤
DutyListType module-attribute
¤
Type of a list of duties, which can be a list of strings, callables, or Duty instances.
default_duties_file module-attribute
¤
default_duties_file = 'duties.py'
Default path to the duties file, relative to the current working directory.
Collection ¤
Collection(path: str = default_duties_file)
A collection of duties.
Attributes:
-
path
–The path to the duties file.
-
duties
(dict[str, Duty]
) –The list of duties.
-
aliases
(dict[str, Duty]
) –A dictionary of aliases pointing to their respective duties.
Parameters:
-
path
(str
, default:default_duties_file
) –The path to the duties file.
Methods:
-
add
–Add a duty to the collection.
-
clear
–Clear the collection.
-
completion_candidates
–Find shell completion candidates within this collection.
-
format_help
–Format a message listing the duties.
-
get
–Get a duty by its name or alias.
-
load
–Load duties from a Python file.
-
names
–Return the list of duties names and aliases.
Source code in src/duty/_internal/collection.py
133 134 135 136 137 138 139 140 141 142 143 144 |
|
aliases instance-attribute
¤
A dictionary of aliases pointing to their respective duties.
add ¤
add(duty: Duty) -> None
Add a duty to the collection.
Parameters:
-
duty
(Duty
) –The duty to add.
Source code in src/duty/_internal/collection.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|
clear ¤
clear() -> None
Clear the collection.
Source code in src/duty/_internal/collection.py
146 147 148 149 |
|
completion_candidates ¤
Find shell completion candidates within this collection.
Returns:
Source code in src/duty/_internal/collection.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
format_help ¤
format_help() -> str
Format a message listing the duties.
Returns:
-
str
–A string listing the duties and their summary.
Source code in src/duty/_internal/collection.py
202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
get ¤
Get a duty by its name or alias.
Parameters:
-
name_or_alias
(str
) –The name or alias of the duty.
Returns:
-
Duty
–A duty.
Source code in src/duty/_internal/collection.py
188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
load ¤
load(path: str | None = None) -> None
Load duties from a Python file.
Parameters:
-
path
(str | None
, default:None
) –The path to the Python file to load. Uses the collection's path by default.
Source code in src/duty/_internal/collection.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
names ¤
Return the list of duties names and aliases.
Returns:
Source code in src/duty/_internal/collection.py
151 152 153 154 155 156 157 |
|
Context ¤
A simple context class.
Context instances are passed to functions decorated with duty
.
Parameters:
-
options
(dict[str, Any]
) –Base options specified in
@duty(**options)
. -
options_override
(dict[str, Any] | None
, default:None
) –Options that override
run
and@duty
options. This argument is used to allow users to override options from the CLI or environment.
Methods:
-
cd
–Change working directory as a context manager.
-
options
–Change options as a context manager.
-
run
–Run a command in a subprocess or a Python callable.
Source code in src/duty/_internal/context.py
25 26 27 28 29 30 31 32 33 34 35 |
|
cd ¤
Change working directory as a context manager.
Parameters:
-
directory
(str
) –The directory to go into.
Yields:
-
Iterator
–Nothing.
Source code in src/duty/_internal/context.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
options ¤
Change options as a context manager.
Can be nested as will, previous options will pop once out of the with clause.
Parameters:
-
**opts
(Any
, default:{}
) –Options used in
run
.
Yields:
-
Iterator
–Nothing.
Source code in src/duty/_internal/context.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
run ¤
Run a command in a subprocess or a Python callable.
Parameters:
-
cmd
(CmdType
) –A command or a Python callable.
-
options
(Any
, default:{}
) –Options passed to
failprint
functions.
Raises:
-
DutyFailure
–When the exit code / function result is greather than 0.
Returns:
-
str
–The output of the command.
Source code in src/duty/_internal/context.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
Duty ¤
Duty(
name: str,
description: str,
function: Callable,
collection: Collection | None = None,
aliases: set | None = None,
pre: DutyListType | None = None,
post: DutyListType | None = None,
opts: dict[str, Any] | None = None,
)
The main duty class.
Parameters:
-
name
(str
) –The duty name.
-
description
(str
) –The duty description.
-
function
(Callable
) –The duty function.
-
collection
(Collection | None
, default:None
) –The collection on which to attach this duty.
-
aliases
(set | None
, default:None
) –A list of aliases for this duty.
-
pre
(DutyListType | None
, default:None
) –A list of duties to run before this one.
-
post
(DutyListType | None
, default:None
) –A list of duties to run after this one.
-
opts
(dict[str, Any] | None
, default:None
) –Options used to create the context instance.
Methods:
-
__call__
–Run the duty function.
-
run
–Run the duty.
-
run_duties
–Run a list of duties.
Attributes:
-
aliases
–A set of aliases for this duty.
-
collection
(Collection | None
) –The collection on which this duty is attached.
-
context
(Context
) –Return a new context instance.
-
default_options
(dict[str, Any]
) –Default options used to create the context instance.
-
description
–The duty description.
-
function
–The duty function.
-
name
–The duty name.
-
options
–Options used to create the context instance.
-
options_override
(dict
) –Options that override
run
and@duty
options. -
post
–A list of duties to run after this one.
-
pre
–A list of duties to run before this one.
Source code in src/duty/_internal/collection.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
collection instance-attribute
¤
collection: Collection | None = None
The collection on which this duty is attached.
default_options class-attribute
¤
Default options used to create the context instance.
options instance-attribute
¤
options = opts or default_options
Options used to create the context instance.
options_override instance-attribute
¤
options_override: dict = {}
Options that override run
and @duty
options.
__call__ ¤
Run the duty function.
Parameters:
-
context
(Context
) –The context to use.
-
args
(Any
, default:()
) –Positional arguments passed to the function.
-
kwargs
(Any
, default:{}
) –Keyword arguments passed to the function.
Source code in src/duty/_internal/collection.py
111 112 113 114 115 116 117 118 119 120 121 |
|
run ¤
Run the duty.
This is just a shortcut for duty(duty.context, *args, **kwargs)
.
Parameters:
-
args
(Any
, default:()
) –Positional arguments passed to the function.
-
kwargs
(Any
, default:{}
) –Keyword arguments passed to the function.
Source code in src/duty/_internal/collection.py
77 78 79 80 81 82 83 84 85 86 |
|
run_duties ¤
run_duties(
context: Context, duties_list: DutyListType
) -> None
Run a list of duties.
Parameters:
-
context
(Context
) –The context to use.
-
duties_list
(DutyListType
) –The list of duties to run.
Raises:
-
RuntimeError
–When a duty name is given to pre or post duties. Indeed, without a parent collection, it is impossible to find another duty by its name.
Source code in src/duty/_internal/collection.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
DutyFailure ¤
DutyFailure(code: int)
Bases: Exception
An exception raised when a duty fails.
Parameters:
-
code
(int
) –The exit code of a command.
Attributes:
-
code
–The exit code of the command that failed.
Source code in src/duty/_internal/exceptions.py
4 5 6 7 8 9 10 11 12 |
|
LazyStderr ¤
LazyStdout ¤
ParamsCaster ¤
ParamsCaster(signature: Signature)
A helper class to cast parameters based on a function's signature annotations.
Parameters:
-
signature
(Signature
) –The signature to use to cast arguments.
Methods:
-
annotation_at_pos
–Give the annotation for the parameter at the given position.
-
cast
–Cast all positional and keyword arguments.
-
cast_kwarg
–Cast a keyword argument.
-
cast_posarg
–Cast a positional argument.
-
eaten_by_var_positional
–Tell if the parameter at this position is eaten by a variable positional parameter.
Attributes:
-
has_var_positional
(bool
) –Tell if there is a variable positional parameter.
-
params_dict
–A dictionary of parameters, indexed by their name.
-
params_list
–A list of parameters, in the order they appear in the signature.
-
var_keyword_annotation
(Any
) –Give the variable keyword parameter (
**kwargs
) annotation if any. -
var_positional_annotation
(Any
) –Give the variable positional parameter (
*args
) annotation if any. -
var_positional_position
(int
) –Give the position of the variable positional parameter in the signature.
Source code in src/duty/_internal/validation.py
74 75 76 77 78 79 80 81 82 83 |
|
params_dict instance-attribute
¤
params_dict = parameters
A dictionary of parameters, indexed by their name.
params_list instance-attribute
¤
params_list = list(values())
A list of parameters, in the order they appear in the signature.
var_keyword_annotation cached
property
¤
var_keyword_annotation: Any
Give the variable keyword parameter (**kwargs
) annotation if any.
Returns:
-
Any
–The variable keyword parameter annotation.
var_positional_annotation cached
property
¤
var_positional_annotation: Any
Give the variable positional parameter (*args
) annotation if any.
Returns:
-
Any
–The variable positional parameter annotation.
var_positional_position cached
property
¤
var_positional_position: int
Give the position of the variable positional parameter in the signature.
Returns:
-
int
–The position of the variable positional parameter.
annotation_at_pos ¤
Give the annotation for the parameter at the given position.
Parameters:
-
pos
(int
) –The position of the parameter.
Returns:
-
Any
–The positional parameter annotation.
Source code in src/duty/_internal/validation.py
127 128 129 130 131 132 133 134 135 136 |
|
cast ¤
Cast all positional and keyword arguments.
Parameters:
-
*args
(Any
, default:()
) –The positional arguments.
-
**kwargs
(Any
, default:{}
) –The keyword arguments.
Returns:
Source code in src/duty/_internal/validation.py
177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
cast_kwarg ¤
Cast a keyword argument.
Parameters:
Returns:
-
Any
–The cast value.
Source code in src/duty/_internal/validation.py
163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
cast_posarg ¤
Cast a positional argument.
Parameters:
Returns:
-
Any
–The cast value.
Source code in src/duty/_internal/validation.py
149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
eaten_by_var_positional ¤
Tell if the parameter at this position is eaten by a variable positional parameter.
Parameters:
-
pos
(int
) –The position of the parameter.
Returns:
-
bool
–Whether the parameter is eaten.
Source code in src/duty/_internal/validation.py
138 139 140 141 142 143 144 145 146 147 |
|
Tool ¤
Base class for tools.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
-
add_args
–Append CLI arguments.
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
(str
) –The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cast_arg ¤
Cast an argument using a type annotation.
Parameters:
Returns:
-
Any
–The cast value.
Source code in src/duty/_internal/validation.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
create_duty ¤
create_duty(
func: Callable,
*,
name: str | None = None,
aliases: Iterable[str] | None = None,
pre: DutyListType | None = None,
post: DutyListType | None = None,
skip_if: bool = False,
skip_reason: str | None = None,
**opts: Any,
) -> Duty
Register a duty in the collection.
Parameters:
-
func
(Callable
) –The callable to register as a duty.
-
name
(str | None
, default:None
) –The duty name.
-
aliases
(Iterable[str] | None
, default:None
) –A set of aliases for this duty.
-
pre
(DutyListType | None
, default:None
) –Pre-duties.
-
post
(DutyListType | None
, default:None
) –Post-duties.
-
skip_if
(bool
, default:False
) –Skip running the duty if the given condition is met.
-
skip_reason
(str | None
, default:None
) –Custom message when skipping.
-
opts
(Any
, default:{}
) –Options passed to the context.
Returns:
-
Duty
–The registered duty.
Source code in src/duty/_internal/decorator.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
duty ¤
Decorate a callable to transform it and register it as a duty.
Parameters:
Raises:
-
ValueError
–When the decorator is misused.
Examples:
Decorate a function:
@duty
def clean(ctx):
ctx.run("rm -rf build", silent=True)
Pass options to the context:
@duty(silent=True)
def clean(ctx):
ctx.run("rm -rf build") # silent=True is implied
Returns:
Source code in src/duty/_internal/decorator.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
get_duty_parser ¤
Get a duty-specific options parser.
Parameters:
-
duty
(Duty
) –The duty to parse for.
Returns:
-
ArgParser
–A duty-specific parser.
Source code in src/duty/_internal/cli.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
get_parser ¤
get_parser() -> ArgParser
Return the CLI argument parser.
Returns:
-
ArgParser
–An argparse parser.
Source code in src/duty/_internal/cli.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
main ¤
Run the main program.
This function is executed when you type duty
or python -m duty
.
Parameters:
Returns:
-
int
–An exit code.
Source code in src/duty/_internal/cli.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
parse_args ¤
Parse the positional and keyword arguments of a duty.
Parameters:
Returns:
-
tuple
–The positional and keyword arguments.
Source code in src/duty/_internal/cli.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
parse_commands ¤
parse_commands(
arg_lists: list[list[str]],
global_opts: dict[str, Any],
collection: Collection,
) -> list[tuple]
Parse argument lists into ready-to-run duties.
Parameters:
-
arg_lists
(list[list[str]]
) –Lists of arguments lists.
-
global_opts
(dict[str, Any]
) –The global options.
-
collection
(Collection
) –The duties collection.
Returns:
Source code in src/duty/_internal/cli.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
parse_options ¤
Parse options for a duty.
Parameters:
Returns:
Source code in src/duty/_internal/cli.py
170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
print_help ¤
print_help(
parser: ArgParser,
opts: Namespace,
collection: Collection,
) -> None
Print general help or duties help.
Parameters:
-
parser
(ArgParser
) –The main parser.
-
opts
(Namespace
) –The main parsed options.
-
collection
(Collection
) –A collection of duties.
Source code in src/duty/_internal/cli.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
specified_options ¤
Cast an argparse Namespace into a dictionary of options.
Remove all options that were not specified (equal to None).
Parameters:
-
opts
(Namespace
) –The namespace to cast.
-
exclude
(set[str] | None
, default:None
) –Names of options to exclude from the result.
Returns:
-
dict
–A dictionary of specified-only options.
Source code in src/duty/_internal/cli.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
split_args ¤
Split command line arguments into duty commands.
Parameters:
Raises:
-
ValueError
–When a duty name is missing before an argument, or when the duty name is unknown.
Returns:
Source code in src/duty/_internal/cli.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
to_bool ¤
Convert a string to a boolean.
Parameters:
-
value
(str
) –The string to convert.
Returns:
-
bool
–True or False.
Source code in src/duty/_internal/validation.py
33 34 35 36 37 38 39 40 41 42 |
|
validate ¤
Validate positional and keyword arguments against a function.
First we clone the function, removing the first parameter (the context) and the body, to fail early with a TypeError
if the arguments are incorrect: not enough, too much, in the wrong order, etc.
Then we cast all the arguments using the function's signature and we return them.
Parameters:
-
func
(Callable
) –The function to copy.
-
*args
(Any
, default:()
) –The positional arguments.
-
**kwargs
(Any
, default:{}
) –The keyword arguments.
Returns:
Source code in src/duty/_internal/validation.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
callables ¤
Module containing callables for many tools.
These callables are deprecated in favor of our new tools.
Modules:
-
autoflake
–Deprecated. Use
duty.tools.autoflake
instead. -
black
–Deprecated. Use
duty.tools.black
instead. -
blacken_docs
–Deprecated. Use
duty.tools.blacken_docs
instead. -
build
–Deprecated. Use
duty.tools.build
instead. -
coverage
–Deprecated. Use
duty.tools.coverage
instead. -
flake8
–Deprecated. Use
duty.tools.flake8
instead. -
git_changelog
–Deprecated. Use
duty.tools.git_changelog
instead. -
griffe
–Deprecated. Use
duty.tools.griffe
instead. -
interrogate
–Deprecated. Use
duty.tools.interrogate
instead. -
isort
–Deprecated. Use
duty.tools.isort
instead. -
mkdocs
–Deprecated. Use
duty.tools.mkdocs
instead. -
mypy
–Deprecated. Use
duty.tools.mypy
instead. -
pytest
–Deprecated. Use
duty.tools.pytest
instead. -
ruff
–Deprecated. Use
duty.tools.ruff
instead. -
safety
–Deprecated. Use
duty.tools.safety
instead. -
ssort
–Deprecated. Use
duty.tools.ssort
instead. -
twine
–Deprecated. Use
duty.tools.twine
instead.
autoflake ¤
Deprecated. Use duty.tools.autoflake
instead.
black ¤
Deprecated. Use duty.tools.black
instead.
blacken_docs ¤
Deprecated. Use duty.tools.blacken_docs
instead.
build ¤
Deprecated. Use duty.tools.build
instead.
coverage ¤
Deprecated. Use duty.tools.coverage
instead.
flake8 ¤
Deprecated. Use duty.tools.flake8
instead.
git_changelog ¤
Deprecated. Use duty.tools.git_changelog
instead.
griffe ¤
Deprecated. Use duty.tools.griffe
instead.
interrogate ¤
Deprecated. Use duty.tools.interrogate
instead.
isort ¤
Deprecated. Use duty.tools.isort
instead.
mkdocs ¤
Deprecated. Use duty.tools.mkdocs
instead.
mypy ¤
Deprecated. Use duty.tools.mypy
instead.
pytest ¤
Deprecated. Use duty.tools.pytest
instead.
ruff ¤
Deprecated. Use duty.tools.ruff
instead.
safety ¤
Deprecated. Use duty.tools.safety
instead.
ssort ¤
Deprecated. Use duty.tools.ssort
instead.
twine ¤
Deprecated. Use duty.tools.twine
instead.
cli ¤
Deprecated. Import from duty
directly.
collection ¤
Deprecated. Import from duty
directly.
context ¤
Deprecated. Import from duty
directly.
decorator ¤
Deprecated. Import from duty
directly.
exceptions ¤
Deprecated. Import from duty
directly.
lazy ¤
tools ¤
Our collection of tools.
Classes:
-
autoflake
–Call autoflake.
-
black
–Call Black.
-
blacken_docs
–Call blacken-docs.
-
build
–Call build.
-
coverage
–Call Coverage.py.
-
flake8
–Call Flake8.
-
git_changelog
–Call git-changelog.
-
griffe
–Call Griffe.
-
interrogate
–Call Interrogate.
-
isort
–Call isort.
-
mkdocs
–Call MkDocs.
-
mypy
–Call Mypy.
-
pytest
–Call pytest.
-
ruff
–Call Ruff.
-
safety
–Call Safety.
-
ssort
–Call ssort.
-
twine
–Call Twine.
-
yore
–Call Yore.
autoflake ¤
autoflake(
*files: str,
config: str | None = None,
check: bool | None = None,
check_diff: bool | None = None,
imports: list[str] | None = None,
remove_all_unused_imports: bool | None = None,
recursive: bool | None = None,
jobs: int | None = None,
exclude: list[str] | None = None,
expand_star_imports: bool | None = None,
ignore_init_module_imports: bool | None = None,
remove_duplicate_keys: bool | None = None,
remove_unused_variables: bool | None = None,
remove_rhs_for_unused_variables: bool | None = None,
ignore_pass_statements: bool | None = None,
ignore_pass_after_docstring: bool | None = None,
quiet: bool | None = None,
verbose: bool | None = None,
stdin_display_name: str | None = None,
in_place: bool | None = None,
stdout: bool | None = None,
)
Bases: Tool
Call autoflake.
Parameters:
-
*files
(str
, default:()
) –Files to format.
-
config
(str | None
, default:None
) –Explicitly set the config file instead of auto determining based on file location.
-
check
(bool | None
, default:None
) –Return error code if changes are needed.
-
check_diff
(bool | None
, default:None
) –Return error code if changes are needed, also display file diffs.
-
imports
(list[str] | None
, default:None
) –By default, only unused standard library imports are removed; specify a comma-separated list of additional modules/packages.
-
remove_all_unused_imports
(bool | None
, default:None
) –Remove all unused imports (not just those from the standard library).
-
recursive
(bool | None
, default:None
) –Drill down directories recursively.
-
jobs
(int | None
, default:None
) –Number of parallel jobs; match CPU count if value is 0 (default: 0).
-
exclude
(list[str] | None
, default:None
) –Exclude file/directory names that match these comma-separated globs.
-
expand_star_imports
(bool | None
, default:None
) –Expand wildcard star imports with undefined names; this only triggers if there is only one star import in the file; this is skipped if there are any uses of
__all__
ordel
in the file. -
ignore_init_module_imports
(bool | None
, default:None
) –Exclude
__init__.py
when removing unused imports. -
remove_duplicate_keys
(bool | None
, default:None
) –Remove all duplicate keys in objects.
-
remove_unused_variables
(bool | None
, default:None
) –Remove unused variables.
-
remove_rhs_for_unused_variables
(bool | None
, default:None
) –Remove RHS of statements when removing unused variables (unsafe).
-
ignore_pass_statements
(bool | None
, default:None
) –Ignore all pass statements.
-
ignore_pass_after_docstring
(bool | None
, default:None
) –Ignore pass statements after a newline ending on
\"\"\"
. -
quiet
(bool | None
, default:None
) –Suppress output if there are no issues.
-
verbose
(bool | None
, default:None
) –Print more verbose logs (you can repeat
-v
to make it more verbose). -
stdin_display_name
(str | None
, default:None
) –The name used when processing input from stdin.
-
in_place
(bool | None
, default:None
) –Make changes to files instead of printing diffs.
-
stdout
(bool | None
, default:None
) –Print changed text to stdout. defaults to true when formatting stdin, or to false otherwise.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_autoflake.py
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'autoflake'
The name of the executable on PATH.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_autoflake.py
130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
black ¤
black(
*src: str,
config: str | None = None,
code: str | None = None,
line_length: int | None = None,
target_version: str | None = None,
check: bool | None = None,
diff: bool | None = None,
color: bool | None = None,
fast: bool | None = None,
pyi: bool | None = None,
ipynb: bool | None = None,
python_cell_magics: str | None = None,
skip_source_first_line: bool | None = None,
skip_string_normalization: bool | None = None,
skip_magic_trailing_comma: bool | None = None,
experimental_string_processing: bool | None = None,
preview: bool | None = None,
quiet: bool | None = None,
verbose: bool | None = None,
required_version: str | None = None,
include: str | None = None,
exclude: str | None = None,
extend_exclude: str | None = None,
force_exclude: str | None = None,
stdin_filename: str | None = None,
workers: int | None = None,
)
Bases: Tool
Call Black.
Parameters:
-
src
(str
, default:()
) –Format the directories and file paths.
-
config
(str | None
, default:None
) –Read configuration from this file path.
-
code
(str | None
, default:None
) –Format the code passed in as a string.
-
line_length
(int | None
, default:None
) –How many characters per line to allow [default: 120].
-
target_version
(str | None
, default:None
) –Python versions that should be supported by Black's output. By default, Black will try to infer this from the project metadata in pyproject.toml. If this does not yield conclusive results, Black will use per-file auto-detection.
-
check
(bool | None
, default:None
) –Don't write the files back, just return the status. Return code 0 means nothing would change. Return code 1 means some files would be reformatted. Return code 123 means there was an internal error.
-
diff
(bool | None
, default:None
) –Don't write the files back, just output a diff for each file on stdout.
-
color
(bool | None
, default:None
) –Show colored diff. Only applies when
--diff
is given. -
fast
(bool | None
, default:None
) –If --fast given, skip temporary sanity checks. [default: --safe]
-
pyi
(bool | None
, default:None
) –Format all input files like typing stubs regardless of file extension (useful when piping source on standard input).
-
ipynb
(bool | None
, default:None
) –Format all input files like Jupyter Notebooks regardless of file extension (useful when piping source on standard input).
-
python_cell_magics
(str | None
, default:None
) –When processing Jupyter Notebooks, add the given magic to the list of known python-magics (capture, prun, pypy, python, python3, time, timeit). Useful for formatting cells with custom python magics.
-
skip_source_first_line
(bool | None
, default:None
) –Skip the first line of the source code.
-
skip_string_normalization
(bool | None
, default:None
) –Don't normalize string quotes or prefixes.
-
skip_magic_trailing_comma
(bool | None
, default:None
) –Don't use trailing commas as a reason to split lines.
-
preview
(bool | None
, default:None
) –Enable potentially disruptive style changes that may be added to Black's main functionality in the next major release.
-
quiet
(bool | None
, default:None
) –Don't emit non-error messages to stderr. Errors are still emitted; silence those with 2>/dev/null.
-
verbose
(bool | None
, default:None
) –Also emit messages to stderr about files that were not changed or were ignored due to exclusion patterns.
-
required_version
(str | None
, default:None
) –Require a specific version of Black to be running (useful for unifying results across many environments e.g. with a pyproject.toml file). It can be either a major version number or an exact version.
-
include
(str | None
, default:None
) –A regular expression that matches files and directories that should be included on recursive searches. An empty value means all files are included regardless of the name. Use forward slashes for directories on all platforms (Windows, too). Exclusions are calculated first, inclusions later [default: (.pyi?|.ipynb)$].
-
exclude
(str | None
, default:None
) –A regular expression that matches files and directories that should be excluded on recursive searches. An empty value means no paths are excluded. Use forward slashes for directories on all platforms (Windows, too). Exclusions are calculated first, inclusions later [default: /(.direnv|.eggs|.git|.hg|.mypy_cache|.nox| .tox|.venv|venv|.svn|.ipynb_checkpoints|_build|buck-out|build|dist|pypackages)/].
-
extend_exclude
(str | None
, default:None
) –Like --exclude, but adds additional files and directories on top of the excluded ones (useful if you simply want to add to the default).
-
force_exclude
(str | None
, default:None
) –Like --exclude, but files and directories matching this regex will be excluded even when they are passed explicitly as arguments.
-
stdin_filename
(str | None
, default:None
) –The name of the file when passing it through stdin. Useful to make sure Black will respect --force-exclude option on some editors that rely on using stdin.
-
workers
(int | None
, default:None
) –Number of parallel workers [default: number CPUs in the system].
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_black.py
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'black'
The name of the executable on PATH.
__call__ ¤
__call__() -> None
Run the command.
Source code in src/duty/_internal/tools/_black.py
180 181 182 183 184 |
|
blacken_docs ¤
blacken_docs(
*paths: str | Path,
exts: Sequence[str] | None = None,
exclude: Sequence[str | Pattern] | None = None,
skip_errors: bool = False,
rst_literal_blocks: bool = False,
line_length: int | None = None,
string_normalization: bool = True,
is_pyi: bool = False,
is_ipynb: bool = False,
skip_source_first_line: bool = False,
magic_trailing_comma: bool = True,
python_cell_magics: set[str] | None = None,
preview: bool = False,
check_only: bool = False,
)
Bases: Tool
Call blacken-docs.
Parameters:
-
*paths
(str | Path
, default:()
) –Directories and files to format.
-
exts
(Sequence[str] | None
, default:None
) –List of extensions to select files with.
-
exclude
(Sequence[str | Pattern] | None
, default:None
) –List of regular expressions to exclude files.
-
skip_errors
(bool
, default:False
) –Don't exit non-zero for errors from Black (normally syntax errors).
-
rst_literal_blocks
(bool
, default:False
) –Also format literal blocks in reStructuredText files (more below).
-
line_length
(int | None
, default:None
) –How many characters per line to allow.
-
string_normalization
(bool
, default:True
) –Normalize string quotes or prefixes.
-
is_pyi
(bool
, default:False
) –Format all input files like typing stubs regardless of file extension.
-
is_ipynb
(bool
, default:False
) –Format all input files like Jupyter Notebooks regardless of file extension.
-
skip_source_first_line
(bool
, default:False
) –Skip the first line of the source code.
-
magic_trailing_comma
(bool
, default:True
) –Use trailing commas as a reason to split lines.
-
python_cell_magics
(set[str] | None
, default:None
) –When processing Jupyter Notebooks, add the given magic to the list of known python-magics (capture, prun, pypy, python, python3, time, timeit). Useful for formatting cells with custom python magics.
-
preview
(bool
, default:False
) –Enable potentially disruptive style changes that may be added to Black's main functionality in the next major release.
-
check_only
(bool
, default:False
) –Don't modify files but indicate when changes are necessary with a message and non-zero return code.
Returns:
-
None
–Success/failure.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_blacken_docs.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'blacken-docs'
The name of the executable on PATH.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_blacken_docs.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
build ¤
build(
srcdir: str | None = None,
*,
version: bool = False,
verbose: bool = False,
sdist: bool = False,
wheel: bool = False,
outdir: str | None = None,
skip_dependency_check: bool = False,
no_isolation: bool = False,
installer: Literal["pip", "uv"] | None = None,
config_setting: list[str] | None = None,
)
Bases: Tool
Call build.
Parameters:
-
srcdir
(str | None
, default:None
) –Source directory (defaults to current directory).
-
version
(bool
, default:False
) –Show program's version number and exit.
-
verbose
(bool
, default:False
) –Increase verbosity
-
sdist
(bool
, default:False
) –Build a source distribution (disables the default behavior).
-
wheel
(bool
, default:False
) –Build a wheel (disables the default behavior).
-
outdir
(str | None
, default:None
) –Output directory (defaults to
{srcdir}/dist
). -
skip_dependency_check
(bool
, default:False
) –Do not check that build dependencies are installed.
-
no_isolation
(bool
, default:False
) –Disable building the project in an isolated virtual environment. Build dependencies must be installed separately when this option is used.
-
installer
(Literal['pip', 'uv'] | None
, default:None
) –Python package installer to use (defaults to pip).
-
config_setting
(list[str] | None
, default:None
) –Settings to pass to the backend. Multiple settings can be provided.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_build.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'pyproject-build'
The name of the executable on PATH.
__call__ ¤
__call__() -> None
Run the command.
Source code in src/duty/_internal/tools/_build.py
80 81 82 83 84 |
|
coverage ¤
Bases: Tool
Call Coverage.py.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
-
__call__
–Run the command.
-
add_args
–Append CLI arguments.
-
annotate
–Annotate source files with execution information.
-
combine
–Combine a number of data files.
-
debug
–Display information about the internals of coverage.py.
-
erase
–Erase previously collected coverage data.
-
html
–Create an HTML report.
-
json
–Create a JSON report of coverage results.
-
lcov
–Create an LCOV report of coverage results.
-
report
–Report coverage statistics on modules.
-
run
–Run a Python program and measure code execution.
-
xml
–Create an XML report of coverage results.
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'coverage'
The name of the executable on PATH.
__call__ ¤
__call__() -> int | None
Run the command.
Returns:
-
int | None
–The exit code of the command.
Source code in src/duty/_internal/tools/_coverage.py
717 718 719 720 721 722 723 724 725 |
|
add_args ¤
add_args(*args: str) -> Self
Append CLI arguments.
Source code in src/duty/_internal/tools/_base.py
69 70 71 72 |
|
annotate classmethod
¤
annotate(
*,
rcfile: str | None = None,
directory: str | None = None,
data_file: str | None = None,
ignore_errors: bool | None = None,
include: list[str] | None = None,
omit: list[str] | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Annotate source files with execution information.
Make annotated copies of the given files, marking statements that are executed with >
and statements that are missed with !
.
Parameters:
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
directory
(str | None
, default:None
) –Write the output files to this directory.
-
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
ignore_errors
(bool | None
, default:None
) –Ignore errors while reading source files.
-
include
(list[str] | None
, default:None
) –Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
omit
(list[str] | None
, default:None
) –Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
combine classmethod
¤
combine(
*paths: str,
rcfile: str | None = None,
append: bool | None = None,
data_file: str | None = None,
keep: bool | None = None,
quiet: bool | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Combine a number of data files.
Combine data from multiple coverage files. The combined results are written to a single file representing the union of the data. The positional arguments are data files or directories containing data files. If no paths are provided, data files in the default data file's directory are combined.
Parameters:
-
paths
(str
, default:()
) –Paths to combine.
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
append
(bool | None
, default:None
) –Append coverage data to .coverage, otherwise it starts clean each time.
-
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
keep
(bool | None
, default:None
) –Keep original coverage files, otherwise they are deleted.
-
quiet
(bool | None
, default:None
) –Don't print messages about what is happening.
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
debug classmethod
¤
debug(
topic: Literal[
"data", "sys", "config", "premain", "pybehave"
],
*,
rcfile: str | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Display information about the internals of coverage.py.
Display information about the internals of coverage.py, for diagnosing problems. Topics are: data
to show a summary of the collected data; sys
to show installation information; config
to show the configuration; premain
to show what is calling coverage; pybehave
to show internal flags describing Python behavior.
Parameters:
-
topic
(Literal['data', 'sys', 'config', 'premain', 'pybehave']
) –Topic to display.
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
erase classmethod
¤
erase(
*,
rcfile: str | None = None,
data_file: str | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Erase previously collected coverage data.
Parameters:
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
html classmethod
¤
html(
*,
rcfile: str | None = None,
contexts: list[str] | None = None,
directory: str | None = None,
data_file: str | None = None,
fail_under: int | None = None,
ignore_errors: bool | None = None,
include: list[str] | None = None,
omit: list[str] | None = None,
precision: int | None = None,
quiet: bool | None = None,
show_contexts: bool | None = None,
skip_covered: bool | None = None,
skip_empty: bool | None = None,
title: str | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Create an HTML report.
Create an HTML report of the coverage of the files. Each file gets its own page, with the source decorated to show executed, excluded, and missed lines.
Parameters:
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
contexts
(list[str] | None
, default:None
) –Only display data from lines covered in the given contexts. Accepts Python regexes, which must be quoted.
-
directory
(str | None
, default:None
) –Write the output files to this directory.
-
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
fail_under
(int | None
, default:None
) –Exit with a status of 2 if the total coverage is less than the given number.
-
ignore_errors
(bool | None
, default:None
) –Ignore errors while reading source files.
-
include
(list[str] | None
, default:None
) –Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
omit
(list[str] | None
, default:None
) –Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
precision
(int | None
, default:None
) –Number of digits after the decimal point to display for reported coverage percentages.
-
quiet
(bool | None
, default:None
) –Don't print messages about what is happening.
-
show_contexts
(bool | None
, default:None
) –Show contexts for covered lines.
-
skip_covered
(bool | None
, default:None
) –Skip files with 100% coverage.
-
skip_empty
(bool | None
, default:None
) –Skip files with no code.
-
title
(str | None
, default:None
) –A text string to use as the title on the HTML.
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
json classmethod
¤
json(
*,
rcfile: str | None = None,
contexts: list[str] | None = None,
data_file: str | None = None,
fail_under: int | None = None,
ignore_errors: bool | None = None,
include: list[str] | None = None,
omit: list[str] | None = None,
output: str | None = None,
pretty_print: bool | None = None,
quiet: bool | None = None,
show_contexts: bool | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Create a JSON report of coverage results.
Parameters:
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
contexts
(list[str] | None
, default:None
) –Only display data from lines covered in the given contexts. Accepts Python regexes, which must be quoted.
-
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
fail_under
(int | None
, default:None
) –Exit with a status of 2 if the total coverage is less than the given number.
-
ignore_errors
(bool | None
, default:None
) –Ignore errors while reading source files.
-
include
(list[str] | None
, default:None
) –Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
omit
(list[str] | None
, default:None
) –Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
output
(str | None
, default:None
) –Write the JSON report to this file. Defaults to
coverage.json
. -
pretty_print
(bool | None
, default:None
) –Format the JSON for human readers.
-
quiet
(bool | None
, default:None
) –Don't print messages about what is happening.
-
show_contexts
(bool | None
, default:None
) –Show contexts for covered lines.
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
|
lcov classmethod
¤
lcov(
*,
rcfile: str | None = None,
data_file: str | None = None,
fail_under: int | None = None,
ignore_errors: bool | None = None,
include: list[str] | None = None,
omit: list[str] | None = None,
output: str | None = None,
quiet: bool | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Create an LCOV report of coverage results.
Parameters:
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
fail_under
(int | None
, default:None
) –Exit with a status of 2 if the total coverage is less than the given number.
-
ignore_errors
(bool | None
, default:None
) –Ignore errors while reading source files.
-
include
(list[str] | None
, default:None
) –Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
omit
(list[str] | None
, default:None
) –Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
output
(str | None
, default:None
) –Write the JSON report to this file. Defaults to
coverage.json
. -
quiet
(bool | None
, default:None
) –Don't print messages about what is happening.
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
report classmethod
¤
report(
*,
rcfile: str | None = None,
contexts: list[str] | None = None,
data_file: str | None = None,
fail_under: int | None = None,
output_format: Literal["text", "markdown", "total"]
| None = None,
ignore_errors: bool | None = None,
include: list[str] | None = None,
omit: list[str] | None = None,
precision: int | None = None,
sort: Literal[
"name", "stmts", "miss", "branch", "brpart", "cover"
]
| None = None,
show_missing: bool | None = None,
skip_covered: bool | None = None,
skip_empty: bool | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Report coverage statistics on modules.
Parameters:
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
contexts
(list[str] | None
, default:None
) –Only display data from lines covered in the given contexts.
-
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
fail_under
(int | None
, default:None
) –Exit with a status of 2 if the total coverage is less than the given number.
-
output_format
(Literal['text', 'markdown', 'total'] | None
, default:None
) –Output format, either text (default), markdown, or total.
-
ignore_errors
(bool | None
, default:None
) –Ignore errors while reading source files.
-
include
(list[str] | None
, default:None
) –Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
omit
(list[str] | None
, default:None
) –Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
precision
(int | None
, default:None
) –Number of digits after the decimal point to display for reported coverage percentages.
-
sort
(Literal['name', 'stmts', 'miss', 'branch', 'brpart', 'cover'] | None
, default:None
) –Sort the report by the named column: name, stmts, miss, branch, brpart, or cover. Default is name.
-
show_missing
(bool | None
, default:None
) –Show line numbers of statements in each module that weren't executed.
-
skip_covered
(bool | None
, default:None
) –Skip files with 100% coverage.
-
skip_empty
(bool | None
, default:None
) –Skip files with no code.
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
|
run classmethod
¤
run(
pyfile: str,
*,
rcfile: str | None = None,
append: bool | None = None,
branch: bool | None = None,
concurrency: list[str] | None = None,
context: str | None = None,
data_file: str | None = None,
include: list[str] | None = None,
omit: list[str] | None = None,
module: bool | None = None,
pylib: bool | None = None,
parallel_mode: bool | None = None,
source: list[str] | None = None,
timid: bool | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Run a Python program and measure code execution.
Parameters:
-
pyfile
(str
) –Python script or module to run.
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
append
(bool | None
, default:None
) –Append coverage data to .coverage, otherwise it starts clean each time.
-
branch
(bool | None
, default:None
) –Measure branch coverage in addition to statement coverage.
-
concurrency
(list[str] | None
, default:None
) –Properly measure code using a concurrency library. Valid values are: eventlet, gevent, greenlet, multiprocessing, thread, or a comma-list of them.
-
context
(str | None
, default:None
) –The context label to record for this coverage run.
-
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
include
(list[str] | None
, default:None
) –Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
omit
(list[str] | None
, default:None
) –Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
module
(bool | None
, default:None
) –The given file is an importable Python module, not a script path, to be run as
python -m
would run it. -
pylib
(bool | None
, default:None
) –Measure coverage even inside the Python installed library, which isn't done by default.
-
parallel_mode
(bool | None
, default:None
) –Append the machine name, process id and random number to the data file name to simplify collecting data from many processes.
-
source
(list[str] | None
, default:None
) –A list of directories or importable names of code to measure.
-
timid
(bool | None
, default:None
) –Use a simpler but slower trace method. Try this if you get seemingly impossible results!
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 |
|
xml classmethod
¤
xml(
*,
rcfile: str | None = None,
data_file: str | None = None,
fail_under: int | None = None,
ignore_errors: bool | None = None,
include: list[str] | None = None,
omit: list[str] | None = None,
output: str | None = None,
quiet: bool | None = None,
skip_empty: bool | None = None,
debug_opts: list[str] | None = None,
) -> coverage
Create an XML report of coverage results.
Parameters:
-
rcfile
(str | None
, default:None
) –Specify configuration file. By default
.coveragerc
,setup.cfg
,tox.ini
, andpyproject.toml
are tried [env:COVERAGE_RCFILE
]. -
data_file
(str | None
, default:None
) –Read coverage data for report generation from this file. Defaults to
.coverage
[env:COVERAGE_FILE
]. -
fail_under
(int | None
, default:None
) –Exit with a status of 2 if the total coverage is less than the given number.
-
ignore_errors
(bool | None
, default:None
) –Ignore errors while reading source files.
-
include
(list[str] | None
, default:None
) –Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
omit
(list[str] | None
, default:None
) –Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.
-
output
(str | None
, default:None
) –Write the JSON report to this file. Defaults to
coverage.json
. -
quiet
(bool | None
, default:None
) –Don't print messages about what is happening.
-
skip_empty
(bool | None
, default:None
) –Skip files with no code.
-
debug_opts
(list[str] | None
, default:None
) –Debug options, separated by commas [env:
COVERAGE_DEBUG
].
Source code in src/duty/_internal/tools/_coverage.py
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 |
|
flake8 ¤
flake8(
*paths: str,
config: str | None = None,
verbose: bool | None = None,
output_file: str | None = None,
append_config: str | None = None,
isolated: bool | None = None,
enable_extensions: list[str] | None = None,
require_plugins: list[str] | None = None,
quiet: bool | None = None,
color: Literal["auto", "always", "never"] | None = None,
count: bool | None = None,
exclude: list[str] | None = None,
extend_exclude: list[str] | None = None,
filename: list[str] | None = None,
stdin_display_name: str | None = None,
error_format: str | None = None,
hang_closing: bool | None = None,
ignore: list[str] | None = None,
extend_ignore: list[str] | None = None,
per_file_ignores: dict[str, list[str]] | None = None,
max_line_length: int | None = None,
max_doc_length: int | None = None,
indent_size: int | None = None,
select: list[str] | None = None,
extend_select: list[str] | None = None,
disable_noqa: bool | None = None,
show_source: bool | None = None,
no_show_source: bool | None = None,
statistics: bool | None = None,
exit_zero: bool | None = None,
jobs: int | None = None,
tee: bool | None = None,
benchmark: bool | None = None,
bug_report: bool | None = None,
)
Bases: Tool
Call Flake8.
Parameters:
-
*paths
(str
, default:()
) –Paths to check.
-
config
(str | None
, default:None
) –Path to the config file that will be the authoritative config source. This will cause Flake8 to ignore all other configuration files.
-
verbose
(bool | None
, default:None
) –Print more information about what is happening in flake8. This option is repeatable and will increase verbosity each time it is repeated.
-
output_file
(str | None
, default:None
) –Redirect report to a file.
-
append_config
(str | None
, default:None
) –Provide extra config files to parse in addition to the files found by Flake8 by default. These files are the last ones read and so they take the highest precedence when multiple files provide the same option.
-
isolated
(bool | None
, default:None
) –Ignore all configuration files.
-
enable_extensions
(list[str] | None
, default:None
) –Enable plugins and extensions that are otherwise disabled by default.
-
require_plugins
(list[str] | None
, default:None
) –Require specific plugins to be installed before running.
-
quiet
(bool | None
, default:None
) –Report only file names, or nothing. This option is repeatable.
-
color
(Literal['auto', 'always', 'never'] | None
, default:None
) –Whether to use color in output. Defaults to
auto
. -
count
(bool | None
, default:None
) –Print total number of errors to standard output and set the exit code to 1 if total is not empty.
-
exclude
(list[str] | None
, default:None
) –Comma-separated list of files or directories to exclude (default: ['.svn', 'CVS', '.bzr', '.hg', '.git', 'pycache', '.tox', '.nox', '.eggs', '*.egg']).
-
extend_exclude
(list[str] | None
, default:None
) –Comma-separated list of files or directories to add to the list of excluded ones.
-
filename
(list[str] | None
, default:None
) –Only check for filenames matching the patterns in this comma-separated list (default: ['*.py']).
-
stdin_display_name
(str | None
, default:None
) –The name used when reporting errors from code passed via stdin. This is useful for editors piping the file contents to flake8 (default: stdin).
-
error_format
(str | None
, default:None
) –Format errors according to the chosen formatter.
-
hang_closing
(bool | None
, default:None
) –Hang closing bracket instead of matching indentation of opening bracket's line.
-
ignore
(list[str] | None
, default:None
) –Comma-separated list of error codes to ignore (or skip). For example,
--ignore=E4,E51,W234
(default: E121,E123,E126,E226,E24,E704,W503,W504). -
extend_ignore
(list[str] | None
, default:None
) –Comma-separated list of error codes to add to the list of ignored ones. For example,
--extend-ignore=E4,E51,W234
. -
per_file_ignores
(dict[str, list[str]] | None
, default:None
) –A pairing of filenames and violation codes that defines which violations to ignore in a particular file. The filenames can be specified in a manner similar to the
--exclude
option and the violations work similarly to the--ignore
and--select
options. -
max_line_length
(int | None
, default:None
) –Maximum allowed line length for the entirety of this run (default: 79).
-
max_doc_length
(int | None
, default:None
) –Maximum allowed doc line length for the entirety of this run (default: None).
-
indent_size
(int | None
, default:None
) –Number of spaces used for indentation (default: 4).
-
select
(list[str] | None
, default:None
) –Comma-separated list of error codes to enable. For example,
--select=E4,E51,W234
(default: E,F,W,C90). -
extend_select
(list[str] | None
, default:None
) –Comma-separated list of error codes to add to the list of selected ones. For example,
--extend-select=E4,E51,W234
. -
disable_noqa
(bool | None
, default:None
) –Disable the effect of "# noqa". This will report errors on lines with "# noqa" at the end.
-
show_source
(bool | None
, default:None
) –Show the source generate each error or warning.
-
no_show_source
(bool | None
, default:None
) –Negate --show-source.
-
statistics
(bool | None
, default:None
) –Count errors.
-
exit_zero
(bool | None
, default:None
) –Exit with status code "0" even if there are errors.
-
jobs
(int | None
, default:None
) –Number of subprocesses to use to run checks in parallel. This is ignored on Windows. The default, "auto", will auto-detect the number of processors available to use (default: auto).
-
tee
(bool | None
, default:None
) –Write to stdout and output-file.
-
benchmark
(bool | None
, default:None
) –Print benchmark information about this run of Flake8.
-
bug_report
(bool | None
, default:None
) –Print information necessary when preparing a bug report.
Returns:
-
None
–Success/failure.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_flake8.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'flake8'
The name of the executable on PATH.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_flake8.py
220 221 222 223 224 225 226 227 228 |
|
git_changelog ¤
git_changelog(
repository: str | None = None,
*,
config_file: str | None = None,
bump: str | None = None,
versioning: Literal["semver", "pep440"] | None = None,
in_place: bool = False,
version_regex: str | None = None,
marker_line: str | None = None,
output: str | None = None,
provider: Literal["github", "gitlab", "bitbucket"]
| None = None,
parse_refs: bool = False,
release_notes: bool = False,
input: str | None = None,
convention: Literal["basic", "angular", "conventional"]
| None = None,
sections: list[str] | None = None,
template: str | None = None,
git_trailers: bool = False,
omit_empty_versions: bool = False,
no_zerover: bool = False,
filter_commits: str | None = None,
jinja_context: list[str] | None = None,
version: bool = False,
debug_info: bool = False,
)
Bases: Tool
Call git-changelog.
Parameters:
-
repository
(str | None
, default:None
) –The repository path, relative or absolute. Default: current working directory.
-
config_file
(str | None
, default:None
) –Configuration file(s).
-
bump
(str | None
, default:None
) –Specify the bump from latest version for the set of unreleased commits. Can be one of
auto
,major
,minor
,patch
or a valid SemVer version (eg. 1.2.3). For both SemVer and PEP 440 versioning schemes (see -n),auto
will bump the major number if a commit contains breaking changes (or the minor number for 0.x versions, see -Z), else the minor number if there are new features, else the patch number. Default: unset (false). -
versioning
(Literal['semver', 'pep440'] | None
, default:None
) –Versioning scheme to use when bumping and comparing versions. The selected scheme will impact the values accepted by the
--bump
option. Supported:pep440
,semver
.PEP 440 provides the following bump strategies:
auto
,epoch
,release
,major
,minor
,micro
,patch
,pre
,alpha
,beta
,candidate
,post
,dev
. Valuesauto
,major
,minor
,micro
can be suffixed with one of+alpha
,+beta
,+candidate
, and/or+dev
. Valuesalpha
,beta
andcandidate
can be suffixed with+dev
. Examples:auto+alpha
,major+beta+dev
,micro+dev
,candidate+dev
, etc..SemVer provides the following bump strategies:
auto
,major
,minor
,patch
,release
. See the docs for more information. Default: unset (semver
). -
in_place
(bool
, default:False
) –Insert new entries (versions missing from changelog) in-place. An output file must be specified. With custom templates, you can pass two additional arguments:
--version-regex
and--marker-line
. When writing in-place, anin_place
variable will be injected in the Jinja context, allowing to adapt the generated contents (for example to skip changelog headers or footers). Default: unset (false). -
version_regex
(str | None
, default:None
) –A regular expression to match versions in the existing changelog (used to find the latest release) when writing in-place. The regular expression must be a Python regex with a
version
named group. Default:^## \[(?P<version>v?[^\]]+)
. -
marker_line
(str | None
, default:None
) –A marker line at which to insert new entries (versions missing from changelog). If two marker lines are present in the changelog, the contents between those two lines will be overwritten (useful to update an 'Unreleased' entry for example). Default:
<!-- insertion marker -->
. -
output
(str | None
, default:None
) –Output to given file. Default: standard output.
-
provider
(Literal['github', 'gitlab', 'bitbucket'] | None
, default:None
) –Explicitly specify the repository provider. Default: unset.
-
parse_refs
(bool
, default:False
) –Parse provider-specific references in commit messages (GitHub/GitLab/Bitbucket issues, PRs, etc.). Default: unset (false).
-
release_notes
(bool
, default:False
) –Output release notes to stdout based on the last entry in the changelog. Default: unset (false).
-
input
(str | None
, default:None
) –Read from given file when creating release notes. Default:
CHANGELOG.md
. -
convention
(Literal['basic', 'angular', 'conventional'] | None
, default:None
) –The commit convention to match against. Default:
basic
. -
sections
(list[str] | None
, default:None
) –A comma-separated list of sections to render. See the available sections for each supported convention in the description. Default: unset (None).
-
template
(str | None
, default:None
) –The Jinja2 template to use. Prefix it with
path:
to specify the path to a Jinja templated file. Default:keepachangelog
. -
git_trailers
(bool
, default:False
) –Parse Git trailers in the commit message. See https://git-scm.com/docs/git-interpret-trailers. Default: unset (false).
-
omit_empty_versions
(bool
, default:False
) –Omit empty versions from the output. Default: unset (false).
-
no_zerover
(bool
, default:False
) –By default, breaking changes on a 0.x don't bump the major version, maintaining it at 0. With this option, a breaking change will bump a 0.x version to 1.0.
-
filter_commits
(str | None
, default:None
) –The Git revision-range filter to use (e.g.
v1.2.0..
). Default: no filter. -
jinja_context
(list[str] | None
, default:None
) –Pass additional key/value pairs to the template. Option can be used multiple times. The key/value pairs are accessible as 'jinja_context' in the template.
-
version
(bool
, default:False
) –Show the current version of the program and exit.
-
debug_info
(bool
, default:False
) –Print debug information.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_git_changelog.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'git-changelog'
The name of the executable on PATH.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_git_changelog.py
182 183 184 185 186 187 188 189 190 |
|
griffe ¤
Bases: Tool
Call Griffe.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
-
__call__
–Run the command.
-
add_args
–Append CLI arguments.
-
check
–Check for API breakages or possible improvements.
-
dump
–Load package-signatures and dump them as JSON.
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'griffe'
The name of the executable on PATH.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_griffe.py
222 223 224 225 226 227 228 229 230 |
|
add_args ¤
add_args(*args: str) -> Self
Append CLI arguments.
Source code in src/duty/_internal/tools/_base.py
69 70 71 72 |
|
check classmethod
¤
check(
package: str,
*,
against: str | None = None,
base_ref: str | None = None,
color: bool = False,
verbose: bool = False,
format: Literal[
"oneline", "verbose", "markdown", "github"
]
| None = None,
search: list[str] | None = None,
sys_path: bool = False,
find_stubs_packages: bool = False,
extensions: str | list[str] | None = None,
inspection: bool | None = None,
log_level: Literal[
"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
]
| None = None,
version: bool = False,
debug_info: bool = False,
) -> griffe
Check for API breakages or possible improvements.
Parameters:
-
package
(str
) –Package to find, load and check, as path.
-
against
(str | None
, default:None
) –Older Git reference (commit, branch, tag) to check against. Default: load latest tag.
-
base_ref
(str | None
, default:None
) –Git reference (commit, branch, tag) to check. Default: load current code.
-
color
(bool
, default:False
) –Force enable/disable colors in the output.
-
verbose
(bool
, default:False
) –Verbose output.
-
format
(Literal['oneline', 'verbose', 'markdown', 'github'] | None
, default:None
) –Output format.
-
search
(list[str] | None
, default:None
) –Paths to search packages into.
-
sys_path
(bool
, default:False
) –Whether to append
sys.path
to search paths specified with-s
. -
find_stubs_packages
(bool
, default:False
) –Whether to look for stubs-only packages and merge them with concrete ones.
-
extensions
(str | list[str] | None
, default:None
) –A comma-separated list or a JSON list of extensions to load.
-
inspection
(bool | None
, default:None
) –Whether to disallow or force inspection (dynamic analysis). By default, Griffe tries to use static analysis and falls back to dynamic analysis when it can't.
-
log_level
(Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | None
, default:None
) –Set the log level:
DEBUG
,INFO
,WARNING
,ERROR
,CRITICAL
. -
version
(bool
, default:False
) –Show program's version number and exit.
-
debug_info
(bool
, default:False
) –Print debug information.
Source code in src/duty/_internal/tools/_griffe.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
dump classmethod
¤
dump(
*packages: str,
full: bool = False,
output: str | None = None,
docstyle: str | None = None,
docopts: str | None = None,
resolve_aliases: bool = False,
resolve_implicit: bool = False,
resolve_external: bool | None = None,
stats: bool = False,
search: list[str] | None = None,
sys_path: bool = False,
find_stubs_packages: bool = False,
extensions: str | list[str] | None = None,
inspection: bool | None = None,
log_level: Literal[
"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
]
| None = None,
version: bool = False,
debug_info: bool = False,
) -> griffe
Load package-signatures and dump them as JSON.
Parameters:
-
packages
(str
, default:()
) –Packages to find, load and dump.
-
full
(bool
, default:False
) –Whether to dump full data in JSON.
-
output
(str | None
, default:None
) –Output file. Supports templating to output each package in its own file, with
{package}
. -
docstyle
(str | None
, default:None
) –The docstring style to parse.
-
docopts
(str | None
, default:None
) –The options for the docstring parser.
-
resolve_aliases
(bool
, default:False
) –Whether to resolve aliases.
-
resolve_implicit
(bool
, default:False
) –Whether to resolve implicitely exported aliases as well. Aliases are explicitely exported when defined in
__all__
. -
resolve_external
(bool | None
, default:None
) –Whether to resolve aliases pointing to external/unknown modules (not loaded directly). Default is to resolve only from one module to its private sibling (
ast
->_ast
). -
stats
(bool
, default:False
) –Show statistics at the end.
-
search
(list[str] | None
, default:None
) –Paths to search packages into.
-
sys_path
(bool
, default:False
) –Whether to append
sys.path
to search paths specified with-s
. -
find_stubs_packages
(bool
, default:False
) –Whether to look for stubs-only packages and merge them with concrete ones.
-
extensions
(str | list[str] | None
, default:None
) –A comma-separated list or a JSON list of extensions to load.
-
inspection
(bool | None
, default:None
) –Whether to disallow or force inspection (dynamic analysis). By default, Griffe tries to use static analysis and falls back to dynamic analysis when it can't.
-
log_level
(Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | None
, default:None
) –Set the log level:
DEBUG
,INFO
,WARNING
,ERROR
,CRITICAL
. -
version
(bool
, default:False
) –Show program's version number and exit.
-
debug_info
(bool
, default:False
) –Print debug information.
Source code in src/duty/_internal/tools/_griffe.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
interrogate ¤
interrogate(
*src: str,
verbose: int | None = None,
quiet: bool | None = None,
fail_under: float | None = None,
exclude: str | None = None,
ignore_init_method: bool | None = None,
ignore_init_module: bool | None = None,
ignore_magic: bool | None = None,
ignore_module: bool | None = None,
ignore_nested_functions: bool | None = None,
ignore_nested_classes: bool | None = None,
ignore_private: bool | None = None,
ignore_property_decorators: bool | None = None,
ignore_setters: bool | None = None,
ignore_semiprivate: bool | None = None,
ignore_regex: str | None = None,
whitelist_regex: str | None = None,
output: str | None = None,
config: str | None = None,
color: bool | None = None,
omit_covered_files: bool | None = None,
generate_badge: str | None = None,
badge_format: Literal["png", "svg"] | None = None,
badge_style: _BADGE_STYLE | None = None,
)
Bases: Tool
Call Interrogate.
Parameters:
-
src
(str
, default:()
) –Format the directories and file paths.
-
verbose
(int | None
, default:None
) –Level of verbosity.
-
quiet
(bool | None
, default:None
) –Do not print output.
-
fail_under
(float | None
, default:None
) –Fail when coverage % is less than a given amount.
-
exclude
(str | None
, default:None
) –Exclude PATHs of files and/or directories.
-
ignore_init_method
(bool | None
, default:None
) –Ignore
__init__
method of classes. -
ignore_init_module
(bool | None
, default:None
) –Ignore
__init__.py
modules. -
ignore_magic
(bool | None
, default:None
) –Ignore all magic methods of classes.
-
ignore_module
(bool | None
, default:None
) –Ignore module-level docstrings.
-
ignore_nested_functions
(bool | None
, default:None
) –Ignore nested functions and methods.
-
ignore_nested_classes
(bool | None
, default:None
) –Ignore nested classes.
-
ignore_private
(bool | None
, default:None
) –Ignore private classes, methods, and functions starting with two underscores.
-
ignore_property_decorators
(bool | None
, default:None
) –Ignore methods with property setter/getter decorators.
-
ignore_setters
(bool | None
, default:None
) –Ignore methods with property setter decorators.
-
ignore_semiprivate
(bool | None
, default:None
) –Ignore semiprivate classes, methods, and functions starting with a single underscore.
-
ignore_regex
(str | None
, default:None
) –Regex identifying class, method, and function names to ignore.
-
whitelist_regex
(str | None
, default:None
) –Regex identifying class, method, and function names to include.
-
output
(str | None
, default:None
) –Write output to a given FILE.
-
config
(str | None
, default:None
) –Read configuration from pyproject.toml or setup.cfg.
-
color
(bool | None
, default:None
) –Toggle color output on/off when printing to stdout.
-
omit_covered_files
(bool | None
, default:None
) –Omit reporting files that have 100% documentation coverage.
-
generate_badge
(str | None
, default:None
) –Generate a shields.io status badge (an SVG image) in at a given file or directory.
-
badge_format
(Literal['png', 'svg'] | None
, default:None
) –File format for the generated badge.
-
badge_style
(_BADGE_STYLE | None
, default:None
) –Desired style of shields.io badge.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_interrogate.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'interrogate'
The name of the executable on PATH.
__call__ ¤
__call__() -> None
Run the command.
Source code in src/duty/_internal/tools/_interrogate.py
156 157 158 159 160 |
|
isort ¤
isort(
*files: str,
settings: str | None = None,
verbose: bool | None = None,
only_modified: bool | None = None,
dedup_headings: bool | None = None,
quiet: bool | None = None,
stdout: bool | None = None,
overwrite_in_place: bool | None = None,
show_config: bool | None = None,
show_files: bool | None = None,
diff: bool | None = None,
check: bool | None = None,
ignore_whitespace: bool | None = None,
config_root: str | None = None,
resolve_all_configs: bool | None = None,
profile: str | None = None,
jobs: int | None = None,
atomic: bool | None = None,
interactive: bool | None = None,
format_error: str | None = None,
format_success: str | None = None,
sort_reexports: bool | None = None,
filter_files: bool | None = None,
skip: list[str] | None = None,
extend_skip: list[str] | None = None,
skip_glob: list[str] | None = None,
extend_skip_glob: list[str] | None = None,
skip_gitignore: bool | None = None,
supported_extension: list[str] | None = None,
blocked_extension: list[str] | None = None,
dont_follow_links: bool | None = None,
filename: str | None = None,
allow_root: bool | None = None,
add_import: str | None = None,
append_only: bool | None = None,
force_adds: bool | None = None,
remove_import: str | None = None,
float_to_top: bool | None = None,
dont_float_to_top: bool | None = None,
combine_as: bool | None = None,
combine_star: bool | None = None,
balanced: bool | None = None,
from_first: bool | None = None,
force_grid_wrap: int | None = None,
indent: str | None = None,
lines_before_imports: int | None = None,
lines_after_imports: int | None = None,
lines_between_types: int | None = None,
line_ending: str | None = None,
length_sort: bool | None = None,
length_sort_straight: bool | None = None,
multi_line: Multiline | None = None,
ensure_newline_before_comments: bool | None = None,
no_inline_sort: bool | None = None,
order_by_type: bool | None = None,
dont_order_by_type: bool | None = None,
reverse_relative: bool | None = None,
reverse_sort: bool | None = None,
sort_order: Literal["natural", "native"] | None = None,
force_single_line_imports: bool | None = None,
single_line_exclusions: list[str] | None = None,
trailing_comma: bool | None = None,
use_parentheses: bool | None = None,
line_length: int | None = None,
wrap_length: int | None = None,
case_sensitive: bool | None = None,
remove_redundant_aliases: bool | None = None,
honor_noqa: bool | None = None,
treat_comment_as_code: str | None = None,
treat_all_comment_as_code: bool | None = None,
formatter: str | None = None,
color: bool | None = None,
ext_format: str | None = None,
star_first: bool | None = None,
split_on_trailing_comma: bool | None = None,
section_default: Literal[
"FUTURE",
"STDLIB",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER",
]
| None = None,
only_sections: bool | None = None,
no_sections: bool | None = None,
force_alphabetical_sort: bool | None = None,
force_sort_within_sections: bool | None = None,
honor_case_in_force_sorted_sections: bool | None = None,
sort_relative_in_force_sorted_sections: bool
| None = None,
force_alphabetical_sort_within_sections: bool
| None = None,
top: str | None = None,
combine_straight_imports: bool | None = None,
no_lines_before: list[str] | None = None,
src_path: list[str] | None = None,
builtin: str | None = None,
extra_builtin: str | None = None,
future: str | None = None,
thirdparty: str | None = None,
project: str | None = None,
known_local_folder: str | None = None,
virtual_env: str | None = None,
conda_env: str | None = None,
python_version: Literal[
"all",
"2",
"27",
"3",
"36",
"37",
"38",
"39",
"310",
"311",
"auto",
]
| None = None,
)
Bases: Tool
Call isort.
Sort Python import definitions alphabetically within logical sections. Run with no arguments to see a quick start guide, otherwise, one or more files/directories/stdin must be provided. Use -
as the first argument to represent stdin. Use --interactive to use the pre 5.0.0 interactive behavior. If you've used isort 4 but are new to isort 5, see the upgrading guide: https://pycqa.github.io/isort/docs/upgrade_guides/5.0.0.html.
Parameters:
-
*files
(str
, default:()
) –One or more Python source files that need their imports sorted.
-
settings
(str | None
, default:None
) –Explicitly set the settings path or file instead of auto determining based on file location.
-
verbose
(bool | None
, default:None
) –Shows verbose output, such as when files are skipped or when a check is successful.
-
only_modified
(bool | None
, default:None
) –Suppresses verbose output for non-modified files.
-
dedup_headings
(bool | None
, default:None
) –Tells isort to only show an identical custom import heading comment once, even if there are multiple sections with the comment set.
-
quiet
(bool | None
, default:None
) –Shows extra quiet output, only errors are outputted.
-
stdout
(bool | None
, default:None
) –Force resulting output to stdout, instead of in-place.
-
overwrite_in_place
(bool | None
, default:None
) –Tells isort to overwrite in place using the same file handle. Comes at a performance and memory usage penalty over its standard approach but ensures all file flags and modes stay unchanged.
-
show_config
(bool | None
, default:None
) –See isort's determined config, as well as sources of config options.
-
show_files
(bool | None
, default:None
) –See the files isort will be run against with the current config options.
-
diff
(bool | None
, default:None
) –Prints a diff of all the changes isort would make to a file, instead of changing it in place
-
check
(bool | None
, default:None
) –Checks the file for unsorted / unformatted imports and prints them to the command line without modifying the file. Returns 0 when nothing would change and returns 1 when the file would be reformatted.
-
ignore_whitespace
(bool | None
, default:None
) –Tells isort to ignore whitespace differences when --check-only is being used.
-
config_root
(str | None
, default:None
) –Explicitly set the config root for resolving all configs. When used with the --resolve-all-configs flag, isort will look at all sub-folders in this config root to resolve config files and sort files based on the closest available config(if any)
-
resolve_all_configs
(bool | None
, default:None
) –Tells isort to resolve the configs for all sub-directories and sort files in terms of its closest config files.
-
profile
(str | None
, default:None
) –Base profile type to use for configuration. Profiles include: black, django, pycharm, google, open_stack, plone, attrs, hug, wemake, appnexus. As well as any shared profiles.
-
jobs
(int | None
, default:None
) –Number of files to process in parallel. Negative value means use number of CPUs.
-
atomic
(bool | None
, default:None
) –Ensures the output doesn't save if the resulting file contains syntax errors.
-
interactive
(bool | None
, default:None
) –Tells isort to apply changes interactively.
-
format_error
(str | None
, default:None
) –Override the format used to print errors.
-
format_success
(str | None
, default:None
) –Override the format used to print success.
-
sort_reexports
(bool | None
, default:None
) –Automatically sort all re-exports (module level all collections)
-
filter_files
(bool | None
, default:None
) –Tells isort to filter files even when they are explicitly passed in as part of the CLI command.
-
skip
(list[str] | None
, default:None
) –Files that isort should skip over. If you want to skip multiple files you should specify twice: --skip file1 --skip file2. Values can be file names, directory names or file paths. To skip all files in a nested path use --skip-glob.
-
extend_skip
(list[str] | None
, default:None
) –Extends --skip to add additional files that isort should skip over. If you want to skip multiple files you should specify twice: --skip file1 --skip file2. Values can be file names, directory names or file paths. To skip all files in a nested path use --skip-glob.
-
skip_glob
(list[str] | None
, default:None
) –Files that isort should skip over.
-
extend_skip_glob
(list[str] | None
, default:None
) –Additional files that isort should skip over (extending --skip-glob).
-
skip_gitignore
(bool | None
, default:None
) –Treat project as a git repository and ignore files listed in .gitignore. NOTE: This requires git to be installed and accessible from the same shell as isort.
-
supported_extension
(list[str] | None
, default:None
) –Specifies what extensions isort can be run against.
-
blocked_extension
(list[str] | None
, default:None
) –Specifies what extensions isort can never be run against.
-
dont_follow_links
(bool | None
, default:None
) –Tells isort not to follow symlinks that are encountered when running recursively.
-
filename
(str | None
, default:None
) –Provide the filename associated with a stream.
-
allow_root
(bool | None
, default:None
) –Tells isort not to treat / specially, allowing it to be run against the root dir.
-
add_import
(str | None
, default:None
) –Adds the specified import line to all files, automatically determining correct placement.
-
append_only
(bool | None
, default:None
) –Only adds the imports specified in --add-import if the file contains existing imports.
-
force_adds
(bool | None
, default:None
) –Forces import adds even if the original file is empty.
-
remove_import
(str | None
, default:None
) –Removes the specified import from all files.
-
float_to_top
(bool | None
, default:None
) –Causes all non-indented imports to float to the top of the file having its imports sorted (immediately below the top of file comment). This can be an excellent shortcut for collecting imports every once in a while when you place them in the middle of a file to avoid context switching. NOTE: It currently doesn't work with cimports and introduces some extra over-head and a performance penalty.
-
dont_float_to_top
(bool | None
, default:None
) –Forces --float-to-top setting off. See --float-to-top for more information.
-
combine_as
(bool | None
, default:None
) –Combines as imports on the same line.
-
combine_star
(bool | None
, default:None
) –Ensures that if a star import is present, nothing else is imported from that namespace.
-
balanced
(bool | None
, default:None
) –Balances wrapping to produce the most consistent line length possible
-
from_first
(bool | None
, default:None
) –Switches the typical ordering preference, showing from imports first then straight ones.
-
force_grid_wrap
(int | None
, default:None
) –Force number of from imports (defaults to 2 when passed as CLI flag without value) to be grid wrapped regardless of line length. If 0 is passed in (the global default) only line length is considered.
-
indent
(str | None
, default:None
) –String to place for indents defaults to " " (4 spaces).
-
lines_before_imports
(int | None
, default:None
) –Number of lines to insert before imports.
-
lines_after_imports
(int | None
, default:None
) –Number of lines to insert after imports.
-
lines_between_types
(int | None
, default:None
) –Number of lines to insert between imports.
-
line_ending
(str | None
, default:None
) –Forces line endings to the specified value. If not set, values will be guessed per-file.
-
length_sort
(bool | None
, default:None
) –Sort imports by their string length.
-
length_sort_straight
(bool | None
, default:None
) –Sort straight imports by their string length. Similar to
length_sort
but applies only to straight imports and doesn't affect from imports. -
multi_line
(Multiline | None
, default:None
) –Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 5-vert-grid-grouped, 6-deprecated-alias-for-5, 7-noqa, 8-vertical-hanging-indent-bracket, 9-vertical-prefix-from- module-import, 10-hanging-indent-with-parentheses).
-
ensure_newline_before_comments
(bool | None
, default:None
) –Inserts a blank line before a comment following an import.
-
no_inline_sort
(bool | None
, default:None
) –Leaves
from
imports with multiple imports 'as-is' (e.g.from foo import a, c ,b
). -
order_by_type
(bool | None
, default:None
) –Order imports by type, which is determined by case, in addition to alphabetically. NOTE: type here refers to the implied type from the import name capitalization. isort does not do type introspection for the imports. These "types" are simply: CONSTANT_VARIABLE, CamelCaseClass, variable_or_function. If your project follows PEP8 or a related coding standard and has many imports this is a good default, otherwise you likely will want to turn it off. From the CLI the
--dont-order-by-type
option will turn this off. -
dont_order_by_type
(bool | None
, default:None
) –Don't order imports by type, which is determined by case, in addition to alphabetically. NOTE: type here refers to the implied type from the import name capitalization. isort does not do type introspection for the imports. These "types" are simply: CONSTANT_VARIABLE, CamelCaseClass, variable_or_function. If your project follows PEP8 or a related coding standard and has many imports this is a good default. You can turn this on from the CLI using
--order-by-type
. -
reverse_relative
(bool | None
, default:None
) –Reverse order of relative imports.
-
reverse_sort
(bool | None
, default:None
) –Reverses the ordering of imports.
-
sort_order
(Literal['natural', 'native'] | None
, default:None
) –Specify sorting function. Can be built in (natural[default] = force numbers to be sequential, native = Python's built-in sorted function) or an installable plugin.
-
force_single_line_imports
(bool | None
, default:None
) –Forces all from imports to appear on their own line
-
single_line_exclusions
(list[str] | None
, default:None
) –One or more modules to exclude from the single line rule.
-
trailing_comma
(bool | None
, default:None
) –Includes a trailing comma on multi line imports that include parentheses.
-
use_parentheses
(bool | None
, default:None
) –Use parentheses for line continuation on length limit instead of slashes. NOTE: This is separate from wrap modes, and only affects how individual lines that are too long get continued, not sections of multiple imports.
-
line_length
(int | None
, default:None
) –The max length of an import line (used for wrapping long imports).
-
wrap_length
(int | None
, default:None
) –Specifies how long lines that are wrapped should be, if not set line_length is used. NOTE: wrap_length must be LOWER than or equal to line_length.
-
case_sensitive
(bool | None
, default:None
) –Tells isort to include casing when sorting module names
-
remove_redundant_aliases
(bool | None
, default:None
) –Tells isort to remove redundant aliases from imports, such as
import os as os
. This defaults toFalse
simply because some projects use these seemingly useless aliases to signify intent and change behaviour. -
honor_noqa
(bool | None
, default:None
) –Tells isort to honor noqa comments to enforce skipping those comments.
-
treat_comment_as_code
(str | None
, default:None
) –Tells isort to treat the specified single line comment(s) as if they are code.
-
treat_all_comment_as_code
(bool | None
, default:None
) –Tells isort to treat all single line comments as if they are code.
-
formatter
(str | None
, default:None
) –Specifies the name of a formatting plugin to use when producing output.
-
color
(bool | None
, default:None
) –Tells isort to use color in terminal output.
-
ext_format
(str | None
, default:None
) –Tells isort to format the given files according to an extensions formatting rules.
-
star_first
(bool | None
, default:None
) –Forces star imports above others to avoid overriding directly imported variables.
-
split_on_trailing_comma
(bool | None
, default:None
) –Split imports list followed by a trailing comma into VERTICAL_HANGING_INDENT mode
-
section_default
(Literal['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER'] | None
, default:None
) –Sets the default section for import options: ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER')
-
only_sections
(bool | None
, default:None
) –Causes imports to be sorted based on their sections like STDLIB, THIRDPARTY, etc. Within sections, the imports are ordered by their import style and the imports with the same style maintain their relative positions.
-
no_sections
(bool | None
, default:None
) –Put all imports into the same section bucket
-
force_alphabetical_sort
(bool | None
, default:None
) –Force all imports to be sorted as a single section
-
force_sort_within_sections
(bool | None
, default:None
) –Don't sort straight-style imports (like import sys) before from-style imports (like from itertools import groupby). Instead, sort the imports by module, independent of import style.
-
honor_case_in_force_sorted_sections
(bool | None
, default:None
) –Honor
--case-sensitive
when--force-sort-within-sections
is being used. Without this option set,--order-by-type
decides module name ordering too. -
sort_relative_in_force_sorted_sections
(bool | None
, default:None
) –When using
--force-sort-within-sections
, sort relative imports the same way as they are sorted when not using that setting. -
force_alphabetical_sort_within_sections
(bool | None
, default:None
) –Force all imports to be sorted alphabetically within a section
-
top
(str | None
, default:None
) –Force specific imports to the top of their appropriate section.
-
combine_straight_imports
(bool | None
, default:None
) –Combines all the bare straight imports of the same section in a single line. Won't work with sections which have 'as' imports
-
no_lines_before
(list[str] | None
, default:None
) –Sections which should not be split with previous by empty lines
-
src_path
(list[str] | None
, default:None
) –Add an explicitly defined source path (modules within src paths have their imports automatically categorized as first_party). Glob expansion (
*
and**
) is supported for this option. -
builtin
(str | None
, default:None
) –Force isort to recognize a module as part of Python's standard library.
-
extra_builtin
(str | None
, default:None
) –Extra modules to be included in the list of ones in Python's standard library.
-
future
(str | None
, default:None
) –Force isort to recognize a module as part of Python's internal future compatibility libraries. WARNING: this overrides the behavior of future handling and therefore can result in code that can't execute. If you're looking to add dependencies such as six, a better option is to create another section below --future using custom sections. See: https://github.com/PyCQA/isort#custom- sections-and-ordering and the discussion here: https://github.com/PyCQA/isort/issues/1463.
-
thirdparty
(str | None
, default:None
) –Force isort to recognize a module as being part of a third party library.
-
project
(str | None
, default:None
) –Force isort to recognize a module as being part of the current python project.
-
known_local_folder
(str | None
, default:None
) –Force isort to recognize a module as being a local folder. Generally, this is reserved for relative imports (from . import module).
-
virtual_env
(str | None
, default:None
) –Virtual environment to use for determining whether a package is third-party
-
conda_env
(str | None
, default:None
) –Conda environment to use for determining whether a package is third-party
-
python_version
(Literal['all', '2', '27', '3', '36', '37', '38', '39', '310', '311', 'auto'] | None
, default:None
) –Tells isort to set the known standard library based on the specified Python version. Default is to assume any Python 3 version could be the target, and use a union of all stdlib modules across versions. If auto is specified, the version of the interpreter used to run isort (currently: 311) will be used.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_isort.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'isort'
The name of the executable on PATH.
__call__ ¤
__call__() -> None
Run the command.
Source code in src/duty/_internal/tools/_isort.py
577 578 579 580 581 |
|
mkdocs ¤
Bases: Tool
Call MkDocs.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
-
__call__
–Run the command.
-
add_args
–Append CLI arguments.
-
build
–Build the MkDocs documentation.
-
gh_deploy
–Deploy your documentation to GitHub Pages.
-
new
–Create a new MkDocs project.
-
serve
–Run the builtin development server.
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'mkdocs'
The name of the executable on PATH.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_mkdocs.py
267 268 269 270 271 272 273 274 275 |
|
add_args ¤
add_args(*args: str) -> Self
Append CLI arguments.
Source code in src/duty/_internal/tools/_base.py
69 70 71 72 |
|
build classmethod
¤
build(
*,
config_file: str | None = None,
clean: bool | None = None,
strict: bool | None = None,
theme: str | None = None,
directory_urls: bool | None = None,
site_dir: str | None = None,
quiet: bool = False,
verbose: bool = False,
) -> mkdocs
Build the MkDocs documentation.
Parameters:
-
config_file
(str | None
, default:None
) –Provide a specific MkDocs config.
-
clean
(bool | None
, default:None
) –Remove old files from the site_dir before building (the default).
-
strict
(bool | None
, default:None
) –Enable strict mode. This will cause MkDocs to abort the build on any warnings.
-
theme
(str | None
, default:None
) –The theme to use when building your documentation.
-
directory_urls
(bool | None
, default:None
) –Use directory URLs when building pages (the default).
-
site_dir
(str | None
, default:None
) –The directory to output the result of the documentation build.
-
quiet
(bool
, default:False
) –Silence warnings.
-
verbose
(bool
, default:False
) –Enable verbose output.
Source code in src/duty/_internal/tools/_mkdocs.py
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
gh_deploy classmethod
¤
gh_deploy(
*,
config_file: str | None = None,
clean: bool | None = None,
message: str | None = None,
remote_branch: str | None = None,
remote_name: str | None = None,
force: bool | None = None,
no_history: bool | None = None,
ignore_version: bool | None = None,
shell: bool | None = None,
strict: bool | None = None,
theme: str | None = None,
directory_urls: bool | None = None,
site_dir: str | None = None,
quiet: bool = False,
verbose: bool = False,
) -> mkdocs
Deploy your documentation to GitHub Pages.
Parameters:
-
config_file
(str | None
, default:None
) –Provide a specific MkDocs config.
-
clean
(bool | None
, default:None
) –Remove old files from the site_dir before building (the default).
-
message
(str | None
, default:None
) –A commit message to use when committing to the GitHub Pages remote branch. Commit {sha} and MkDocs {version} are available as expansions.
-
remote_branch
(str | None
, default:None
) –The remote branch to commit to for GitHub Pages. This overrides the value specified in config.
-
remote_name
(str | None
, default:None
) –The remote name to commit to for GitHub Pages. This overrides the value specified in config
-
force
(bool | None
, default:None
) –Force the push to the repository.
-
no_history
(bool | None
, default:None
) –Replace the whole Git history with one new commit.
-
ignore_version
(bool | None
, default:None
) –Ignore check that build is not being deployed with an older version of MkDocs.
-
shell
(bool | None
, default:None
) –Use the shell when invoking Git.
-
strict
(bool | None
, default:None
) –Enable strict mode. This will cause MkDocs to abort the build on any warnings.
-
theme
(str | None
, default:None
) –The theme to use when building your documentation.
-
directory_urls
(bool | None
, default:None
) –Use directory URLs when building pages (the default).
-
site_dir
(str | None
, default:None
) –The directory to output the result of the documentation build.
-
quiet
(bool
, default:False
) –Silence warnings.
-
verbose
(bool
, default:False
) –Enable verbose output.
Source code in src/duty/_internal/tools/_mkdocs.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
new classmethod
¤
Create a new MkDocs project.
Parameters:
-
project_directory
(str
) –Where to create the project.
-
quiet
(bool
, default:False
) –Silence warnings.
-
verbose
(bool
, default:False
) –Enable verbose output.
Source code in src/duty/_internal/tools/_mkdocs.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|
serve classmethod
¤
serve(
*,
config_file: str | None = None,
dev_addr: str | None = None,
livereload: bool | None = None,
dirtyreload: bool | None = None,
watch_theme: bool | None = None,
watch: list[str] | None = None,
strict: bool | None = None,
theme: str | None = None,
directory_urls: bool | None = None,
quiet: bool = False,
verbose: bool = False,
) -> mkdocs
Run the builtin development server.
Parameters:
-
config_file
(str | None
, default:None
) –Provide a specific MkDocs config.
-
dev_addr
(str | None
, default:None
) –IP address and port to serve documentation locally (default: localhost:8000).
-
livereload
(bool | None
, default:None
) –Enable/disable the live reloading in the development server.
-
dirtyreload
(bool | None
, default:None
) –nable the live reloading in the development server, but only re-build files that have changed.
-
watch_theme
(bool | None
, default:None
) –Include the theme in list of files to watch for live reloading. Ignored when live reload is not used.
-
watch
(list[str] | None
, default:None
) –Directories or files to watch for live reloading.
-
strict
(bool | None
, default:None
) –Enable strict mode. This will cause MkDocs to abort the build on any warnings.
-
theme
(str | None
, default:None
) –The theme to use when building your documentation.
-
directory_urls
(bool | None
, default:None
) –Use directory URLs when building pages (the default).
-
quiet
(bool
, default:False
) –Silence warnings.
-
verbose
(bool
, default:False
) –Enable verbose output.
Source code in src/duty/_internal/tools/_mkdocs.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
mypy ¤
mypy(
*paths: str,
config_file: str | None = None,
enable_incomplete_feature: bool | None = None,
verbose: bool | None = None,
warn_unused_configs: bool | None = None,
no_namespace_packages: bool | None = None,
ignore_missing_imports: bool | None = None,
follow_imports: Literal[
"normal", "silent", "skip", "error"
]
| None = None,
python_executable: str | None = None,
no_site_packages: bool | None = None,
no_silence_site_packages: bool | None = None,
python_version: str | None = None,
py2: bool | None = None,
platform: str | None = None,
always_true: list[str] | None = None,
always_false: list[str] | None = None,
disallow_any_unimported: bool | None = None,
disallow_any_expr: bool | None = None,
disallow_any_decorated: bool | None = None,
disallow_any_explicit: bool | None = None,
disallow_any_generics: bool | None = None,
disallow_subclassing_any: bool | None = None,
disallow_untyped_calls: bool | None = None,
disallow_untyped_defs: bool | None = None,
disallow_incomplete_defs: bool | None = None,
check_untyped_defs: bool | None = None,
disallow_untyped_decorators: bool | None = None,
implicit_optional: bool | None = None,
no_strict_optional: bool | None = None,
warn_redundant_casts: bool | None = None,
warn_unused_ignores: bool | None = None,
no_warn_no_return: bool | None = None,
warn_return_any: bool | None = None,
warn_unreachable: bool | None = None,
allow_untyped_globals: bool | None = None,
allow_redefinition: bool | None = None,
no_implicit_reexport: bool | None = None,
strict_equality: bool | None = None,
strict_concatenate: bool | None = None,
strict: bool | None = None,
disable_error_code: str | None = None,
enable_error_code: str | None = None,
show_error_context: bool | None = None,
show_column_numbers: bool | None = None,
show_error_end: bool | None = None,
hide_error_codes: bool | None = None,
pretty: bool | None = None,
no_color_output: bool | None = None,
no_error_summary: bool | None = None,
show_absolute_path: bool | None = None,
no_incremental: bool | None = None,
cache_dir: str | None = None,
sqlite_cache: bool | None = None,
cache_fine_grained: bool | None = None,
skip_version_check: bool | None = None,
skip_cache_mtime_checks: bool | None = None,
pdb: bool | None = None,
show_traceback: bool | None = None,
raise_exceptions: bool | None = None,
custom_typing_module: str | None = None,
disable_recursive_aliases: bool | None = None,
custom_typeshed_dir: str | None = None,
warn_incomplete_stub: bool | None = None,
shadow_file: tuple[str, str] | None = None,
any_exprs_report: str | None = None,
cobertura_xml_report: str | None = None,
html_report: str | None = None,
linecount_report: str | None = None,
linecoverage_report: str | None = None,
lineprecision_report: str | None = None,
txt_report: str | None = None,
xml_report: str | None = None,
xslt_html_report: str | None = None,
xslt_txt_report: str | None = None,
junit_xml: str | None = None,
find_occurrences: str | None = None,
scripts_are_modules: bool | None = None,
install_types: bool | None = None,
non_interactive: bool | None = None,
explicit_package_bases: bool | None = None,
exclude: str | None = None,
module: str | None = None,
package: str | None = None,
command: str | None = None,
)
Bases: Tool
Call Mypy.
Parameters:
-
*paths
(str
, default:()
) –Path to scan.
-
config_file
(str | None
, default:None
) –Configuration file, must have a [mypy] section (defaults to mypy.ini, .mypy.ini,
-
enable_incomplete_feature
(bool | None
, default:None
) –Enable support of incomplete/experimental features for early preview.
-
verbose
(bool | None
, default:None
) –More verbose messages. pyproject.toml, setup.cfg, /home/pawamoy/.config/mypy/config, ~/.config/mypy/config, ~/.mypy.ini).
-
warn_unused_configs
(bool | None
, default:None
) –Warn about unused '[mypy-
]' or '[[tool.mypy.overrides]]' config sections (inverse: --no-warn-unused-configs). -
no_namespace_packages
(bool | None
, default:None
) –Support namespace packages (PEP 420, init.py-less) (inverse: --namespace-packages).
-
ignore_missing_imports
(bool | None
, default:None
) –Silently ignore imports of missing modules.
-
follow_imports
(Literal['normal', 'silent', 'skip', 'error'] | None
, default:None
) –How to treat imports (default normal).
-
python_executable
(str | None
, default:None
) –Python executable used for finding PEP 561 compliant installed packages and stubs.
-
no_site_packages
(bool | None
, default:None
) –Do not search for installed PEP 561 compliant packages.
-
no_silence_site_packages
(bool | None
, default:None
) –Do not silence errors in PEP 561 compliant installed packages.
-
python_version
(str | None
, default:None
) –Type check code assuming it will be running on Python x.y.
-
py2
(bool | None
, default:None
) –Use Python 2 mode (same as --python-version 2.7).
-
platform
(str | None
, default:None
) –Type check special-cased code for the given OS platform (defaults to sys.platform).
-
always_true
(list[str] | None
, default:None
) –Additional variable to be considered True (may be repeated).
-
always_false
(list[str] | None
, default:None
) –Additional variable to be considered False (may be repeated).
-
disallow_any_unimported
(bool | None
, default:None
) –Disallow Any types resulting from unfollowed imports.
-
disallow_any_expr
(bool | None
, default:None
) –Disallow all expressions that have type Any.
-
disallow_any_decorated
(bool | None
, default:None
) –Disallow functions that have Any in their signature after decorator transformation.
-
disallow_any_explicit
(bool | None
, default:None
) –Disallow explicit Any in type positions.
-
disallow_any_generics
(bool | None
, default:None
) –Disallow usage of generic types that do not specify explicit type parameters (inverse: --allow-any-generics).
-
disallow_subclassing_any
(bool | None
, default:None
) –Disallow subclassing values of type 'Any' when defining classes (inverse: --allow-subclassing-any).
-
disallow_untyped_calls
(bool | None
, default:None
) –Disallow calling functions without type annotations from functions with type annotations (inverse: --allow-untyped-calls).
-
disallow_untyped_defs
(bool | None
, default:None
) –Disallow defining functions without type annotations or with incomplete type annotations (inverse: --allow-untyped-defs).
-
disallow_incomplete_defs
(bool | None
, default:None
) –Disallow defining functions with incomplete type annotations (inverse: --allow-incomplete-defs).
-
check_untyped_defs
(bool | None
, default:None
) –Type check the interior of functions without type annotations (inverse: --no-check-untyped-defs).
-
disallow_untyped_decorators
(bool | None
, default:None
) –Disallow decorating typed functions with untyped decorators (inverse: --allow-untyped-decorators).
-
implicit_optional
(bool | None
, default:None
) –Assume arguments with default values of None are Optional(inverse: --no-implicit-optional).
-
no_strict_optional
(bool | None
, default:None
) –Disable strict Optional checks (inverse: --strict-optional).
-
warn_redundant_casts
(bool | None
, default:None
) –Warn about casting an expression to its inferred type (inverse: --no-warn-redundant-casts).
-
warn_unused_ignores
(bool | None
, default:None
) –Warn about unneeded '# type: ignore' comments (inverse: --no-warn-unused-ignores).
-
no_warn_no_return
(bool | None
, default:None
) –Do not warn about functions that end without returning (inverse: --warn-no-return).
-
warn_return_any
(bool | None
, default:None
) –Warn about returning values of type Any from non-Any typed functions (inverse: --no-warn-return-any).
-
warn_unreachable
(bool | None
, default:None
) –Warn about statements or expressions inferred to be unreachable (inverse: --no-warn-unreachable).
-
allow_untyped_globals
(bool | None
, default:None
) –Suppress toplevel errors caused by missing annotations (inverse: --disallow-untyped-globals).
-
allow_redefinition
(bool | None
, default:None
) –Allow unconditional variable redefinition with a new type (inverse: --disallow-redefinition).
-
no_implicit_reexport
(bool | None
, default:None
) –Treat imports as private unless aliased (inverse: --implicit-reexport).
-
strict_equality
(bool | None
, default:None
) –Prohibit equality, identity, and container checks for non-overlapping types (inverse: --no-strict-equality).
-
strict_concatenate
(bool | None
, default:None
) –Make arguments prepended via Concatenate be truly positional-only (inverse: --no-strict-concatenate).
-
strict
(bool | None
, default:None
) –Strict mode; enables the following flags: --warn-unused-configs, --disallow-any-generics, --disallow-subclassing-any, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs, --disallow-untyped-decorators, --warn-redundant-casts, --warn-unused-ignores, --warn-return-any, --no-implicit-reexport, --strict-equality, --strict-concatenate.
-
disable_error_code
(str | None
, default:None
) –Disable a specific error code.
-
enable_error_code
(str | None
, default:None
) –Enable a specific error code.
-
show_error_context
(bool | None
, default:None
) –Precede errors with "note:" messages explaining context (inverse: --hide-error-context).
-
show_column_numbers
(bool | None
, default:None
) –Show column numbers in error messages (inverse: --hide-column-numbers).
-
show_error_end
(bool | None
, default:None
) –Show end line/end column numbers in error messages. This implies --show-column-numbers (inverse: --hide-error-end).
-
hide_error_codes
(bool | None
, default:None
) –Hide error codes in error messages (inverse: --show-error-codes).
-
pretty
(bool | None
, default:None
) –Use visually nicer output in error messages: Use soft word wrap, show source code snippets, and show error location markers (inverse: --no-pretty).
-
no_color_output
(bool | None
, default:None
) –Do not colorize error messages (inverse: --color-output).
-
no_error_summary
(bool | None
, default:None
) –Do not show error stats summary (inverse: --error-summary).
-
show_absolute_path
(bool | None
, default:None
) –Show absolute paths to files (inverse: --hide-absolute-path).
-
no_incremental
(bool | None
, default:None
) –Disable module cache (inverse: --incremental).
-
cache_dir
(str | None
, default:None
) –Store module cache info in the given folder in incremental mode (defaults to '.mypy_cache').
-
sqlite_cache
(bool | None
, default:None
) –Use a sqlite database to store the cache (inverse: --no-sqlite-cache).
-
cache_fine_grained
(bool | None
, default:None
) –Include fine-grained dependency information in the cache for the mypy daemon.
-
skip_version_check
(bool | None
, default:None
) –Allow using cache written by older mypy version.
-
skip_cache_mtime_checks
(bool | None
, default:None
) –Skip cache internal consistency checks based on mtime.
-
pdb
(bool | None
, default:None
) –Invoke pdb on fatal error.
-
show_traceback
(bool | None
, default:None
) –Show traceback on fatal error.
-
raise_exceptions
(bool | None
, default:None
) –Raise exception on fatal error.
-
custom_typing_module
(str | None
, default:None
) –Use a custom typing module.
-
disable_recursive_aliases
(bool | None
, default:None
) –Disable experimental support for recursive type aliases.
-
custom_typeshed_dir
(str | None
, default:None
) –Use the custom typeshed in DIR.
-
warn_incomplete_stub
(bool | None
, default:None
) –Warn if missing type annotation in typeshed, only relevant with --disallow-untyped-defs or --disallow-incomplete-defs enabled (inverse: --no-warn-incomplete-stub).
-
shadow_file
(tuple[str, str] | None
, default:None
) –When encountering SOURCE_FILE, read and type check the contents of SHADOW_FILE instead..
-
any_exprs_report
(str | None
, default:None
) –Report any expression.
-
cobertura_xml_report
(str | None
, default:None
) –Report Cobertura.
-
html_report
(str | None
, default:None
) –Report HTML.
-
linecount_report
(str | None
, default:None
) –Report line count.
-
linecoverage_report
(str | None
, default:None
) –Report line coverage.
-
lineprecision_report
(str | None
, default:None
) –Report line precision.
-
txt_report
(str | None
, default:None
) –Report text.
-
xml_report
(str | None
, default:None
) –Report XML.
-
xslt_html_report
(str | None
, default:None
) –Report XLST HTML.
-
xslt_txt_report
(str | None
, default:None
) –Report XLST text.
-
junit_xml
(str | None
, default:None
) –Write junit.xml to the given file.
-
find_occurrences
(str | None
, default:None
) –Print out all usages of a class member (experimental).
-
scripts_are_modules
(bool | None
, default:None
) –Script x becomes module x instead of main.
-
install_types
(bool | None
, default:None
) –Install detected missing library stub packages using pip (inverse: --no-install-types).
-
non_interactive
(bool | None
, default:None
) –Install stubs without asking for confirmation and hide errors, with --install-types (inverse: --interactive).
-
explicit_package_bases
(bool | None
, default:None
) –Use current directory and MYPYPATH to determine module names of files passed (inverse: --no-explicit-package-bases).
-
exclude
(str | None
, default:None
) –Regular expression to match file names, directory names or paths which mypy should ignore while recursively discovering files to check, e.g. --exclude '/setup.py$'. May be specified more than once, eg. --exclude a --exclude b.
-
module
(str | None
, default:None
) –Type-check module; can repeat for more modules.
-
package
(str | None
, default:None
) –Type-check package recursively; can be repeated.
-
command
(str | None
, default:None
) –Type-check program passed in as string.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_mypy.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
__call__ ¤
__call__() -> None
Run the command.
Source code in src/duty/_internal/tools/_mypy.py
493 494 495 496 497 498 499 500 501 502 |
|
pytest ¤
pytest(
*paths: str,
config_file: str | None = None,
select: str | None = None,
select_markers: str | None = None,
markers: bool | None = None,
exitfirst: bool | None = None,
fixtures: bool | None = None,
fixtures_per_test: bool | None = None,
pdb: bool | None = None,
pdbcls: str | None = None,
trace: bool | None = None,
capture: str | None = None,
runxfail: bool | None = None,
last_failed: bool | None = None,
failed_first: bool | None = None,
new_first: bool | None = None,
cache_show: str | None = None,
cache_clear: bool | None = None,
last_failed_no_failures: Literal["all", "none"]
| None = None,
stepwise: bool | None = None,
stepwise_skip: bool | None = None,
durations: int | None = None,
durations_min: int | None = None,
verbose: bool | None = None,
no_header: bool | None = None,
no_summary: bool | None = None,
quiet: bool | None = None,
verbosity: int | None = None,
show_extra_summary: str | None = None,
disable_pytest_warnings: bool | None = None,
showlocals: bool | None = None,
no_showlocals: bool | None = None,
traceback: Literal[
"auto", "long", "short", "line", "native", "no"
]
| None = None,
show_capture: Literal[
"no", "stdout", "stderr", "log", "all"
]
| None = None,
full_trace: bool | None = None,
color: str | None = None,
code_highlight: bool | None = None,
pastebin: str | None = None,
junit_xml: str | None = None,
junit_prefix: str | None = None,
pythonwarnings: str | None = None,
maxfail: int | None = None,
strict_config: bool | None = None,
strict_markers: bool | None = None,
continue_on_collection_errors: bool | None = None,
rootdir: str | None = None,
collect_only: bool | None = None,
pyargs: bool | None = None,
ignore: list[str] | None = None,
ignore_glob: list[str] | None = None,
deselect: str | None = None,
confcutdir: str | None = None,
noconftest: bool | None = None,
keep_duplicates: bool | None = None,
collect_in_virtualenv: bool | None = None,
import_mode: Literal["prepend", "append", "importlib"]
| None = None,
doctest_modules: bool | None = None,
doctest_report: Literal[
"none",
"cdiff",
"ndiff",
"udiff",
"only_first_failure",
]
| None = None,
doctest_glob: str | None = None,
doctest_ignore_import_errors: bool | None = None,
doctest_continue_on_failure: bool | None = None,
basetemp: str | None = None,
plugins: list[str] | None = None,
no_plugins: list[str] | None = None,
trace_config: bool | None = None,
debug: str | None = None,
override_ini: str | None = None,
assert_mode: str | None = None,
setup_only: bool | None = None,
setup_show: bool | None = None,
setup_plan: bool | None = None,
log_level: str | None = None,
log_format: str | None = None,
log_date_format: str | None = None,
log_cli_level: tuple[str, str] | None = None,
log_cli_format: str | None = None,
log_cli_date_format: str | None = None,
log_file: str | None = None,
log_file_level: str | None = None,
log_file_format: str | None = None,
log_file_date_format: str | None = None,
log_auto_indent: str | None = None,
)
Bases: Tool
Call pytest.
Parameters:
-
*paths
(str
, default:()
) –Files or directories to select tests from.
-
select
(str | None
, default:None
) –Only run tests which match the given substring expression. An expression is a Python evaluatable expression where all names are substring-matched against test names and their parent classes. Example: -k 'test_method or test_other' matches all test functions and classes whose name contains 'test_method' or 'test_other', while -k 'not test_method' matches those that don't contain 'test_method' in their names. -k 'not test_method and not test_other' will eliminate the matches. Additionally keywords are matched to classes and functions containing extra names in their 'extra_keyword_matches' set, as well as functions which have names assigned directly to them. The matching is case-insensitive.
-
select_markers
(str | None
, default:None
) –Only run tests matching given mark expression. For example: -m 'mark1 and not mark2'.
-
markers
(bool | None
, default:None
) –show markers (builtin, plugin and per-project ones).
-
exitfirst
(bool | None
, default:None
) –Exit instantly on first error or failed test
-
fixtures
(bool | None
, default:None
) –Show available fixtures, sorted by plugin appearance (fixtures with leading '_' are only shown with '-v')
-
fixtures_per_test
(bool | None
, default:None
) –Show fixtures per test
-
pdb
(bool | None
, default:None
) –Start the interactive Python debugger on errors or KeyboardInterrupt
-
pdbcls
(str | None
, default:None
) –Specify a custom interactive Python debugger for use with --pdb.For example: --pdbcls IPython.terminal.debugger:TerminalPdb
-
trace
(bool | None
, default:None
) –Immediately break when running each test
-
capture
(str | None
, default:None
) –Per-test capturing method: one of fd|sys|no|tee-sys
-
runxfail
(bool | None
, default:None
) –Report the results of xfail tests as if they were not marked
-
last_failed
(bool | None
, default:None
) –Rerun only the tests that failed at the last run (or all if none failed)
-
failed_first
(bool | None
, default:None
) –Run all tests, but run the last failures first. This may re-order tests and thus lead to repeated fixture setup/teardown.
-
new_first
(bool | None
, default:None
) –Run tests from new files first, then the rest of the tests sorted by file mtime
-
cache_show
(str | None
, default:None
) –Show cache contents, don't perform collection or tests. Optional argument: glob (default: '*').
-
cache_clear
(bool | None
, default:None
) –Remove all cache contents at start of test run
-
last_failed_no_failures
(Literal['all', 'none'] | None
, default:None
) –Which tests to run with no previously (known) failures
-
stepwise
(bool | None
, default:None
) –Exit on test failure and continue from last failing test next time
-
stepwise_skip
(bool | None
, default:None
) –Ignore the first failing test but stop on the next failing test. Implicitly enables --stepwise.
-
durations
(int | None
, default:None
) –Show N slowest setup/test durations (N 0 for all)
-
durations_min
(int | None
, default:None
) –Minimal duration in seconds for inclusion in slowest list. Default: 0.005.
-
verbose
(bool | None
, default:None
) –Increase verbosity
-
no_header
(bool | None
, default:None
) –Disable header
-
no_summary
(bool | None
, default:None
) –Disable summary
-
quiet
(bool | None
, default:None
) –Decrease verbosity
-
verbosity
(int | None
, default:None
) –Set verbosity. Default: 0.
-
show_extra_summary
(str | None
, default:None
) –Show extra test summary info as specified by chars: (f)ailed, (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output, (a)ll except passed (p/P), or (A)ll. (w)arnings are enabled by default (see --disable-warnings), 'N' can be used to reset the list. (default: 'fE').
-
disable_pytest_warnings
(bool | None
, default:None
) –Disable warnings summary
-
showlocals
(bool | None
, default:None
) –Show locals in tracebacks (disabled by default)
-
no_showlocals
(bool | None
, default:None
) –Hide locals in tracebacks (negate --showlocals passed through addopts)
-
traceback
(Literal['auto', 'long', 'short', 'line', 'native', 'no'] | None
, default:None
) –Traceback print mode (auto/long/short/line/native/no)
-
show_capture
(Literal['no', 'stdout', 'stderr', 'log', 'all'] | None
, default:None
) –Controls how captured stdout/stderr/log is shown on failed tests. Default: all.
-
full_trace
(bool | None
, default:None
) –Don't cut any tracebacks (default is to cut)
-
color
(str | None
, default:None
) –Color terminal output (yes/no/auto)
-
code_highlight
(bool | None
, default:None
) –{yes,no} Whether code should be highlighted (only if --color is also enabled). Default: yes.
-
pastebin
(str | None
, default:None
) –Send failed|all info to bpaste.net pastebin service
-
junit_xml
(str | None
, default:None
) –Create junit-xml style report file at given path
-
junit_prefix
(str | None
, default:None
) –Prepend prefix to classnames in junit-xml output
-
pythonwarnings
(str | None
, default:None
) –Set which warnings to report, see -W option of Python itself
-
maxfail
(int | None
, default:None
) –Exit after first num failures or errors
-
strict_config
(bool | None
, default:None
) –Any warnings encountered while parsing the
pytest
section of the configuration file raise errors -
strict_markers
(bool | None
, default:None
) –Markers not registered in the
markers
section of the configuration file raise errors -
config_file
(str | None
, default:None
) –Load configuration from
file
instead of trying to locate one of the implicit configuration files -
continue_on_collection_errors
(bool | None
, default:None
) –Force test execution even if collection errors occur
-
rootdir
(str | None
, default:None
) –Define root directory for tests. Can be relative path: 'root_dir', './root_dir', 'root_dir/another_dir/'; absolute path: '/home/user/root_dir'; path with variables: '$HOME/root_dir'.
-
collect_only
(bool | None
, default:None
) –Only collect tests, don't execute them
-
pyargs
(bool | None
, default:None
) –Try to interpret all arguments as Python packages
-
ignore
(list[str] | None
, default:None
) –Ignore path during collection (multi-allowed)
-
ignore_glob
(list[str] | None
, default:None
) –Ignore path pattern during collection (multi-allowed)
-
deselect
(str | None
, default:None
) –Deselect item (via node id prefix) during collection (multi-allowed)
-
confcutdir
(str | None
, default:None
) –Only load conftest.py's relative to specified dir
-
noconftest
(bool | None
, default:None
) –Don't load any conftest.py files
-
keep_duplicates
(bool | None
, default:None
) –Keep duplicate tests
-
collect_in_virtualenv
(bool | None
, default:None
) –Don't ignore tests in a local virtualenv directory
-
import_mode
(Literal['prepend', 'append', 'importlib'] | None
, default:None
) –Prepend/append to sys.path when importing test modules and conftest files. Default: prepend.
-
doctest_modules
(bool | None
, default:None
) –Run doctests in all .py modules
-
doctest_report
(Literal['none', 'cdiff', 'ndiff', 'udiff', 'only_first_failure'] | None
, default:None
) –Choose another output format for diffs on doctest failure
-
doctest_glob
(str | None
, default:None
) –Doctests file matching pattern, default: test*.txt
-
doctest_ignore_import_errors
(bool | None
, default:None
) –Ignore doctest ImportErrors
-
doctest_continue_on_failure
(bool | None
, default:None
) –For a given doctest, continue to run after the first failure
-
basetemp
(str | None
, default:None
) –Base temporary directory for this test run. (Warning: this directory is removed if it exists.)
-
plugins
(list[str] | None
, default:None
) –Early-load given plugin module name or entry point (multi-allowed). To avoid loading of plugins, use the
no:
prefix, e.g.no:doctest
. -
no_plugins
(list[str] | None
, default:None
) –Early-load given plugin module name or entry point (multi-allowed). To avoid loading of plugins, use the
no:
prefix, e.g.no:doctest
. -
trace_config
(bool | None
, default:None
) –Trace considerations of conftest.py files
-
debug
(str | None
, default:None
) –Store internal tracing debug information in this log file. This file is opened with 'w' and truncated as a result, care advised. Default: pytestdebug.log.
-
override_ini
(str | None
, default:None
) –Override ini option with "option value" style, e.g.
-o xfail_strict True -o cache_dir cache
. -
assert_mode
(str | None
, default:None
) –Control assertion debugging tools. 'plain' performs no assertion debugging. 'rewrite' (the default) rewrites assert statements in test modules on import to provide assert expression information.
-
setup_only
(bool | None
, default:None
) –Only setup fixtures, do not execute tests
-
setup_show
(bool | None
, default:None
) –Show setup of fixtures while executing tests
-
setup_plan
(bool | None
, default:None
) –Show what fixtures and tests would be executed but don't execute anything
-
log_level
(str | None
, default:None
) –Level of messages to catch/display. Not set by default, so it depends on the root/parent log handler's effective level, where it is "WARNING" by default.
-
log_format
(str | None
, default:None
) –Log format used by the logging module.
-
log_date_format
(str | None
, default:None
) –Log date format used by the logging module.
-
log_cli_level
(tuple[str, str] | None
, default:None
) –logging level.
-
log_cli_format
(str | None
, default:None
) –Log format used by the logging module.
-
log_cli_date_format
(str | None
, default:None
) –Log date format used by the logging module.
-
log_file
(str | None
, default:None
) –Path to a file when logging will be written to.
-
log_file_level
(str | None
, default:None
) –Log file logging level.
-
log_file_format
(str | None
, default:None
) –Log format used by the logging module.
-
log_file_date_format
(str | None
, default:None
) –Log date format used by the logging module.
-
log_auto_indent
(str | None
, default:None
) –Auto-indent multiline messages passed to the logging module. Accepts true|on, false|off or an integer.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_pytest.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'pytest'
The name of the executable on PATH.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_pytest.py
479 480 481 482 483 484 485 486 487 |
|
ruff ¤
Bases: Tool
Call Ruff.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
-
__call__
–Run the command.
-
add_args
–Append CLI arguments.
-
check
–Run Ruff on the given files or directories.
-
clean
–Clear any caches in the current directory and any subdirectories.
-
config
–List or describe the available configuration options.
-
format
–Run Ruff formatter on the given files or directories.
-
linter
–List all supported upstream linters.
-
rule
–Explain a rule.
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_ruff.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
|
add_args ¤
add_args(*args: str) -> Self
Append CLI arguments.
Source code in src/duty/_internal/tools/_base.py
69 70 71 72 |
|
check classmethod
¤
check(
*files: str,
config: str | None = None,
fix: bool | None = None,
show_source: bool | None = None,
show_fixes: bool | None = None,
diff: bool | None = None,
watch: bool | None = None,
fix_only: bool | None = None,
output_format: str | None = None,
statistics: bool | None = None,
add_noqa: bool | None = None,
show_files: bool | None = None,
show_settings: bool | None = None,
select: list[str] | None = None,
ignore: list[str] | None = None,
extend_select: list[str] | None = None,
per_file_ignores: dict[str, list[str]] | None = None,
fixable: list[str] | None = None,
unfixable: list[str] | None = None,
exclude: list[str] | None = None,
extend_exclude: list[str] | None = None,
respect_gitignore: bool | None = None,
force_exclude: bool | None = None,
no_cache: bool | None = None,
isolated: bool | None = None,
cache_dir: str | None = None,
stdin_filename: str | None = None,
exit_zero: bool | None = None,
exit_non_zero_on_fix: bool | None = None,
verbose: bool = False,
quiet: bool = False,
silent: bool = False,
) -> ruff
Run Ruff on the given files or directories.
Parameters:
-
fix
(bool | None
, default:None
) –Attempt to automatically fix lint violations.
-
config
(str | None
, default:None
) –Path to the
pyproject.toml
orruff.toml
file to use for configuration. -
show_source
(bool | None
, default:None
) –Show violations with source code.
-
show_fixes
(bool | None
, default:None
) –Show an enumeration of all autofixed lint violations.
-
diff
(bool | None
, default:None
) –Avoid writing any fixed files back; instead, output a diff for each changed file to stdout.
-
watch
(bool | None
, default:None
) –Run in watch mode by re-running whenever files change.
-
fix_only
(bool | None
, default:None
) –Fix any fixable lint violations, but don't report on leftover violations. Implies
--fix
. -
output_format
(str | None
, default:None
) –Output serialization format for violations (env: RUFF_FORMAT=) (possible values: text, json, junit, grouped, github, gitlab, pylint).
-
statistics
(bool | None
, default:None
) –Show counts for every rule with at least one violation.
-
add_noqa
(bool | None
, default:None
) –Enable automatic additions of
noqa
directives to failing lines. -
show_files
(bool | None
, default:None
) –See the files Ruff will be run against with the current settings.
-
show_settings
(bool | None
, default:None
) –See the settings Ruff will use to lint a given Python file.
-
select
(list[str] | None
, default:None
) –Comma-separated list of rule codes to enable (or ALL, to enable all rules).
-
ignore
(list[str] | None
, default:None
) –Comma-separated list of rule codes to disable.
-
extend_select
(list[str] | None
, default:None
) –Like --select, but adds additional rule codes on top of the selected ones.
-
per_file_ignores
(dict[str, list[str]] | None
, default:None
) –List of mappings from file pattern to code to exclude.
-
fixable
(list[str] | None
, default:None
) –List of rule codes to treat as eligible for autofix. Only applicable when autofix itself is enabled (e.g., via
--fix
). -
unfixable
(list[str] | None
, default:None
) –List of rule codes to treat as ineligible for autofix. Only applicable when autofix itself is enabled (e.g., via
--fix
). -
exclude
(list[str] | None
, default:None
) –List of paths, used to omit files and/or directories from analysis.
-
extend_exclude
(list[str] | None
, default:None
) –Like --exclude, but adds additional files and directories on top of those already excluded.
-
respect_gitignore
(bool | None
, default:None
) –Respect file exclusions via
.gitignore
and other standard ignore files. -
force_exclude
(bool | None
, default:None
) –Enforce exclusions, even for paths passed to Ruff directly on the command-line.
-
no_cache
(bool | None
, default:None
) –Disable cache reads.
-
isolated
(bool | None
, default:None
) –Ignore all configuration files.
-
cache_dir
(str | None
, default:None
) –Path to the cache directory (env: RUFF_CACHE_DIR=).
-
stdin_filename
(str | None
, default:None
) –The name of the file when passing it through stdin.
-
exit_zero
(bool | None
, default:None
) –Exit with status code "0", even upon detecting lint violations.
-
exit_non_zero_on_fix
(bool | None
, default:None
) –Exit with a non-zero status code if any files were modified via autofix, even if no lint violations remain.
-
verbose
(bool
, default:False
) –Enable verbose logging.
-
quiet
(bool
, default:False
) –Print lint violations, but nothing else.
-
silent
(bool
, default:False
) –Disable all logging (but still exit with status code "1" upon detecting lint violations).
Source code in src/duty/_internal/tools/_ruff.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
clean classmethod
¤
Clear any caches in the current directory and any subdirectories.
Parameters:
-
verbose
(bool
, default:False
) –Enable verbose logging.
-
quiet
(bool
, default:False
) –Print lint violations, but nothing else.
-
silent
(bool
, default:False
) –Disable all logging (but still exit with status code "1" upon detecting lint violations).
Source code in src/duty/_internal/tools/_ruff.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
config classmethod
¤
List or describe the available configuration options.
Parameters:
-
verbose
(bool
, default:False
) –Enable verbose logging.
-
quiet
(bool
, default:False
) –Print lint violations, but nothing else.
-
silent
(bool
, default:False
) –Disable all logging (but still exit with status code "1" upon detecting lint violations).
Source code in src/duty/_internal/tools/_ruff.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
|
format classmethod
¤
format(
*files: str,
config: str | None = None,
check: bool | None = None,
diff: bool | None = None,
target_version: str | None = None,
preview: bool | None = None,
exclude: list[str] | None = None,
extend_exclude: list[str] | None = None,
respect_gitignore: bool | None = None,
force_exclude: bool | None = None,
no_cache: bool | None = None,
isolated: bool | None = None,
cache_dir: str | None = None,
stdin_filename: str | None = None,
verbose: bool = False,
quiet: bool = False,
silent: bool = False,
) -> ruff
Run Ruff formatter on the given files or directories.
Parameters:
-
check
(bool | None
, default:None
) –Avoid writing any formatted files back; instead, exit with a non-zero status code if any files would have been modified, and zero otherwise
-
config
(str | None
, default:None
) –Path to the
pyproject.toml
orruff.toml
file to use for configuration -
diff
(bool | None
, default:None
) –Avoid writing any fixed files back; instead, output a diff for each changed file to stdout
-
target_version
(str | None
, default:None
) –The minimum Python version that should be supported [possible values: py37, py38, py39, py310, py311, py312]
-
preview
(bool | None
, default:None
) –Enable preview mode; enables unstable formatting
-
exclude
(list[str] | None
, default:None
) –List of paths, used to omit files and/or directories from analysis
-
extend_exclude
(list[str] | None
, default:None
) –Like --exclude, but adds additional files and directories on top of those already excluded
-
respect_gitignore
(bool | None
, default:None
) –Respect file exclusions via
.gitignore
and other standard ignore files -
force_exclude
(bool | None
, default:None
) –Enforce exclusions, even for paths passed to Ruff directly on the command-line
-
no_cache
(bool | None
, default:None
) –Disable cache reads
-
isolated
(bool | None
, default:None
) –Ignore all configuration files
-
cache_dir
(str | None
, default:None
) –Path to the cache directory [env: RUFF_CACHE_DIR=]
-
stdin_filename
(str | None
, default:None
) –The name of the file when passing it through stdin
-
verbose
(bool
, default:False
) –Enable verbose logging.
-
quiet
(bool
, default:False
) –Print lint violations, but nothing else.
-
silent
(bool
, default:False
) –Disable all logging (but still exit with status code "1" upon detecting lint violations).
Source code in src/duty/_internal/tools/_ruff.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
linter classmethod
¤
linter(
*,
output_format: str | None = None,
verbose: bool = False,
quiet: bool = False,
silent: bool = False,
) -> ruff
List all supported upstream linters.
Parameters:
-
output_format
(str | None
, default:None
) –Output format (default: pretty) (possible values: text, json, pretty).
-
verbose
(bool
, default:False
) –Enable verbose logging.
-
quiet
(bool
, default:False
) –Print lint violations, but nothing else.
-
silent
(bool
, default:False
) –Disable all logging (but still exit with status code "1" upon detecting lint violations).
Source code in src/duty/_internal/tools/_ruff.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
|
rule classmethod
¤
rule(
rule: str,
*,
output_format: str | None = None,
verbose: bool = False,
quiet: bool = False,
silent: bool = False,
) -> ruff
Explain a rule.
Parameters:
-
rule
(str
) –A rule code, or
--all
. -
output_format
(str | None
, default:None
) –Output format (default: pretty, possible values: text, json, pretty).
-
verbose
(bool
, default:False
) –Enable verbose logging.
-
quiet
(bool
, default:False
) –Print lint violations, but nothing else.
-
silent
(bool
, default:False
) –Disable all logging (but still exit with status code "1" upon detecting lint violations).
Source code in src/duty/_internal/tools/_ruff.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
safety ¤
Bases: Tool
Call Safety.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'safety'
The name of the executable on PATH.
__call__ ¤
__call__() -> bool
Run the command.
Returns:
-
bool
–False when vulnerabilities are found.
Source code in src/duty/_internal/tools/_safety.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
add_args ¤
add_args(*args: str) -> Self
Append CLI arguments.
Source code in src/duty/_internal/tools/_base.py
69 70 71 72 |
|
check classmethod
¤
check(
requirements: str | Sequence[str],
*,
ignore_vulns: dict[str, str] | None = None,
formatter: Literal["json", "bare", "text"] = "text",
full_report: bool = True,
) -> safety
Run the safety check command.
This function makes sure we load the original, unpatched version of safety.
Parameters:
-
requirements
(str | Sequence[str]
) –Python "requirements" (list of pinned dependencies).
-
ignore_vulns
(dict[str, str] | None
, default:None
) –Vulnerabilities to ignore.
-
formatter
(Literal['json', 'bare', 'text']
, default:'text'
) –Report format.
-
full_report
(bool
, default:True
) –Whether to output a full report.
Returns:
-
safety
–Success/failure.
Source code in src/duty/_internal/tools/_safety.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
ssort ¤
Bases: Tool
Call ssort.
Parameters:
-
*files
(str
, default:()
) –Files to format.
-
diff
(bool | None
, default:None
) –Prints a diff of all changes ssort would make to a file.
-
check
(bool | None
, default:None
) –Check the file for unsorted statements. Returns 0 if nothing needs to be changed. Otherwise returns 1.
Methods:
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_ssort.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'ssort'
The name of the executable on PATH.
__call__ ¤
__call__() -> None
Run the command.
Returns:
-
None
–The exit code of the command.
Source code in src/duty/_internal/tools/_ssort.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
twine ¤
Bases: Tool
Call Twine.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
-
__call__
–Run the command.
-
add_args
–Append CLI arguments.
-
check
–Checks whether your distribution's long description will render correctly on PyPI.
-
register
–Pre-register a name with a repository before uploading a distribution.
-
upload
–Uploads one or more distributions to a repository.
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
cli_name class-attribute
instance-attribute
¤
cli_name = 'twine'
The name of the executable on PATH.
__call__ ¤
__call__() -> Any
Run the command.
Returns:
-
Any
–The return value of the corresponding Twine command / entrypoint.
Source code in src/duty/_internal/tools/_twine.py
287 288 289 290 291 292 293 294 295 |
|
add_args ¤
add_args(*args: str) -> Self
Append CLI arguments.
Source code in src/duty/_internal/tools/_base.py
69 70 71 72 |
|
check classmethod
¤
Checks whether your distribution's long description will render correctly on PyPI.
Parameters:
-
dists
(str
, default:()
) –The distribution files to check, usually
dist/*
. -
strict
(bool
, default:False
) –Fail on warnings.
-
version
(bool
, default:False
) –Show program's version number and exit.
-
no_color
(bool
, default:False
) –Disable colored output.
Source code in src/duty/_internal/tools/_twine.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
register classmethod
¤
register(
package: str,
*,
repository: str = "pypi",
repository_url: str | None = None,
attestations: bool = False,
sign: bool = False,
sign_with: str | None = None,
identity: str | None = None,
username: str | None = None,
password: str | None = None,
non_interactive: bool = False,
comment: str | None = None,
config_file: str | None = None,
skip_existing: bool = False,
cert: str | None = None,
client_cert: str | None = None,
verbose: bool = False,
disable_progress_bar: bool = False,
version: bool = False,
no_color: bool = False,
) -> twine
Pre-register a name with a repository before uploading a distribution.
Pre-registration is not supported on PyPI, so the register command is only necessary if you are using a different repository that requires it.
Parameters:
-
package
(str
) –File from which we read the package metadata.
-
repository
(str
, default:'pypi'
) –The repository (package index) to upload the package to. Should be a section in the config file (default:
pypi
). Can also be set viaTWINE_REPOSITORY
environment variable. -
repository_url
(str | None
, default:None
) –The repository (package index) URL to upload the package to. This overrides
--repository
. Can also be set viaTWINE_REPOSITORY_URL
environment variable. -
attestations
(bool
, default:False
) –Upload each file's associated attestations.
-
sign
(bool
, default:False
) –Sign files to upload using GPG.
-
sign_with
(str | None
, default:None
) –GPG program used to sign uploads (default:
gpg
). -
identity
(str | None
, default:None
) –GPG identity used to sign files.
-
username
(str | None
, default:None
) –The username to authenticate to the repository (package index) as. Can also be set via
TWINE_USERNAME
environment variable. -
password
(str | None
, default:None
) –The password to authenticate to the repository (package index) with. Can also be set via
TWINE_PASSWORD
environment variable. -
non_interactive
(bool
, default:False
) –Do not interactively prompt for username/password if the required credentials are missing. Can also be set via
TWINE_NON_INTERACTIVE
environment variable. -
comment
(str | None
, default:None
) –The comment to include with the distribution file.
-
config_file
(str | None
, default:None
) –The
.pypirc
config file to use. -
skip_existing
(bool
, default:False
) –Continue uploading files if one already exists. Only valid when uploading to PyPI. Other implementations may not support this.
-
cert
(str | None
, default:None
) –Path to alternate CA bundle (can also be set via
TWINE_CERT
environment variable). -
client_cert
(str | None
, default:None
) –Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
-
verbose
(bool
, default:False
) –Show verbose output.
-
disable_progress_bar
(bool
, default:False
) –Disable the progress bar.
-
version
(bool
, default:False
) –Show program's version number and exit.
-
no_color
(bool
, default:False
) –Disable colored output.
Source code in src/duty/_internal/tools/_twine.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
upload classmethod
¤
upload(
*dists: str,
repository: str = "pypi",
repository_url: str | None = None,
attestations: bool = False,
sign: bool = False,
sign_with: str | None = None,
identity: str | None = None,
username: str | None = None,
password: str | None = None,
non_interactive: bool = False,
comment: str | None = None,
config_file: str | None = None,
skip_existing: bool = False,
cert: str | None = None,
client_cert: str | None = None,
verbose: bool = False,
disable_progress_bar: bool = False,
version: bool = False,
no_color: bool = False,
) -> twine
Uploads one or more distributions to a repository.
Parameters:
-
dists
(str
, default:()
) –The distribution files to check, usually
dist/*
. -
repository
(str
, default:'pypi'
) –The repository (package index) to upload the package to. Should be a section in the config file (default:
pypi
). Can also be set viaTWINE_REPOSITORY
environment variable. -
repository_url
(str | None
, default:None
) –The repository (package index) URL to upload the package to. This overrides
--repository
. Can also be set viaTWINE_REPOSITORY_URL
environment variable. -
attestations
(bool
, default:False
) –Upload each file's associated attestations.
-
sign
(bool
, default:False
) –Sign files to upload using GPG.
-
sign_with
(str | None
, default:None
) –GPG program used to sign uploads (default:
gpg
). -
identity
(str | None
, default:None
) –GPG identity used to sign files.
-
username
(str | None
, default:None
) –The username to authenticate to the repository (package index) as. Can also be set via
TWINE_USERNAME
environment variable. -
password
(str | None
, default:None
) –The password to authenticate to the repository (package index) with. Can also be set via
TWINE_PASSWORD
environment variable. -
non_interactive
(bool
, default:False
) –Do not interactively prompt for username/password if the required credentials are missing. Can also be set via
TWINE_NON_INTERACTIVE
environment variable. -
comment
(str | None
, default:None
) –The comment to include with the distribution file.
-
config_file
(str | None
, default:None
) –The
.pypirc
config file to use. -
skip_existing
(bool
, default:False
) –Continue uploading files if one already exists. Only valid when uploading to PyPI. Other implementations may not support this.
-
cert
(str | None
, default:None
) –Path to alternate CA bundle (can also be set via
TWINE_CERT
environment variable). -
client_cert
(str | None
, default:None
) –Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
-
verbose
(bool
, default:False
) –Show verbose output.
-
disable_progress_bar
(bool
, default:False
) –Disable the progress bar.
-
version
(bool
, default:False
) –Show program's version number and exit.
-
no_color
(bool
, default:False
) –Disable colored output.
Source code in src/duty/_internal/tools/_twine.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
yore ¤
Bases: Tool
Call Yore.
Parameters:
-
cli_args
(list[str] | None
, default:None
) –Initial command-line arguments. Use
add_args()
to add more. -
py_args
(dict[str, Any] | None
, default:None
) –Python arguments. Your
__call__
method will be able to access these arguments asself.py_args
.
Methods:
-
__call__
–Run the command.
-
add_args
–Append CLI arguments.
-
check
–Check Yore comments against Python EOL dates or the provided next version of your project.
-
fix
–Fix your code by transforming it according to the Yore comments.
Attributes:
-
cli_args
(list[str]
) –Registered command-line arguments.
-
cli_command
(str
) –The equivalent CLI command.
-
cli_name
–The name of the executable on PATH.
-
py_args
(dict[str, Any]
) –Registered Python arguments.
Source code in src/duty/_internal/tools/_base.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
cli_args instance-attribute
¤
Registered command-line arguments.
__call__ ¤
__call__() -> int
Run the command.
Returns:
-
int
–The exit code of the command.
Source code in src/duty/_internal/tools/_yore.py
88 89 90 91 92 93 94 95 96 |
|
add_args ¤
add_args(*args: str) -> Self
Append CLI arguments.
Source code in src/duty/_internal/tools/_base.py
69 70 71 72 |
|
check classmethod
¤
check(
*paths: str,
bump: str | None = None,
eol_within: str | None = None,
bol_within: str | None = None,
) -> yore
Check Yore comments against Python EOL dates or the provided next version of your project.
Parameters:
-
paths
(str
, default:()
) –Path to files or directories to check.
-
bump
(str | None
, default:None
) –The next version of your project.
-
eol_within
(str | None
, default:None
) –The time delta to start checking before the End of Life of a Python version. It is provided in a human-readable format, like
2 weeks
or1 month
. Spaces are optional, and the unit can be shortened to a single letter:d
for days,w
for weeks,m
for months, andy
for years. -
bol_within
(str | None
, default:None
) –The time delta to start checking before the Beginning of Life of a Python version. It is provided in a human-readable format, like
2 weeks
or1 month
. Spaces are optional, and the unit can be shortened to a single letter:d
for days,w
for weeks,m
for months, andy
for years.
Source code in src/duty/_internal/tools/_yore.py
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 38 39 40 41 42 43 44 45 46 47 48 |
|
fix classmethod
¤
fix(
*paths: str,
bump: str | None = None,
eol_within: str | None = None,
bol_within: str | None = None,
) -> yore
Fix your code by transforming it according to the Yore comments.
Parameters:
-
paths
(str
, default:()
) –Path to files or directories to fix.
-
bump
(str | None
, default:None
) –The next version of your project.
-
eol_within
(str | None
, default:None
) –The time delta to start fixing before the End of Life of a Python version. It is provided in a human-readable format, like
2 weeks
or1 month
. Spaces are optional, and the unit can be shortened to a single letter:d
for days,w
for weeks,m
for months, andy
for years. -
bol_within
(str | None
, default:None
) –The time delta to start fixing before the Beginning of Life of a Python version. It is provided in a human-readable format, like
2 weeks
or1 month
. Spaces are optional, and the unit can be shortened to a single letter:d
for days,w
for weeks,m
for months, andy
for years.
Source code in src/duty/_internal/tools/_yore.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
validation ¤
Deprecated. Import from duty
directly.