Skip to content

Commit 74f1ce1

Browse files
committed
feat: add proper Python module structure and uv/pyproject.toml support
Based on @carlosdp's PR unitreerobotics#107. - Add __init__.py files to all subpackages for proper Python module resolution - Migrate from setup.py to pyproject.toml with full project metadata - Add cyclonedds pre-built wheel dependencies for macOS (x86_64/arm64) and Linux (x86_64/aarch64) - Add fastcrc, numpy, opencv-python as project dependencies - Add a note to README explaining the fork origin and changes - Update .gitignore for Python packaging artifacts https://claude.ai/code/session_01Er2d4LqFWhD6J43Jkn8vfW
1 parent 18b9ef8 commit 74f1ce1

23 files changed

Lines changed: 50 additions & 24 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ __pycache__
3636
.idea/
3737

3838
# python
39-
dist/
39+
dist/
40+
41+
uv.lock

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# unitree_sdk2_python
2+
3+
> **Note:** This is a fork of [unitreerobotics/unitree_sdk2_python](https://github.com/unitreerobotics/unitree_sdk2_python) with modern Python packaging support (`pyproject.toml` + [uv](https://github.com/astral-sh/uv)). The changes are based on [@carlosdp](https://github.com/carlosdp)'s [PR #107](https://github.com/unitreerobotics/unitree_sdk2_python/pull/107), which replaces `setup.py` with `pyproject.toml`, uses pre-built [cyclonedds wheels](https://github.com/carlosdp/cyclonedds-python/releases) (no manual C compilation needed), and swaps platform-specific CRC `.so` binaries for the cross-platform [`fastcrc`](https://pypi.org/project/fastcrc/) package.
4+
25
Python interface for unitree sdk2
36

47
# Installation

pyproject.toml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
[project]
2+
name = "unitree_sdk2py"
3+
version = "1.0.1"
4+
description = "Unitree robot sdk version 2 for python"
5+
readme = { file = "README.md", content-type = "text/markdown" }
6+
requires-python = ">=3.11"
7+
license = { text = "BSD-3-Clause" }
8+
authors = [
9+
{ name = "UnitreeRobotics", email = "unitree@unitree.com" }
10+
]
11+
dependencies = [
12+
# macOS x86_64
13+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp311-cp311-macosx_10_9_x86_64.whl ; python_version >= '3.11' and python_version < '3.12' and sys_platform == 'darwin' and platform_machine == 'x86_64'",
14+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp312-cp312-macosx_10_9_x86_64.whl ; python_version >= '3.12' and python_version < '3.13' and sys_platform == 'darwin' and platform_machine == 'x86_64'",
15+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp313-cp313-macosx_10_13_x86_64.whl ; python_version >= '3.13' and python_version < '3.14' and sys_platform == 'darwin' and platform_machine == 'x86_64'",
16+
17+
# macOS arm64
18+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp311-cp311-macosx_11_0_arm64.whl ; python_version >= '3.11' and python_version < '3.12' and sys_platform == 'darwin' and platform_machine == 'arm64'",
19+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp312-cp312-macosx_11_0_arm64.whl ; python_version >= '3.12' and python_version < '3.13' and sys_platform == 'darwin' and platform_machine == 'arm64'",
20+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp313-cp313-macosx_11_0_arm64.whl ; python_version >= '3.13' and python_version < '3.14' and sys_platform == 'darwin' and platform_machine == 'arm64'",
21+
22+
# Linux aarch64 (manylinux)
23+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl ; python_version >= '3.11' and python_version < '3.12' and sys_platform == 'linux' and platform_machine == 'aarch64'",
24+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl ; python_version >= '3.12' and python_version < '3.13' and sys_platform == 'linux' and platform_machine == 'aarch64'",
25+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl ; python_version >= '3.13' and python_version < '3.14' and sys_platform == 'linux' and platform_machine == 'aarch64'",
26+
27+
# Linux x86_64 (manylinux)
28+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl ; python_version >= '3.11' and python_version < '3.12' and sys_platform == 'linux' and platform_machine == 'x86_64'",
29+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl ; python_version >= '3.12' and python_version < '3.13' and sys_platform == 'linux' and platform_machine == 'x86_64'",
30+
"cyclonedds @ https://github.com/carlosdp/cyclonedds-python/releases/download/0.10.5/cyclonedds-0.10.5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl ; python_version >= '3.13' and python_version < '3.14' and sys_platform == 'linux' and platform_machine == 'x86_64'",
31+
32+
"fastcrc>=0.3.2",
33+
"numpy",
34+
"opencv-python",
35+
]
36+
37+
[project.urls]
38+
"Source Code" = "https://github.com/unitreerobotics/unitree_sdk2_python"
39+
140
[build-system]
2-
requires = ["setuptools", "wheel"]
3-
build-backend = "setuptools.build_meta"
41+
requires = ["setuptools>=64", "wheel"]
42+
build-backend = "setuptools.build_meta"
43+
44+
[tool.setuptools.packages.find]
45+
include = ["unitree_sdk2py", "unitree_sdk2py.*"]

setup.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

unitree_sdk2py/b2/__init__.py

Whitespace-only changes.

unitree_sdk2py/b2/back_video/__init__.py

Whitespace-only changes.

unitree_sdk2py/b2/front_video/__init__.py

Whitespace-only changes.

unitree_sdk2py/b2/robot_state/__init__.py

Whitespace-only changes.

unitree_sdk2py/b2/sport/__init__.py

Whitespace-only changes.

unitree_sdk2py/b2/vui/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)