Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ updates:
directory: "/"
schedule:
interval: "weekly"

groups:
github-actions:
patterns:
- "*"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.14
3.13
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ or
$ pixi add pytask
```

or use pip, conda, or mamba if you like.

Color support is automatically available on non-Windows platforms. On Windows, please,
use [Windows Terminal](https://github.com/microsoft/terminal), which can be, for
example, installed via the [Microsoft Store](https://aka.ms/terminal).
Expand Down
6 changes: 5 additions & 1 deletion docs/source/developers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ $ python -m cProfile -o log.pstats -m pytask directory/with/tasks
The profile can be visualized with

```console
$ pip install yelp-gprof2dot
$ uv add yelp-gprof2dot

# or

$ pixi add --pypi yelp-gprof2dot
$ gprof2dot log.pstats | dot -T svg -o out.svg
```

Expand Down
4 changes: 2 additions & 2 deletions docs/source/how_to_guides/hashing_inputs_of_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function to the {class}`~pytask.PythonNode` that generates a stable hash.
First, install `deepdiff`.

```console
$ pip install deepdiff
$ conda install deepdiff
$ uv add deepdiff
$ pixi add deepdiff
```

Then, create the hash function and pass it to the node. Make sure it returns either an
Expand Down
10 changes: 5 additions & 5 deletions docs/source/how_to_guides/migrating_from_scripts_to_pytask.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ guide concludes with an additional example of an R script.

## Installation

To get started with pytask, simply install it with pip or conda:
To get started with pytask, install it with uv or pixi:

```console
$ pip install pytask pytask-parallel
$ uv add pytask pytask-parallel

$ conda -c conda-forge pytask pytask-parallel
$ pixi add pytask pytask-parallel
```

## From Python script to task
Expand Down Expand Up @@ -104,9 +104,9 @@ about the plugin in the repo's readme.
First, we will install the package.

```console
$ pip install pytask-r
$ uv add pytask-r

$ conda install -c conda-forge pytask-r
$ pixi add pytask-r
```

```{seealso}
Expand Down
14 changes: 0 additions & 14 deletions docs/source/tutorials/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ $ pixi add pytask

Learn more about [uv](https://docs.astral.sh/uv/) and [pixi](https://pixi.sh/).

## Traditional

You can also install pytask using traditional package managers:

```console
$ pip install pytask
```

or

```console
$ conda install -c conda-forge pytask
```

<!-- END: Keep in sync with README.md -->

Verify the installation by displaying the help page listing all available commands and
Expand Down
90 changes: 0 additions & 90 deletions docs/source/tutorials/set_up_a_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,68 +128,7 @@ paths = ["src/my_project"]

````

````{tab-item} pip
:sync: pip

Create a `pyproject.toml` file for project configuration:

```toml
[project]
name = "my_project"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = ["pytask"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.pytask.ini_options]
paths = ["src/my_project"]
```

Also create a `requirements.txt` file:

```text
pytask
```

````

````{tab-item} conda/mamba
:sync: conda

Create an `environment.yml` file that includes the editable install:

```yaml
name: my_project
channels:
- conda-forge
dependencies:
- python>=3.10
- pytask
- pip
- pip:
- -e .
```

And a `pyproject.toml` file for project configuration:

```toml
[project]
name = "my_project"
version = "0.1.0"
requires-python = ">=3.10"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling"

[tool.pytask.ini_options]
paths = ["src/my_project"]
```

````
`````

The `[tool.pytask.ini_options]` section tells pytask to look for tasks in
Expand Down Expand Up @@ -227,33 +166,4 @@ pixi automatically creates the environment and installs dependencies. pixi will

````

````{tab-item} pip
:sync: pip

```console
$ pip install -e .
```

This creates an editable install where changes in the package's source files are immediately available in the installed version.

````

````{tab-item} conda/mamba
:sync: conda

```console
$ conda env create -f environment.yml
$ conda activate my_project
```

Or with mamba:

```console
$ mamba env create -f environment.yml
$ mamba activate my_project
```

The editable install is automatically handled by the `pip: -e .` entry in `environment.yml`.

````
`````
4 changes: 2 additions & 2 deletions docs/source/tutorials/visualizing_the_dag.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

To visualize the {term}`DAG` of the project, first, install
[pygraphviz](https://github.com/pygraphviz/pygraphviz) and
[graphviz](https://graphviz.org/). For example, you can both install with conda
[graphviz](https://graphviz.org/). For example, you can both install with pixi

```console
$ conda install -c conda-forge pygraphviz
$ pixi add pygraphviz graphviz
```

After that, pytask offers two interfaces to visualize your project's {term}`DAG`.
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test-cov *FLAGS:

# Run type checking
typing:
uv run --group typing --group test ty check src/ tests/
uv run --group typing --group test --isolated ty check src/ tests/

# Run linting
lint:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test = [
"coiled>=1.42.0",
"pygraphviz>=1.12;platform_system=='Linux'",
]
typing = ["ty>=0.0.7"]
typing = ["ty>=0.0.8"]

[project.urls]
Changelog = "https://pytask-dev.readthedocs.io/en/stable/changes.html"
Expand Down
10 changes: 8 additions & 2 deletions src/_pytask/click.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar
from typing import cast

import click
from click import Choice
Expand All @@ -28,6 +29,7 @@
from _pytask.console import create_panel_title

if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Sequence


Expand All @@ -39,7 +41,10 @@
else:
from click.parser import _split_opt # ty: ignore[unresolved-import]

split_opt = _split_opt

def split_opt(option: str) -> tuple[str, str]:
"""Split an option into prefix and name."""
return cast("Callable[[str], tuple[str, str]]", _split_opt)(option)


class EnumChoice(Choice):
Expand Down Expand Up @@ -251,7 +256,8 @@ def _print_options(group_or_command: Command | DefaultGroup, ctx: Context) -> No
if param.metavar:
opt2 += Text(f" {param.metavar}", style="metavar")
elif isinstance(param.type, click.Choice):
choices = "[" + "|".join(param.type.choices) + "]"
choices_values = cast("Sequence[Any]", param.type.choices)
choices = "[" + "|".join(str(choice) for choice in choices_values) + "]"
opt2 += Text(f" {choices}", style="metavar", overflow="fold")

help_text = _format_help_text(param, ctx)
Expand Down
44 changes: 22 additions & 22 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.