Skip to content

Adding --proto-package-prefix to .proto Skymarshal generation - #477

Closed
james-clarke-skydio wants to merge 2 commits into
symforce-org:mainfrom
james-clarke-skydio:proto-package-prefix
Closed

james-clarke-skydio wants to merge 2 commits into
symforce-org:mainfrom
james-clarke-skydio:proto-package-prefix

Conversation

@james-clarke-skydio

@james-clarke-skydio james-clarke-skydio commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Similar to how Skymarshal already supports --python-package-prefix when generating namespaced python files, this does the same for .proto files without touching the original .lcm source file(s).

Currently there is no proto equivalent, and if we want to provide a different package prefix in the upstream service(s) needing this functionality, we need this added. Luckily, this should follow similarly to how it was done for Python.

A few small, additive changes in emit_proto.py:

  1. New --proto-package-prefix CLI arg (defaults to None — no behavior change if unset).
  2. EnumType.proto_package and StructType.proto_package prepend the prefix when set.
  3. create_files copies args and swaps in the override before rendering, leaving the shared args object untouched.
  4. EnumType.proto_filename and StructType.proto_filename skip the <package>/pbtypes/ subdirectory when set, writing directly under --proto-path.
  5. New --proto-flat-output CLI arg (defaults to None - no behavior change), used when generating protos from .lcm files.

Verified locally:

  • without the --proto-package-prefix flag, output is unchanged (package api)
  • with --proto-package-prefix skydio, output is package skydio.api;
  • without the --proto-flat-output flag, output is unchanged (<proto-path>/<package>/pbtypes/<file>.proto)
  • with --proto-flat-output, output is <proto-path>/<file>.proto
  • combines correctly with --proto-package-prefix (both flags together produce the expected flat, prefixed output)
  • Fully backward-compatible — no existing callers are affected.

@james-clarke-skydio james-clarke-skydio changed the title Adding for files Adding --proto-package-prefix to .proto Skymarshal generation Oct 12, 2026
@james-clarke-skydio

Copy link
Copy Markdown
Contributor Author

Closing in favor of making this change elsewhere and separately pushing it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant