Skip to main content

PyTrees

[About] [What's New?] [Documentation] [Getting Started] [Next Steps] [Maintainers] [Acknowledgments] [Releases]


About

PyTrees is a Python implementation of behaviour trees designed to facilitate the rapid development of medium sized decision making engines for use in fields like robotics.

Brief feature list:

  • Behaviours, Decorators, Sequences, Selectors, Parallels and BehaviourTree.
  • Blackboards for data sharing.
  • A useful library of behaviours, decorators, and idioms.
  • A more abstract ports API and XML parser for declarative behavior definitions.
  • Serialise to a dot graph or render to ascii/unicode in a terminal.
  • Tested on Linux and Mac (YMMV with Windows).

Documentation

devel 2.6.x 2.5.x 2.4.x 2.3.x

Getting Started

Released versions of PyTrees can be installed directly from:

  • PyPi: pip install py_trees
  • conda-forge: conda install conda-forge::py-trees

Alternatively, you can clone the repo, install uv, and you're up and running in under 5 minutes:

# Install dependencies into a .venv
$ uv sync

# Explore the demos
$ uv run py-trees-demo-<tab>-<tab>
py-trees-demo-action-behaviour            py-trees-demo-context-switching           py-trees-demo-logging
py-trees-demo-behaviour-lifecycle         py-trees-demo-display-modes               py-trees-demo-pick-up-where-you-left-off
py-trees-demo-blackboard                  py-trees-demo-dot-graphs                  py-trees-demo-selector
py-trees-demo-blackboard-namespaces       py-trees-demo-either-or                   py-trees-demo-sequence
py-trees-demo-blackboard-remappings       py-trees-demo-eternal-guard               py-trees-demo-tree-stewardship
$ uv run py-trees-demo-blackboard
...

# Hack some Code

# Run the Formatter, Linter, Type-Checker and Tests
$ uv run ruff format
$ uv run ruff check
$ uv run ty check
$ uv run pytest -s tests/

# Contribute a PR!
# https://github.com/splintered-reality/py_trees/blob/devel/CONTRIBUTING.md

See DEVELOPING.md for more detail. And be froody.

Next Steps

On PyPi:

On conda-forge:

Examples:

  • ReadTheDocs - PyTrees ROS Tutorials - significantly more edifying than the demos, these incrementally walk through the process of building a decision making layer for a robot. These use ROS 2 (sparsely), but merely browsing should be enlightening regardless.

Visualisation:

  • py_trees_js - a javascript library for building your own runtime visualisation tool

Robotics:

Maintainers

Acknowledgments

Contributors are welcome to add themselves here in future PRs.

  • Port declarations, type validation, and XML parser: contributed by Sunrise Robotics.

Releases

  • 2.6.x - Improvements to Ports API and XML file parsing, including default values and performance improvements.
  • 2.5.x - New Ports API with XML file parsing, modernized dev environment with uv, support Python 3.14.
  • 2.4.x - New ForEach decorator, new CompareBlackboardVariables behaviour, and callables in comparison expressions.
  • 2.3.x - Support for Python 3.12 was added, and Python 3.8 was dropped.
  • 2.2.x - Selectors, Sequences with and without memory. Improved testing and style/type checking.
  • 2.1.x - Chooser deprecated. API housekeeping.
  • 2.0.x - Blackboards V2!
  • 1.2.x - Trees can now shutdown cleanly. StatusToBlackboard and EternalGuard, Visitors get finalise().
  • 1.1.x - Fixes for setup, tick-tock, viz.
  • 1.0.x - Behaviours, Decorators, Composites, Blackboards, Tree Management and Viz tools.
  • 0.y.x - First open source pre-releases.
Devel 2.6.x 2.5.x 2.4.x 2.3.x
Sources devel 2.6.x 2.5.x 2.4.x 2.3.x
Compatibility Python 3.14
Python 3.12
Python 3.10
Python 3.14
Python 3.12
Python 3.10
Python 3.14
Python 3.12
Python 3.10
Python 3.12
Python 3.10
Python 3.12
Python 3.10
CI devel-Status 2.6.x-Status 2.5.x-Status 2.4.x-Status 2.3.x-Status
Documentation devel-Docs 2.6.x-Docs 2.5.x-Docs 2.4.x-Docs 2.3.x-Docs

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_trees-2.6.0.tar.gz (8.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_trees-2.6.0-py2.py3-none-any.whl (148.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file py_trees-2.6.0.tar.gz.

File metadata

  • Download URL: py_trees-2.6.0.tar.gz
  • Upload date:
  • Size: 8.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_trees-2.6.0.tar.gz
Algorithm Hash digest
SHA256 60a5d81e1e348b0aca2c1c65a94713a2a3d87c749058bf1edfa721c53b07bde5
MD5 ba59d3083577dc81f017af2d4de35736
BLAKE2b-256 4ccd592ecf58fce9b87743aab2d05dd94b57669e436d77facd4c9f1e8d4b6be7

See more details on using hashes here.

File details

Details for the file py_trees-2.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: py_trees-2.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 148.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_trees-2.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 78155ffaf02f49de0c4bfb458488a1f766ded5b35bf1254980d8f49e6fb89837
MD5 1e2404b996246e395faf06a87572c6e7
BLAKE2b-256 d2103b618ece6a776e7b7fac3dcfd0f4e2e52006c0e49d0f63fc35c5bfef3566

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.6.0 This release

2 files

2.5.0

2 files

2.4.0

2 files

2.3.0

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.1.6

2 files

2.1.5

2 files

2.1.4

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.16

2 files

2.0.15

2 files

2.0.14

2 files

2.0.13

2 files

2.0.11

1 file

2.0.10

2 files

2.0.9

1 file

2.0.8

2 files

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.4.1

2 files

1.4.0

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.6

2 files

1.0.5

3 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.7.6

2 files

0.7.3

3 files

0.7.2

2 files

0.6.9

1 file

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.9

1 file

0.5.1

1 file

0.5.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page