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
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- macos-latest # arm
- windows-latest
environment:
- py311
- py312
- py313
- py314
Expand Down
5 changes: 2 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pixi run -e docs build-docs # Build HTML docs with Jupyter Book
pixi run -e docs view-docs # Live preview of docs
```

Available Python environments: `py311`, `py312`, `py313`, `py314`, `py315`
Available Python environments: `py312`, `py313`, `py314`, `py315`

Documentation uses **Jupyter Book 2.0** with **MyST** markdown. Config is in
`docs/myst.yml`. Docs include executable Jupyter notebooks.
Expand All @@ -37,7 +37,6 @@ src/dags/
├── exceptions.py # Custom exceptions
├── output.py # Output processing utilities
├── signature.py # Function signature utilities
├── typing.py # Type definitions
├── utils.py # General utilities
└── tree/ # Tree-related utilities

Expand Down Expand Up @@ -67,7 +66,7 @@ tests/
## Code Style

- Does **not** use `from __future__ import annotations` or `TYPE_CHECKING` blocks
- Ruff for linting (target: Python 3.11)
- Ruff for linting (target: Python 3.12)
- ty for type checking (all rules set to error)
- Google docstring convention
- User-facing APIs accept `Sequence` (not `list`) for input parameters
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ releases are available on [conda-forge](https://anaconda.org/conda-forge/dags).

## Unreleased

- :gh:`91` Drop Python 3.11 support; declare type parameters with PEP 695 syntax and
remove `dags.typing` (:ghuser:`hmgaudecker`).

## 0.6.0

- :gh:`82` Make dags wrappers play nicely with runtime type checkers
Expand Down
1,691 changes: 13 additions & 1,678 deletions pixi.lock

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Tools to create executable dags from interdependent functions."
readme = { file = "README.md", content-type = "text/markdown" }
keywords = []
license = { file = "LICENSE" }
requires-python = ">=3.11"
requires-python = ">=3.12"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
Expand All @@ -17,7 +17,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
Expand Down Expand Up @@ -71,7 +70,7 @@ platforms = [ "linux-64", "osx-64", "osx-arm64", "win-64" ]
[tool.pixi.dependencies]
jupyterlab = "*"
prek = ">=0.5.9"
python = ">=3.11,<3.16"
python = ">=3.12,<3.16"
[tool.pixi.pypi-dependencies]
dags = { path = ".", editable = true }
pdbp = "*"
Expand All @@ -82,8 +81,6 @@ numpy = "*"
[tool.pixi.feature.docs.tasks]
build-docs = { cmd = "jupyter book build --html --execute", cwd = "docs" }
view-docs = { cmd = "jupyter book start --execute", cwd = "docs" }
[tool.pixi.feature.py311.dependencies]
python = "~=3.11.0"
[tool.pixi.feature.py312.dependencies]
python = "~=3.12.0"
[tool.pixi.feature.py313.dependencies]
Expand All @@ -106,7 +103,6 @@ tests = "pytest"
tests-with-cov = "pytest --cov-report=xml --cov=./"
[tool.pixi.environments]
docs = [ "docs", "py314" ]
py311 = [ "py311", "tests" ]
py312 = [ "py312", "tests" ]
py313 = [ "py313", "tests" ]
py314 = [ "py314", "tests" ]
Expand Down Expand Up @@ -179,8 +175,6 @@ expand_tables = [
"tool.pixi.feature.docs",
"tool.pixi.feature.docs.dependencies",
"tool.pixi.feature.docs.tasks",
"tool.pixi.feature.py311",
"tool.pixi.feature.py311.dependencies",
"tool.pixi.feature.py312",
"tool.pixi.feature.py312.dependencies",
"tool.pixi.feature.py313",
Expand Down
7 changes: 3 additions & 4 deletions src/dags/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
)
from dags.output import aggregated_output, dict_output, list_output, single_output
from dags.signature import with_signature
from dags.typing import T
from dags.utils import format_list_linewise


Expand Down Expand Up @@ -87,7 +86,7 @@ def return_annotation(self) -> str:
return self.annotations["return"]


def concatenate_functions( # noqa: PLR0913
def concatenate_functions[T]( # noqa: PLR0913
functions: Mapping[str, Callable[..., Any]] | Sequence[Callable[..., Any]],
targets: str | Sequence[str] | None = None,
*,
Expand Down Expand Up @@ -215,7 +214,7 @@ def create_dag(
return dag


def _create_combined_function_from_dag( # noqa: PLR0913
def _create_combined_function_from_dag[T]( # noqa: PLR0913
dag: nx.DiGraph,
functions: Mapping[str, Callable[..., Any]] | Sequence[Callable[..., Any]],
targets: str | Sequence[str] | None,
Expand Down Expand Up @@ -637,7 +636,7 @@ def concatenated(*args: Any, **kwargs: Any) -> tuple[Any, ...]:
)


def _infer_aggregator_return_type(
def _infer_aggregator_return_type[T](
aggregator: Callable[[T, T], T],
explicit_type: str | None,
target_types: tuple[str, ...],
Expand Down
17 changes: 8 additions & 9 deletions src/dags/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from dags.annotations import get_annotations
from dags.exceptions import DagsError
from dags.signature import forwarder_annotations
from dags.typing import MixedTupleType, P, T


def _apply_return_annotation(
Expand Down Expand Up @@ -38,7 +37,7 @@ def _apply_return_annotation(
wrapper.__annotations__ = forwarder_annotations()


def single_output(
def single_output[**P, T, *MixedTupleType](
func: Callable[P, tuple[T, *MixedTupleType]] | Callable[P, tuple[T, ...]],
*,
set_annotations: bool = False,
Expand All @@ -64,7 +63,7 @@ def wrapper_single_output(*args: P.args, **kwargs: P.kwargs) -> T:


@overload
def dict_output(
def dict_output[**P, T](
func: Callable[P, tuple[T, ...]],
*,
keys: Sequence[str],
Expand All @@ -73,12 +72,12 @@ def dict_output(


@overload
def dict_output(
def dict_output[**P, T](
*, keys: Sequence[str], set_annotations: bool = False
) -> Callable[[Callable[P, tuple[T, ...]]], Callable[P, dict[str, T]]]: ...


def dict_output(
def dict_output[**P, T](
func: Callable[P, tuple[T, ...]] | None = None,
*,
keys: Sequence[str] | None = None,
Expand Down Expand Up @@ -116,7 +115,7 @@ def wrapper_dict_output(*args: P.args, **kwargs: P.kwargs) -> dict[str, T]:
return decorator_dict_output


def list_output(
def list_output[**P, T](
func: Callable[P, tuple[T, ...]], *, set_annotations: bool = False
) -> Callable[P, list[T]]:
"""Convert tuple output to list output."""
Expand All @@ -136,7 +135,7 @@ def wrapper_list_output(*args: P.args, **kwargs: P.kwargs) -> list[T]:


@overload
def aggregated_output(
def aggregated_output[**P, T](
func: Callable[P, tuple[T, ...]],
*,
aggregator: Callable[[T, T], T],
Expand All @@ -146,15 +145,15 @@ def aggregated_output(


@overload
def aggregated_output(
def aggregated_output[**P, T](
*,
aggregator: Callable[[T, T], T],
set_annotations: bool = False,
return_annotation: str | None = None,
) -> Callable[[Callable[P, tuple[T, ...]]], Callable[P, T]]: ...


def aggregated_output(
def aggregated_output[**P, T](
func: Callable[P, tuple[T, ...]] | None = None,
*,
aggregator: Callable[[T, T], T] | None = None,
Expand Down
13 changes: 6 additions & 7 deletions src/dags/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from dags.annotations import get_free_arguments
from dags.exceptions import DagsError, InvalidFunctionArgumentsError
from dags.typing import P, R


def _create_signature(
Expand Down Expand Up @@ -53,7 +52,7 @@ def _create_signature(


@overload
def with_signature(
def with_signature[**P, R](
func: Callable[P, R],
*,
args: Mapping[str, str] | Sequence[str] | None = None,
Expand All @@ -64,7 +63,7 @@ def with_signature(


@overload
def with_signature(
def with_signature[**P, R](
*,
args: Mapping[str, str] | Sequence[str] | None = None,
kwargs: Mapping[str, str] | Sequence[str] | None = None,
Expand All @@ -73,7 +72,7 @@ def with_signature(
) -> Callable[[Callable[P, R]], Callable[P, R]]: ...


def with_signature(
def with_signature[**P, R](
func: Callable[P, R] | None = None,
*,
args: Mapping[str, str] | Sequence[str] | None = None,
Expand Down Expand Up @@ -220,20 +219,20 @@ def _fail_if_missing_arguments(


@overload
def rename_arguments(
def rename_arguments[**P, R](
func: Callable[P, R],
*,
mapper: Mapping[str, str],
) -> Callable[..., R]: ...


@overload
def rename_arguments(
def rename_arguments[**P, R](
*, mapper: Mapping[str, str]
) -> Callable[[Callable[P, R]], Callable[..., R]]: ...


def rename_arguments(
def rename_arguments[**P, R](
func: Callable[P, R] | None = None,
*,
mapper: Mapping[str, str] | None = None,
Expand Down
5 changes: 1 addition & 4 deletions src/dags/tree/typing.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""Type definitions for DAG tree module."""

from collections.abc import Callable, Mapping
from typing import Any, TypeVar

# Type variables
T = TypeVar("T")
from typing import Any

# Basic nested structure types
NestedStructureDict = Mapping[str, "Any | NestedStructureDict"]
Expand Down
13 changes: 0 additions & 13 deletions src/dags/typing.py

This file was deleted.

Loading