Skip to main content

martypy

Python library to communicate with Marty the Robot V1 and V2 by Robotical

See the API Documentation

To regenerate documentation:

  • pip install -r dev-requirements.txt
  • pydoc-markdown --server --open
  • markdown_mmd api-documentation-edited.md -t dokuwiki -o docs-wiki.wiki OR, automatically:
  • run docgen.bat (or docgen.sh on Mac/Linux) from Python environment (will also create a docs-wiki.wiki file with the dokuwiki format)

NOTE: Make sure pandoc is installed on your system to generate the dokuwiki documentation. You can install pandoc from here

How to run example scripts

If you cloned the repository or downloaded the source code to try the example scripts, you will need to make sure you have MartyPy installed before you can run the examples.

The easiest way to install MartyPy is with the pip install martypy script as explained in step 2 here.

Once martypy is installed you can run each example using python. The following (for the dance example) assumes you have connected your marty using the USB cable to a Windows computer

python example_dance.py USB

To run the sound example over WiFi when your Marty is connected on IP address 192.168.86.10, use:

python example_sound.py WiFi 192.168.0.10

If you would like to make modifications to the martypy library itself, it will be better to install it from source using the command pip install --editable /path/to/martypy/repo (replacing /path/to/martypy/repo as appropriate of course).

If you do not want to "pip install" the MartyPy library, you can add the following 4 lines at the top (before any other code) of each script you want to run:

import sys
import pathlib
cur_path = pathlib.Path(__file__).parent.resolve()
sys.path.append(str(cur_path.parent.resolve()))

Speak and Translate

The Speak and Translate APIs use Robotical's online services and require an internet connection. Pip installs the speech audio components (miniaudio and lameenc) automatically, including codecs and computer playback support. Their prebuilt wheels bundle the native audio code on supported Windows, macOS and Linux systems, so no separate FFmpeg, ffplay, Homebrew installation or PATH configuration is needed.

my_marty.set_voice("FEMALE")        # Also MALE, KITTEN, ALIEN, GIANT, BOLT, STARLIGHT, WHIRLWIND
my_marty.set_voice_speed(1.5)       # 0.1 to 2; 1 is normal speed
my_marty.set_speech_language("fr") # Accent; does not translate the words
words = my_marty.translate("Hello", "fr")
my_marty.speak(words, blocking=True)  # Marty's speaker
my_marty.speak_on_computer(words)     # Computer speaker; waits until finished
print(my_marty.get_language())        # Computer language name

Speech settings persist until changed. Explicit voice, language and speed arguments to speak/speak_on_computer override them for that call. Translation returns text, not speech, and raises an error if its online request fails. In Blocks, the matching calls use the existing browser extensions, and get_language reports the editor's language instead of the computer's Python locale. Browser speech uses the browser audio system.

Publishing

  • Update version: keep setup.py and martypy/__init__.py in sync and update CHANGES.md.
  • Push changes: commit and push to GitHub.
  • Publish: in GitHub Actions, manually run the "Publish to PyPI" workflow.

Metadata

Release files for martypy 3.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for martypy 3.8.1
File Size Uploaded Provenance Actions
martypy-3.8.1.tar.gz 79.8 kB With provenance Details for martypy-3.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for martypy 3.8.1
File Interpreter ABI Platform Actions
martypy-3.8.1-py3-none-any.whl Python 3 none any Details for martypy-3.8.1-py3-none-any.whl

Total release size: 166.9 kB

Release files / martypy-3.8.1.tar.gz

Download URL martypy-3.8.1.tar.gz
Size 79.8 kB
Tags Source
SHA-256 checksum
How to use checksums
42229a4d69a7d502216f6d049fa9cf48b3b97ff47c4a96c084744ae590d91a3a
BLAKE2b-256 checksum
How to use checksums
6a5a159ef86653ed4a71ace1fcd25c6221178d7e5734df67d0c85edf165319a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / martypy-3.8.1-py3-none-any.whl

Download URL martypy-3.8.1-py3-none-any.whl
Size 87.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c62a3d9c7786c0b2d1bcb682ef38af812724fada3bcab3b67b8272e19565e53
BLAKE2b-256 checksum
How to use checksums
a951ad66e40674d63ecdd10ddbbab1cd2a5883f099d88273f9430747c52250dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for martypy 3.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for martypy-3.8.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.8.1 This release

2 release files Full provenance

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