Skip to content

Commit

Permalink
Fix docs and other mentions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasraabe committed Nov 2, 2024
1 parent 28ecff9 commit 55faebd
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-plugin-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.12

- name: Install dependencies
run: |
Expand Down
6 changes: 3 additions & 3 deletions docs/source/how_to_guides/using_task_returns.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ defines where the return of the function, a string, should be stored.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/how_to_guides/using_task_returns_example_1_py38.py
Expand Down Expand Up @@ -68,7 +68,7 @@ of the previous interfaces.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/how_to_guides/using_task_returns_example_3_py38.py
Expand Down Expand Up @@ -103,7 +103,7 @@ mapped to the defined nodes.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/how_to_guides/using_task_returns_example_4_py38.py
Expand Down
12 changes: 6 additions & 6 deletions docs/source/how_to_guides/writing_custom_nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ The result will be the following task.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/how_to_guides/writing_custom_nodes_example_2_py38.py
```
````
````{tab-item} Python 3.8+ & Return
````{tab-item} Python 3.9 & Return
:sync: python38plus
```{literalinclude} ../../../docs_src/how_to_guides/writing_custom_nodes_example_2_py38_return.py
Expand Down Expand Up @@ -87,7 +87,7 @@ we arrive at the following class.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/how_to_guides/writing_custom_nodes_example_3_py38.py
Expand Down Expand Up @@ -142,9 +142,9 @@ databases. [^kedro]

## References

