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.

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.1.tar.gz (26.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.1-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: petal_ros-0.1.1.tar.gz
  • Upload date:
  • Size: 26.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.1.tar.gz
Algorithm Hash digest
SHA256 90a8af6e562ebabec282aa594200d2a3383f926c1f3bc45fc0105ce57733426d
MD5 c008dc12aab1367d6e9a6ad97785ab90
BLAKE2b-256 5fe72b52927592f7cb380a56b1113666aab2fe2b0276a3ccb6274f0dab994c24

See more details on using hashes here.

Provenance

The following attestation bundles were made for petal_ros-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: petal_ros-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17b766090ac4feb1b6f3bcd1cf3c1b091a187367214722592caeae2b84aedee8
MD5 84a1718775568bc3c84b565f25072e12
BLAKE2b-256 ce97998c8c8955cb78a0611e6d4202f66149b9d4bd12d0739c5e68754fbc5725

See more details on using hashes here.

Provenance

The following attestation bundles were made for petal_ros-0.1.1-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