Skip to main content

Workspace-scoped Python dependency manager for ROS2

Project description

petal

Workspace-scoped Python dependency manager for ROS2.

Petal discovers Python dependencies in a ROS2 workspace, resolves apt-first, falls back to PyPI when needed, installs pip packages into .petal/venv, and writes petal.lock.

Petal is dependency management, not node isolation. ROS2 still runs in one shared Python interpreter view, so petal venvs are created with --system-site-packages.

Install

uv tool install petal-ros

If you use the colcon verb, install the colcon extra:

uv tool install "petal-ros[colcon]"

Local development:

git clone https://github.com/matthewyjiang/petal.git
cd petal
python3 -m pip install -e .

Requires Python 3.10+, ROS2 under /opt/ros/<distro>, rosdep, apt tools, and preferably uv.

Quickstart

From a ROS2 workspace root:

petal init
petal add numpy
petal sync
petal status
source .petal/activate

Examples

Apt-resolved package:

petal add numpy

PyPI package:

petal add huggingface

Rosdep-resolved ROS package:

petal add cv_bridge

Commands

petal init              # create petal.toml and .petal/venv
petal add <name> [spec] # add dependency and sync it
petal remove <name>     # remove dependency from manifest and venv
petal sync              # resolve, install, write petal.lock
petal sync --yes        # skip install prompt
petal sync --no         # show plan, install nothing
petal sync --dry-run    # show commands, install nothing
petal sync --frozen     # enforce petal.lock
petal status            # report drift; exits 2 on drift/missing/change
petal activate          # print shell snippet for ROS + venv activation
petal clean             # remove .petal/venv

petal sync and petal add print the resolved source for each dependency before installing. If petal add is declined, cancelled, or run with --dry-run, petal.toml stays unchanged.

Manifest

[workspace]
ros_distro = "humble"
python_version = "3.10"

[deps]
numpy = ">=1.24"
huggingface = ">=0.0.1"
some-system-lib = { apt = "libfoo-dev" }

[overrides]
ml_collections = { pip = "ml-collections" }

Resolution order: ROS/system modules, rosdep, apt (python3-<name>), then PyPI.

Colcon Verb

Petal ships a colcon deps verb. Install with the colcon extra:

uv tool install "petal-ros[colcon]"

Then from a ROS2 workspace root:

colcon deps sync              # resolve and install dependencies
colcon deps status            # report drift; exits 2 on drift/missing/change
colcon deps sync --dry-run    # show plan, install nothing
colcon deps sync --frozen     # enforce petal.lock
colcon deps sync --workspace /path/to/ws  # explicit workspace path

colcon deps is a thin wrapper around petal sync / petal status and honours the same flags.

Agent Skill

This repo includes an installable agent skill with Petal CLI usage guidance:

petal install-agent-skill

After installing, coding agents that support ~/.agents/skills can load the petal-cli skill when users ask about Petal.

Development

uv run --with pytest pytest -q

Unit tests use fake subprocess runners and do not require network, real ROS, apt, rosdep, uv, or colcon.

Project details


Download files

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

Source Distribution

petal_ros-0.1.2.tar.gz (29.9 kB view details)

Uploaded Source

Built Distribution

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

petal_ros-0.1.2-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file petal_ros-0.1.2.tar.gz.

File metadata

  • Download URL: petal_ros-0.1.2.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for petal_ros-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9f5d4586b4f477cc9df63f60381a47e3de4081611473a6562c54691690098ac5
MD5 f981d26d7cce518a88c69692725a7fd0
BLAKE2b-256 c3ec29064bf08aee149c7bd819002f87342f8ea840b8708c76a99884418bb545

See more details on using hashes here.

Provenance

The following attestation bundles were made for petal_ros-0.1.2.tar.gz:

Publisher: publish.yml on matthewyjiang/petal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file petal_ros-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: petal_ros-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for petal_ros-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8288b1f4862398d33d4a2b22270e34bbe1278033c2d007a2d435f7fa420c0196
MD5 b48b13b12b16ea188442178907dac260
BLAKE2b-256 f1cb70a9e1952936b07e0b5339ab49445d60102f9d92bb910e143597b7b8255b

See more details on using hashes here.

Provenance

The following attestation bundles were made for petal_ros-0.1.2-py3-none-any.whl:

Publisher: publish.yml on matthewyjiang/petal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page