[^structural-subtyping]: Structural subtyping is similar to ABCs an approach in Python to enforce interfaces, but
it can be considered more pythonic since it is closer to duck typing. Hynek Schlawack
wrote a comprehensive
[^structural-subtyping]: Structural subtyping is similar to ABCs an approach in Python to enforce interfaces,
but it can be considered more pythonic since it is closer to duck typing. Hynek
Schlawack wrote a comprehensive
[guide on subclassing](https://hynek.me/articles/python-subclassing-redux/) that
features protocols under "Type 2". Glyph wrote an introduction to protocols called
[I want a new duck](https://glyph.twistedmatrix.com/2020/07/new-duck.html).
Expand Down
12 changes: 6 additions & 6 deletions docs/source/tutorials/defining_dependencies_products.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Defining dependencies and products also serves another purpose. By analyzing the
pytask determines the order to run the tasks.

This tutorial offers you different interfaces. If you are comfortable with type
annotations or are not afraid to try them, look at the `Python 3.10+` or `3.8+` tabs.
You find a tutorial on type hints {doc}`here <../type_hints>`.
annotations or are not afraid to try them, look at the `Python 3.10+` or `3.9` tabs. You
find a tutorial on type hints {doc}`here <../type_hints>`.

If you want to avoid type annotations for now, look at the tab named `produces`.

Expand Down Expand Up @@ -60,7 +60,7 @@ task has finished, pytask will check whether the file exists.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/defining_dependencies_products_products_py38.py
Expand Down Expand Up @@ -117,7 +117,7 @@ annotation are dependencies of the task.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
To specify that the task relies on the data set `data.pkl`, you can add the path
Expand Down Expand Up @@ -169,7 +169,7 @@ are assumed to point to a location relative to the task module.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/defining_dependencies_products_relative_py38.py
Expand Down Expand Up @@ -209,7 +209,7 @@ structures if needed.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/defining_dependencies_products_multiple1_py38.py
Expand Down
10 changes: 5 additions & 5 deletions docs/source/tutorials/repeating_tasks_with_different_inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ different seeds and output paths as default arguments of the function.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/repeating_tasks_with_different_inputs1_py38.py
Expand Down Expand Up @@ -57,7 +57,7 @@ You can also add dependencies to repeated tasks just like with any other task.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/repeating_tasks_with_different_inputs2_py38.py
Expand Down Expand Up @@ -117,7 +117,7 @@ For example, the following function is parametrized with tuples.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/repeating_tasks_with_different_inputs3_py38.py
Expand Down Expand Up @@ -158,7 +158,7 @@ a unique name for the iteration.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/repeating_tasks_with_different_inputs4_py38.py
Expand Down Expand Up @@ -244,7 +244,7 @@ Following these three tips, the parametrization becomes
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/repeating_tasks_with_different_inputs5_py38.py
Expand Down
8 changes: 4 additions & 4 deletions docs/source/tutorials/using_a_data_catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ of our tasks. Here we see again the signature of the task function.
```
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/defining_dependencies_products_products_py38.py
Expand Down Expand Up @@ -107,7 +107,7 @@ Use `data_catalog["data"]` as an default argument to access the
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
Use `data_catalog["data"]` as an default argument to access the
Expand Down Expand Up @@ -167,7 +167,7 @@ Following one of the interfaces gives you immediate access to the
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/using_a_data_catalog_3_py38.py
Expand Down Expand Up @@ -241,7 +241,7 @@ different node types which is not relevant now.
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
:sync: python38plus
```{literalinclude} ../../../docs_src/tutorials/using_a_data_catalog_5_py38.py
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/write_a_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If you want to refresh your knowledge about type hints, read
````
````{tab-item} Python 3.8+
````{tab-item} Python 3.9
The task accepts the argument `path` that points to the file where the data set will be
stored. The path is passed to the task via the default value, `BLD / "data.pkl"`. To
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Build Tools",
]
Expand Down Expand Up @@ -207,7 +207,11 @@ module = ["_pytask.hookspecs"]
disable_error_code = ["empty-body"]

[tool.refurb]
python_version = "3.8"
python_version = "3.9"

[[tool.refurb.amend]]
path = "src/_pytask/mark/structures.py"
ignore = ["FURB173"]

[tool.coverage.report]
exclude_also = [
Expand Down
3 changes: 1 addition & 2 deletions src/_pytask/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ def build( # noqa: C901, PLR0912, PLR0913
"task_files": task_files,
"trace": trace,
"verbose": verbose,
**kwargs,
}
} | kwargs

if "command" not in raw_config:
pm = get_plugin_manager()
Expand Down
4 changes: 2 additions & 2 deletions src/_pytask/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def is_file_system_case_sensitive() -> bool:
def pytask_configure(pm: PluginManager, raw_config: dict[str, Any]) -> dict[str, Any]:
"""Configure pytask."""
# Add all values by default so that many plugins do not need to copy over values.
config = {"pm": pm, "markers": {}, **raw_config}
config["markers"] = parse_markers(config["markers"])
config = {"pm": pm, "markers": {}} | raw_config
config["markers"] = parse_markers(config["markers"]) # type: ignore[arg-type]

pm.hook.pytask_parse_config(config=config)
pm.hook.pytask_post_parse(config=config)
Expand Down
3 changes: 1 addition & 2 deletions src/_pytask/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ def _format_plugin_names_and_versions(
# Gets us name and version!
name = f"{dist.project_name}-{dist.version}"
# Questionable convenience, but it keeps things short.
if name.startswith("pytask-"):
name = name[7:]
name = name.removeprefix("pytask-")
# We decided to print python package names they can have more than one plugin.
if name not in values:
values.append(name)
Expand Down
18 changes: 13 additions & 5 deletions src/_pytask/mark/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@

@define(frozen=True)
class Mark:
"""A class for a mark containing the name, positional and keyword arguments."""
"""A class for a mark containing the name, positional and keyword arguments.
Attributes
----------
name
Name of the mark.
args
Positional arguments of the mark decorator.
kwargs
Keyword arguments of the mark decorator.
"""

name: str
"""str: Name of the mark."""
args: tuple[Any, ...]
"""Tuple[Any]: Positional arguments of the mark decorator."""
kwargs: Mapping[str, Any]
"""Mapping[str, Any]: Keyword arguments of the mark decorator."""

def combined_with(self, other: Mark) -> Mark:
"""Return a new Mark which is a combination of this Mark and another Mark.
Expand All @@ -36,7 +44,7 @@ def combined_with(self, other: Mark) -> Mark:
Parameters
----------
other : pytask.mark.structures.Mark
other
The mark to combine with.
Returns
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/task_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def _parse_task(task: Callable[..., Any]) -> tuple[str, Callable[..., Any]]:
parsed_kwargs = _parse_task_kwargs(meta.kwargs)

signature_kwargs = parse_keyword_arguments_from_signature_defaults(task)
meta.kwargs = {**signature_kwargs, **parsed_kwargs}
meta.kwargs = signature_kwargs | parsed_kwargs

return parsed_name, task

Expand Down

0 comments on commit 55faebd

Please sign in to comment.