Skip to content

Commit d0efa37

Browse files
authored
Adding pixi environment and docs
Pixi support!
2 parents 399631c + c7cf11c commit d0efa37

File tree

15 files changed

+67224
-34
lines changed

15 files changed

+67224
-34
lines changed

.github/workflows/python-pixi.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Python - crossplatform
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 10
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- uses: prefix-dev/setup-pixi@v0.9.2
28+
with:
29+
cache: true
30+
environments: zenoh
31+
- name: Test with pixi+pytest
32+
run: |
33+
pixi run -e zenoh pytest ./tests -s

.github/workflows/python-package.yml renamed to .github/workflows/python-pytest.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
41
name: Python
52

63
on:
@@ -12,6 +9,7 @@ on:
129
jobs:
1310
build:
1411

12+
timeout-minutes: 10
1513
runs-on: ubuntu-latest
1614
strategy:
1715
fail-fast: false

.github/workflows/ros-pixi.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: ROS 2 - crossplatform
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
ros-version: ["humble", "jazzy", "kilted"]
16+
os: [ubuntu-latest, windows-latest]
17+
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 10
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: prefix-dev/setup-pixi@v0.9.2
23+
with:
24+
cache: true
25+
environments: ${{ matrix.ros-version }}
26+
- name: Test with pixi+pytest
27+
run: |
28+
pixi run -e ${{ matrix.ros-version }} pytest ./tests -s
29+

.github/workflows/ros-pytest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010
build:
1111

