Skip to content

greybeam/capnp-stub-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stub-file generator for cap'n proto schemas

Generates Python stubs files from cap'n proto schemas. Useful for IDE auto-completion and static type checking.

Fork of a fork

This fork is a big hammer to slam nails down and make good enough generated stubs ignoring build errors, we may attempt to upstream the "fixes" made here but it is unlikely.

Usage

Clone and install with pip:

pip install capnp-stub-generator

Run on a set of files:

capnp-stub-generator -p "path/to/capnp/schemas/**/*.capnp" \
    -c "path/to/output/directory/**/*_capnp.py" "path/to/output/directory/**/*_capnp.pyi" \
    -e "**/c-capnproto/**/*.capnp" \
    -r

where the options are

  • -p - search paths that contain schema files
  • -c - cleanup paths (delete matching files before generation)
  • -e - exclude paths that shall not be converted to stubs
  • -r - recursive file search

Currently, stub files are always created adjacent to schema files.

For a runnable example, see the test generation script.

Style and packaging

This repository is a fork from a company-internal repository. Issues can be reported here, will be fixed upstream, and backported. Therefore, this repository does not (yet) contain a style checking and packaging pipeline.

The repository may become independent in the future.

Releases

No releases published

Packages

No packages published

Languages

  • Python 70.8%
  • Cap'n Proto 29.2%