diff --git a/docs/env_vars.rst b/docs/env_vars.rst index e3140bae6..716900a22 100644 --- a/docs/env_vars.rst +++ b/docs/env_vars.rst @@ -7,7 +7,7 @@ Internal Environment variables The following environment variables are used by Poe the Poet internally, and can be accessed from within configuration and tasks. - ``POE_ROOT``: path to the parent directory of the main tasks file (e.g. pyproject.toml). -- ``POE_PWD``: the current working directory of the poe process (unless overriden programmatically). +- ``POE_PWD``: the current working directory of the poe process (unless overridden programmatically). - ``POE_CONF_DIR``: the path to the parent directory of the config file that defines the running task or the :ref:`cwd option` set when including that config. - ``POE_ACTIVE``: identifies the active PoeExecutor, so that Poe the Poet can tell when it is running recursively. diff --git a/docs/guides/args_guide.rst b/docs/guides/args_guide.rst index c89f0dbbf..ae3caf50f 100644 --- a/docs/guides/args_guide.rst +++ b/docs/guides/args_guide.rst @@ -128,7 +128,7 @@ Named arguments support the following configuration options: default = "${AWS_REGION}" env.AWS_REGION.default = "eu-central-1" - As in the above example, this can be combined with setting an :doc:`env value<../tasks/options>` on the task with the ``default`` specifier to get the following precendence of values for the arg: + As in the above example, this can be combined with setting an :doc:`env value<../tasks/options>` on the task with the ``default`` specifier to get the following precedence of values for the arg: 1. the value passed on the command line 2. the value of the variable set on the environment @@ -151,11 +151,11 @@ Named arguments support the following configuration options: If set to a number, then the argument will accept *exactly* that number of values. - For positional aguments, only the last positional argument may have the ``multiple`` option set. + For positional arguments, only the last positional argument may have the ``multiple`` option set. This option is not compatible with arguments with type ``boolean`` since these are interpreted as flags. However multiple ones or zeros can be passed to an argument of type "integer" for similar effect. - The values provided to an argument with the ``multiple`` option set are available on the environment as a string of whitespace separated values. For script tasks, the values will be provided to your python function as a list of values. In a cmd task the values can be passed as separate arugments to the task via templating as in the following example. + The values provided to an argument with the ``multiple`` option set are available on the environment as a string of whitespace separated values. For script tasks, the values will be provided to your python function as a list of values. In a cmd task the values can be passed as separate arguments to the task via templating as in the following example. .. code-block:: toml diff --git a/docs/guides/running_guide.rst b/docs/guides/running_guide.rst index 5f87ddfe0..13f18ad07 100644 --- a/docs/guides/running_guide.rst +++ b/docs/guides/running_guide.rst @@ -26,7 +26,7 @@ This task can the be run via the poe cli as ``poe test``. Run a task with the poe CLI --------------------------- -The prefered way to run poe is via the standalone CLI. +The preferred way to run poe is via the standalone CLI. .. code-block:: sh diff --git a/docs/poetry_plugin.rst b/docs/poetry_plugin.rst index 6270d8dbb..82ca48f72 100644 --- a/docs/poetry_plugin.rst +++ b/docs/poetry_plugin.rst @@ -24,7 +24,7 @@ And the poe documentation can be viewed via: poetry poe -It is also possible to modify this behavoir, to either have a different command prefix +It is also possible to modify this behavior, to either have a different command prefix or none at all by setting the :toml:`poetry_command` global option in your pyproject.toml like so: @@ -44,7 +44,7 @@ invoked simply as: Whatever :toml:`tool.poe.poetry_command` is set to must not already exist as a poetry command! - Additionally if setting it to the emtpy string then care must be taken to avoid + Additionally if setting it to the empty string then care must be taken to avoid defining any poe tasks that conflict with any other built in or plugin provided poetry command. diff --git a/docs/tasks/index.rst b/docs/tasks/index.rst index b04553d34..c7dc26000 100644 --- a/docs/tasks/index.rst +++ b/docs/tasks/index.rst @@ -10,7 +10,7 @@ A task defined as a string will by default be interpreted as a single command to [tool.poe.tasks] test = "pytest" -A task defined as an array will by default be interepreted as a :doc:`sequence ` of :doc:`references` to other tasks. +A task defined as an array will by default be interpreted as a :doc:`sequence ` of :doc:`references` to other tasks. .. code-block:: toml diff --git a/docs/tasks/options.rst b/docs/tasks/options.rst index a32897fac..0003f4f3d 100644 --- a/docs/tasks/options.rst +++ b/docs/tasks/options.rst @@ -166,5 +166,5 @@ However in certain situations it can be desirable to define a task that is inste Note the following limitations with this feature: 1. a task configured in this way may not be referenced by another task - 2. this does not work on windows becuase of `this issue `_. On windows a subprocess is always created. + 2. this does not work on windows because of `this issue `_. On windows a subprocess is always created. diff --git a/docs/tasks/task_types/expr.rst b/docs/tasks/task_types/expr.rst index 886d346e9..df0eb9fd7 100644 --- a/docs/tasks/task_types/expr.rst +++ b/docs/tasks/task_types/expr.rst @@ -22,7 +22,7 @@ `this collection `_ - reference the |sys_module_link| module without having to specify it as an import - directly access whatever arguments were passed to the task from `sys.argv` -- referene values of named args as python variables +- reference values of named args as python variables - include environment variables as string values that are injected into the expression using the usual templating syntax ``${...}`` diff --git a/docs/tasks/task_types/script.rst b/docs/tasks/task_types/script.rst index ff796687a..26b24d44f 100644 --- a/docs/tasks/task_types/script.rst +++ b/docs/tasks/task_types/script.rst @@ -13,7 +13,7 @@ As in the second example, is it possible to hard code literal arguments to the t If extra arguments are passed to task on the command line (and no CLI args are declared), then they will be available within the called python function via :python:`sys.argv`. If :doc:`args <../options>` are configured for the task then they will be available as python variables. -If the target python function is an async function then it will be exectued with :python:`asyncio.run`. +If the target python function is an async function then it will be executed with :python:`asyncio.run`. Available task options diff --git a/docs/tasks/task_types/shell.rst b/docs/tasks/task_types/shell.rst index 7967a9b90..3c99c82a9 100644 --- a/docs/tasks/task_types/shell.rst +++ b/docs/tasks/task_types/shell.rst @@ -66,7 +66,7 @@ It is also possible to specify python code as the shell task code as in the foll The following interpreter values may be used: posix - This is the default behavoir, equivalent to ``["sh", "bash", "zsh"]``, meaning that poe will try to find sh, and fallback to bash, then zsh. + This is the default behavior, equivalent to ``["sh", "bash", "zsh"]``, meaning that poe will try to find sh, and fallback to bash, then zsh. sh Use the basic posix shell. This is often an alias for either bash or dash depending on the operating system. bash diff --git a/poethepoet/env/template.py b/poethepoet/env/template.py index cda3c3e88..f08d3437d 100644 --- a/poethepoet/env/template.py +++ b/poethepoet/env/template.py @@ -29,7 +29,7 @@ class SpyDict(dict): """ - A kind of dict in which the behavior __getitem__ can be overriden. + A kind of dict in which the behavior __getitem__ can be overridden. """ def __init__(self, content=tuple(), *, getitem_spy=None): @@ -59,7 +59,7 @@ def apply_envvars_to_template( Template in ${environmental} $variables from env as if we were in a shell Supports escaping of the $ if preceded by an odd number of backslashes, in which - case the backslash immediately precending the $ is removed. This is an + case the backslash immediately preceding the $ is removed. This is an intentionally very limited implementation of escaping semantics for the sake of usability. """ diff --git a/poethepoet/executor/base.py b/poethepoet/executor/base.py index 86a04b433..694cb2174 100644 --- a/poethepoet/executor/base.py +++ b/poethepoet/executor/base.py @@ -28,7 +28,7 @@ class MetaPoeExecutor(type): """ - This metaclass makes all decendents of PoeExecutor (task types) register themselves + This metaclass makes all descendents of PoeExecutor (task types) register themselves on declaration and validates that they include the expected class attributes. """ diff --git a/poethepoet/helpers/command/__init__.py b/poethepoet/helpers/command/__init__.py index bc8e0093e..9c804e866 100644 --- a/poethepoet/helpers/command/__init__.py +++ b/poethepoet/helpers/command/__init__.py @@ -13,7 +13,7 @@ def parse_poe_cmd(source: str, config: Optional["ParseConfig"] = None): # Poe cmd task content differs from POSIX command lines in that new lines are # ignored (except in comments) and glob patterns are constrained to what the # python standard library glob module can support - config = ParseConfig(substitute_nodes={Glob: PythonGlob}, line_seperators=";") + config = ParseConfig(substitute_nodes={Glob: PythonGlob}, line_separators=";") return Script(ParseCursor.from_string(source), config) diff --git a/poethepoet/helpers/command/ast.py b/poethepoet/helpers/command/ast.py index 9eacc872f..88dad3b2d 100644 --- a/poethepoet/helpers/command/ast.py +++ b/poethepoet/helpers/command/ast.py @@ -1,16 +1,16 @@ # ruff: noqa: N806 r""" -This module implements a heirarchical parser and AST along the lines of the +This module implements a hierarchical parser and AST along the lines of the following grammar which is a subset of bash syntax. script : line* line : word* comment? word : segment* -segment : UNQUOTED_CONTENT | single_quoted_sement | double_quoted_sement +segment : UNQUOTED_CONTENT | single_quoted_segment | double_quoted_segment -unquoted_sement : UNQUOTED_CONTENT | param_expansion | glob -single_quoted_sement : "'" SINGLE_QUOTED_CONTENT "'" -double_quoted_sement : "\"" (DOUBLE_QUOTED_CONTENT | param_expansion) "\"" +unquoted_segment : UNQUOTED_CONTENT | param_expansion | glob +single_quoted_segment : "'" SINGLE_QUOTED_CONTENT "'" +double_quoted_segment : "\"" (DOUBLE_QUOTED_CONTENT | param_expansion) "\"" comment : /#[^\n\r\f\v]*/ glob : "?" | "*" | "[" /(\!?\]([^\s\]\\]|\\.)*|([^\s\]\\]|\\.)+)*/ "]" @@ -393,7 +393,7 @@ def _parse(self, chars: ParseCursor): self._children = [] for char in chars: - if char in self.config.line_seperators: + if char in self.config.line_separators: break elif char.isspace(): @@ -414,8 +414,8 @@ def _parse(self, chars: ParseCursor): class Script(SyntaxNode[Line]): def __init__(self, chars: ParseCursor, config: ParseConfig = ParseConfig()): - if not config.line_seperators: - config.line_seperators = LINE_SEP_CHARS + if not config.line_separators: + config.line_separators = LINE_SEP_CHARS super().__init__(chars, config) @property @@ -434,7 +434,7 @@ def _parse(self, chars: ParseCursor): self._children = [] while next_char := chars.peek(): - if next_char in self.config.line_seperators: + if next_char in self.config.line_separators: chars.take() continue diff --git a/poethepoet/helpers/command/ast_core.py b/poethepoet/helpers/command/ast_core.py index 3516a145c..e9e7d6968 100644 --- a/poethepoet/helpers/command/ast_core.py +++ b/poethepoet/helpers/command/ast_core.py @@ -1,5 +1,5 @@ """ -This module core a framework for defining heirarchical parser and ASTs. +This module core a framework for defining hierarchical parser and ASTs. See sibling ast module for an example usage. """ @@ -89,15 +89,15 @@ def __bool__(self): class ParseConfig: substitute_nodes: Dict[Type["AstNode"], Type["AstNode"]] - line_seperators: str + line_separators: str def __init__( self, substitute_nodes: Optional[Dict[Type["AstNode"], Type["AstNode"]]] = None, - line_seperators="", + line_separators="", ): self.substitute_nodes = substitute_nodes or {} - self.line_seperators = line_seperators + self.line_separators = line_separators def resolve_node_cls(self, klass: Type["AstNode"]) -> Type["AstNode"]: return self.substitute_nodes.get(klass, klass) diff --git a/poethepoet/helpers/python.py b/poethepoet/helpers/python.py index d190c7097..7fd28613e 100644 --- a/poethepoet/helpers/python.py +++ b/poethepoet/helpers/python.py @@ -264,7 +264,7 @@ def _apply_substitutions(content: str, subs: List[Substitution]): return "".join(segments) -# This pattern matches the sequence of chars from the begining of the string that are +# This pattern matches the sequence of chars from the beginning of the string that are # *probably* a valid identifier IDENTIFIER_PATTERN = r"[^\s\!-\/\:-\@\[-\^\{-\~`]+" diff --git a/poethepoet/options.py b/poethepoet/options.py index 489de7e4d..ab7ebfd30 100644 --- a/poethepoet/options.py +++ b/poethepoet/options.py @@ -115,11 +115,11 @@ def _parse_value( # Try format expected_type nicely in the error message if not isinstance(expected_type, tuple): expected_type = (expected_type,) - formated_type = " | ".join( + formatted_type = " | ".join( type_.__name__ for type_ in expected_type if type_ is not type(None) ) raise ConfigValidationError( - f"Option {key!r} should have a value of type: {formated_type}", + f"Option {key!r} should have a value of type: {formatted_type}", index=index, ) diff --git a/poethepoet/plugin.py b/poethepoet/plugin.py index a3dd0663f..a6568abfc 100644 --- a/poethepoet/plugin.py +++ b/poethepoet/plugin.py @@ -238,7 +238,7 @@ def command_event_handler( def _monkey_patch_cleo(self, prefix: str, task_names: List[str]): """ Cleo is quite opinionated about CLI structure and loose about how options are - used, and so doesn't currently support invidual commands having their own way of + used, and so doesn't currently support individual commands having their own way of interpreting arguments, and forces them to inherit certain options from the application. This is a problem for poe which requires that global options are provided before the task name, and everything after the task name is interpreted @@ -246,7 +246,7 @@ def _monkey_patch_cleo(self, prefix: str, task_names: List[str]): This hack monkey-patches internals of Cleo that are invoked directly after plugin's are loaded by poetry, and exploits a feature whereby argument and - option parsing are effectively disabled following any occurance of a "--" on the + option parsing are effectively disabled following any occurrence of a "--" on the command line, but parsing of the command name still works! Thus the solution is to detect when it is a command from this plugin that is about to be executed and insert the "--" token at the start of the tokens list of the ArgvInput instance diff --git a/poethepoet/task/args.py b/poethepoet/task/args.py index bd86ac700..df77e8360 100644 --- a/poethepoet/task/args.py +++ b/poethepoet/task/args.py @@ -54,7 +54,7 @@ class ArgSpec(PoeOptions): @classmethod def normalize(cls, args_def: ArgsDef, strict: bool = True): """ - Becuase arguments can be declared with different structures + Because arguments can be declared with different structures (i.e. dict or list), this function normalizes the input into a list of dictionaries with necessary keys. @@ -72,7 +72,7 @@ def normalize(cls, args_def: ArgsDef, strict: bool = True): ) elif strict: raise ConfigValidationError( - f"Argument {item!r} has invlaid type, a string or dict is " + f"Argument {item!r} has invalid type, a string or dict is " "expected" ) @@ -177,7 +177,7 @@ def _validate(self): if self.multiple is not False and self.type == "boolean": raise ConfigValidationError( - "Argument with type 'boolean' may not delcare option 'multiple'" + "Argument with type 'boolean' may not declare option 'multiple'" ) diff --git a/poethepoet/task/base.py b/poethepoet/task/base.py index ec2b7c59a..aeecafc56 100644 --- a/poethepoet/task/base.py +++ b/poethepoet/task/base.py @@ -34,7 +34,7 @@ class MetaPoeTask(type): """ - This metaclass makes all decendents of PoeTask (task types) register themselves on + This metaclass makes all descendents of PoeTask (task types) register themselves on declaration and validates that they include the expected class attributes. """ diff --git a/poethepoet/task/shell.py b/poethepoet/task/shell.py index 5ba3f3f92..d91c6c298 100644 --- a/poethepoet/task/shell.py +++ b/poethepoet/task/shell.py @@ -151,7 +151,7 @@ def _locate_interpreter(self, interpreter: str) -> Optional[str]: elif interpreter == "bash": if self._is_windows: # Specifically look for git bash on windows as the preferred option - # Don't trust bash from the path becuase it might be a useless decoy + # Don't trust bash from the path because it might be a useless decoy result = ( which(f"{prog_files}\\Git\\bin\\bash.exe") or which("/bin/bash") diff --git a/poethepoet/ui.py b/poethepoet/ui.py index 4e972bdcd..94e82ae9e 100644 --- a/poethepoet/ui.py +++ b/poethepoet/ui.py @@ -123,7 +123,7 @@ def build_parser(self) -> "ArgumentParser": help="Specify where to find the pyproject.toml", ) - # legacy --root parameter, keep for backwards compatability but help output is + # legacy --root parameter, keep for backwards compatibility but help output is # suppressed parser.add_argument( "--root", diff --git a/pyproject.toml b/pyproject.toml index 32d5fb531..4ee188371 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ poethepoet = "poethepoet.plugin:PoetryPlugin" _clean_docs.script = "shutil:rmtree('docs/_build', ignore_errors=1)" [tool.poe.tasks.format] - help = "Run all formating tools on the code base" + help = "Run all formatting tools on the code base" sequence = ["format-ruff", "format-black"] [tool.poe.tasks.format-ruff] diff --git a/tests/fixtures/includes_project/greet.toml b/tests/fixtures/includes_project/greet.toml index d5a4dab57..597836766 100644 --- a/tests/fixtures/includes_project/greet.toml +++ b/tests/fixtures/includes_project/greet.toml @@ -3,7 +3,7 @@ default_greeting = "Hello" [tool.poe.tasks] echo.cmd = "poe_test_echo echo echo" -echo.help = "This is ignored becuase it's already defined!" +echo.help = "This is ignored because it's already defined!" greet = "poe_test_echo $default_greeting" diff --git a/tests/fixtures/includes_project/laugh.json b/tests/fixtures/includes_project/laugh.json index 0591268cc..b8a325dc8 100644 --- a/tests/fixtures/includes_project/laugh.json +++ b/tests/fixtures/includes_project/laugh.json @@ -9,7 +9,7 @@ }, "echo": { "shell": "poe_test_echo echo echo echo echo echo echo echo", - "help": "This is ignored becuase it's already defined!" + "help": "This is ignored because it's already defined!" } } } diff --git a/tests/test_ignore_fail.py b/tests/test_ignore_fail.py index 97a2b9b31..28842ffd4 100644 --- a/tests/test_ignore_fail.py +++ b/tests/test_ignore_fail.py @@ -55,7 +55,7 @@ def test_return_non_zero(generate_pyproject, run_poe): assert "Subtasks task_1, task_2 returned non-zero exit status" in result.capture -def test_invalid_ingore_value(generate_pyproject, run_poe): +def test_invalid_ignore_value(generate_pyproject, run_poe): project_path = generate_pyproject(ignore_fail="invalid_value") result = run_poe("all_tasks", cwd=project_path) assert result.code == 1, "Expected non-zero result" diff --git a/tests/test_includes.py b/tests/test_includes.py index 3e4ba44ae..b1b35c1c3 100644 --- a/tests/test_includes.py +++ b/tests/test_includes.py @@ -84,7 +84,7 @@ def test_docs_for_only_includes(run_poe_subproc, projects): ) assert ( "CONFIGURED TASKS\n" - " echo This is ignored becuase it's already defined!\n" # or not + " echo This is ignored because it's already defined!\n" # or not " greet \n" " greet1 \n" " greet2 Issue a greeting from the Iberian Peninsula\n" diff --git a/tests/test_script_tasks.py b/tests/test_script_tasks.py index 9f694aeab..08195e97b 100644 --- a/tests/test_script_tasks.py +++ b/tests/test_script_tasks.py @@ -176,11 +176,11 @@ def test_wrong_args_passed(run_poe_subproc): assert result.stderr == (f"{base_error} unrecognized arguments: --age 3 2 1\n") result = run_poe_subproc( - "greet-full-args", "--potatoe", project="scripts", env=no_venv + "greet-full-args", "--potato", project="scripts", env=no_venv ) assert result.capture == "" assert result.stdout == "" - assert result.stderr == (f"{base_error} unrecognized arguments: --potatoe\n") + assert result.stderr == (f"{base_error} unrecognized arguments: --potato\n") def test_required_args(run_poe_subproc): @@ -244,7 +244,7 @@ def test_script_with_positional_args(run_poe_subproc): assert result.stdout == "help! Santa\n" assert result.stderr == "" - # Ommission of optional positional arg + # Omission of optional positional arg result = run_poe_subproc( "greet-positional", "Santa", project="scripts", env=no_venv ) @@ -252,7 +252,7 @@ def test_script_with_positional_args(run_poe_subproc): assert result.stdout == "yo Santa\n" assert result.stderr == "" - # Ommission of required positional arg + # Omission of required positional arg result = run_poe_subproc("greet-positional", project="scripts", env=no_venv) assert result.capture == "" assert result.stdout == ""