12+
timeout-minutes: 10
1213
runs-on: ubuntu-latest
1314
strategy:
1415
fail-fast: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build/
88
install/
99
log/
1010
uv.lock
11+
.pixi

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Asyncio For Robotics
22
| Requirements | Compatibility | Tests |
33
|---|---|---|
4-
| [![python](https://img.shields.io/pypi/pyversions/asyncio_for_robotics?logo=python&logoColor=white&label=Python&color=%20blue)](https://pypi.org/project/asyncio_for_robotics/)<br>[![mit](https://img.shields.io/badge/License-MIT-gold)](https://opensource.org/license/mit) | [![zenoh](https://img.shields.io/badge/Zenoh-%3E%3D1.0-blue)](https://zenoh.io/)<br>[![ros](https://img.shields.io/badge/ROS_2-Humble%20%7C%20Jazzy-blue?logo=ros)](https://github.com/ros2) | [![Python](https://github.com/2lian/asyncio-for-robotics/actions/workflows/python-package.yml/badge.svg)](https://github.com/2lian/asyncio-for-robotics/actions/workflows/python-package.yml)<br>[![ROS 2](https://github.com/2lian/asyncio-for-robotics/actions/workflows/ros-pytest.yml/badge.svg)](https://github.com/2lian/asyncio-for-robotics/actions/workflows/ros-pytest.yml) |
4+
| [![python](https://img.shields.io/pypi/pyversions/asyncio_for_robotics?logo=python&logoColor=white&label=Python&color=%20blue)](https://pypi.org/project/asyncio_for_robotics/)<br>[![mit](https://img.shields.io/badge/License-MIT-gold)](https://opensource.org/license/mit) | [![ros](https://img.shields.io/badge/ROS_2-Humble%20%7C%20Jazzy-blue?logo=ros)](https://github.com/ros2)<br>[![zenoh](https://img.shields.io/badge/Zenoh-%3E%3D1.0-blue)](https://zenoh.io/) | [![Python](https://github.com/2lian/asyncio-for-robotics/actions/workflows/python-package.yml/badge.svg)](https://github.com/2lian/asyncio-for-robotics/actions/workflows/python-package.yml)<br>[![ROS 2](https://github.com/2lian/asyncio-for-robotics/actions/workflows/ros-pytest.yml/badge.svg)](https://github.com/2lian/asyncio-for-robotics/actions/workflows/ros-pytest.yml) |
55

66
The Asyncio For Robotics (`afor`) library makes `asyncio` usable with ROS 2, Zenoh and more, letting you write linear, testable, and non-blocking Python code.
77

@@ -20,13 +20,7 @@ better, faster code.
2020

2121
### Barebone
2222

23-
```bash
24-
pip install asyncio_for_robotics
25-
```
26-
27-
### For ROS 2
28-
29-
Compatible with: `jazzy`,`humble` and newer. This library is pure python (>=3.10), so it installs easily.
23+
Compatible with ROS 2 (`jazzy`,`humble` and newer) out of the box. This library is pure python (>=3.10), so it installs easily.
3024

3125
```bash
3226
pip install asyncio_for_robotics
@@ -45,6 +39,7 @@ pip install asyncio_for_robotics[zenoh]
4539
- [no talking 🦍 show me code 🦍](https://github.com/2lian/asyncio-for-robotics/blob/main/asyncio_for_robotics/example/ros2_pubsub.py)
4640
- [Usage for software testing](https://github.com/2lian/asyncio-for-robotics/blob/main/tests)
4741
- [Implement your own protocol](https://github.com/2lian/asyncio-for-robotics/blob/main/own_proto_example.md)
42+
- [Cross-Platform deployment even with ROS](https://github.com/2lian/asyncio-for-robotics/blob/main/cross_platform.md) [![Pixi Badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json)](https://pixi.sh)
4843

4944
## Code sample
5045

asyncio_for_robotics/core/_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def setup_logger(debug_path: Optional[str] = None):
9595
"level": "DEBUG",
9696
"formatter": "json",
9797
"filename": (
98-
os.path.expanduser(debug_path) + "/debug.log.jsonl"
98+
os.path.join(os.path.expanduser(debug_path) , "debug.log.jsonl")
9999
if debug_path is not None
100100
else "log.jsonl"
101101
), # path relative to working dir
@@ -106,7 +106,7 @@ def setup_logger(debug_path: Optional[str] = None):
106106
"level": "DEBUG",
107107
"formatter": "user",
108108
"filename": (
109-
os.path.expanduser(debug_path) + "/debug.log"
109+
os.path.join(os.path.expanduser(debug_path) , "debug.log")
110110
if debug_path is not None
111111
else "log"
112112
), # path relative to working dir

cross_platform.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Cross-Platform deployment
2+
3+
| Python <br>`3.10`, `3.11`, <br>`3.12`, `3.13`, <br>`3.14` | ROS 2 <br>`humble`, `jazzy`, <br>`kilted` |
4+
|:---:|:---:|
5+
| `ubuntu`, <br>`windows`, <br>`macos` | `ubuntu`,<br>`windows` |
6+
| [![Python - crossplatform](https://github.com/2lian/asyncio-for-robotics/actions/workflows/python-pixi.yml/badge.svg)](https://github.com/2lian/asyncio-for-robotics/actions/workflows/python-pixi.yml) | [![ROS 2 - crossplatform](https://github.com/2lian/asyncio-for-robotics/actions/workflows/ros-pixi.yml/badge.svg)](https://github.com/2lian/asyncio-for-robotics/actions/workflows/ros-pixi.yml) |
7+
8+
## How?
9+
10+
Asyncio is platform-agnostic, thus `asyncio_for_robotics` should be able to run on any Python... which is the case! Our cross-platform CI tests are verifying that.
11+
12+
Wouldn't it be great if you could just install ROS 2 in a virtual environment on any machine? Then install `asyncio_for_robotics` to be left with only a native python interface able to send messages on ROS?
13+
14+
[The Pixi package manager](https://pixi.sh) allows you to do that! Yes you can use ROS `humble`, `jazzy`, `kilted` on any Linux and even Windows. Pixi shares our vision of making ROS 2 and robotics more accessible.
15+
16+
## Try it out
17+
18+
(You might have PTSD from the ROS installation process, it's okay, don't be scared anymore)
19+
20+
1. Install pixi: https://pixi.sh/latest/installation/
21+
- Linux/Mac: `curl -fsSL https://pixi.sh/install.sh | sh`
22+
- Windows: `powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"`
23+
2. Clone this repo and `cd` inside with you terminal
24+
3. Run the examples! `pixi run -e jazzy python3 -m asyncio_for_robotics.example.ros2_pubsub`
25+
- Installation `pixi install` is done automatically before running.
26+
- You can replace `jazzy` with other ROS distros: `humble`, `jazzy`, `kilted`. Or if you use `zenoh` you will only have zenoh.
27+
28+
29+
## For your project
30+
31+
Do not import, depend or inherit from our `pixi.toml`. Our work is a pure Python package distributed through `PyPI`. However, please take inspiration from our `pixi.toml`, and read the Pixi + Robostack tutorials for your ROS project.
32+
33+
To add ROS 2 and `asyncio_for_robotics` to your Pixi environment, simply to add our `PyPI` dependency to a [ROS Pixi environment](https://pixi.sh/latest/tutorials/ros2/):
34+
35+
```toml
36+
[pypi-dependencies]
37+
asyncio-for-robotics = "*"
38+
```

0 commit comments

Comments
 (0)