Skip to main content

A Python stub generator from genmsg specs

Project description

A Python stub generator from genmsg specs

Installation

pip install genmypy

Usage

catkin

Add genmypy along with message_generation to find_package in CMakeLists.txt. genmsg will find genmypy automatically when building msg/srv files.

Also, keep in mind that your package should have the build dependency for genmypy in package.xml to make sure that catkin finishes the build of genmypy before building your package.

Examples:

  • CMakeLists.txt
    find_package(catkin REQUIRED COMPONENTS std_msgs message_generation genmypy)
  • package.xml
    <build_depend>genmypy</build_depend>

CLI

$ genmypy --help
Usage: genmypy [-h] {msg,srv,module} ...
positional arguments:
  {msg,srv,module}
    msg             Generate stub files from .msg files
    srv             Generate stub files from .srv files
    module          Generate __init__.pyi from a msg/srv directory

optional arguments:
  -h, --help        show this help message and exit

Examples:

# Message files
$ genmypy msg custom_msgs custom_msgs/msg/Custom.msg
$ genmypy msg std_msgs --out-dir out /opt/ros/melodic/share/std_msgs/msg/Header.msg
$ genmypy msg sensor_msgs --out-dir out \
    -Istd_msgs:/opt/ros/melodic/share/std_msgs/msg \
    -Isensor_msgs:/opt/ros/melodic/share/sensor_msgs/msg \
    /opt/ros/melodic/share/sensor_msgs/msg/PointCloud2.msg

# Service files
$ genmypy srv custom_msgs custom_msgs/srv/Custom.msg
$ genmypy srv nav_msgs --out-dir out \
    -Istd_msgs:/opt/ros/melodic/share/std_msgs/msg \
    -Isensor_msgs:/opt/ros/melodic/share/sensor_msgs/msg \
    /opt/ros/melodic/share/sensor_msgs/srv/SetCameraInfo.srv

# Module files
$ genmypy module custom_msgs/msg
$ genmypy module --module-finder py --out out \
    /opt/ros/melodic/lib/python2.7/dist-packages/std_msgs/msg/

genmypy msg / genmypy srv:

Usage: genmypy {msg,srv} [-h] [--out-dir OUT_DIR]
                        [--include-path INCLUDE_PATH]
                        package files [files ...]

positional arguments:
  package               Package name of given files
  files                 Files to generate stubs

optional arguments:
  -h, --help            show this help message and exit
  --out-dir OUT_DIR     Output directory. If the option is unset, each stub
                        file will be generated in the same directory as each
                        input.
  --include-path INCLUDE_PATH, -I INCLUDE_PATH
                        Include paths for processing given files

genmypy module:

Usage: genmypy module [-h] [--out-dir OUT_DIR] package_dir

Positional arguments:
  package_dir        Package directory to create __init__.pyi

Optional arguments:
  -h, --help         show this help message and exit
  --out-dir OUT_DIR  Output directory. If the option is unset, __init__.pyi
                     will be generated in the same directory as package_dir.

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

genmypy-0.3.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

genmypy-0.3.0-py2.py3-none-any.whl (22.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file genmypy-0.3.0.tar.gz.

File metadata

  • Download URL: genmypy-0.3.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for genmypy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 038a8c7d31cf9a6f4cad1b79cf83666c38b34169482c3fa52094b1ecd6b42185
MD5 f9d3440178055281d8c104025d23ffdd
BLAKE2b-256 6155a46ac7265ed748b2d263134c61164152713509279706c5fc083f12f5c173

See more details on using hashes here.

File details

Details for the file genmypy-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: genmypy-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for genmypy-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 53fb12627fb683770d3b28cdcbd040e80b2edf0e9043490da22ae8c3819aeed7
MD5 720caf6dc4ba5f08eb528be78d109f4e
BLAKE2b-256 6553aff6c31493b697ed7db5222ff434625f5291e61a3af0ad51ab052d4e9de4

See more details on using hashes here.

Supported by

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