Refactor DAG internals and lazy-load networkx#830
Merged
tobiasraabe merged 13 commits intomainfrom Mar 27, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
networkxDAG usage with a pytask-owned DAG implementationbuild_dag()and the visualization path returning anetworkx.DiGraphvia on-demand conversionnetworkxoptional and only import it on the DAG export boundaryBenchmarks
Compared this branch against
origin/mainin an isolated worktree after plainuv syncin both trees.pytask --help282.3 ms ± 43.0 msorigin/main:339.8 ms ± 27.3 ms1.20xfasterpython -c "import pytask"284.5 ms ± 40.5 msorigin/main:320.1 ms ± 26.8 ms1.13xfasterThe current branch runtime environment had no installed
networkxafteruv sync, whileorigin/mainstill did.Testing
just typinguvx ruff check src/_pytask/dag.py src/_pytask/dag_command.py src/_pytask/dag_graph.py src/_pytask/dag_utils.py src/_pytask/execute.py src/_pytask/session.py src/_pytask/shared.py src/_pytask/mark/__init__.py tests/test_dag_command.py tests/test_dag_utils.py pyproject.toml docs/source/tutorials/visualizing_the_dag.mduvx ruff format --check src/_pytask/dag.py src/_pytask/dag_command.py src/_pytask/dag_graph.py src/_pytask/dag_utils.py src/_pytask/execute.py src/_pytask/session.py src/_pytask/shared.py src/_pytask/mark/__init__.py tests/test_dag_command.py tests/test_dag_utils.pyuv run --group test pytest tests/test_dag_command.py tests/test_dag_utils.py tests/test_build.py tests/test_execute.py tests/test_mark.py tests/test_dag.py -quv run --group test pytest tests/test_collect_command.py tests/test_execute.py tests/test_lockfile.py tests/test_profile.py -q