Skip to content

Add option for include directories#5

Closed
shumpohl wants to merge 2 commits intonanoporetech:mainfrom
shumpohl:includes
Closed

Add option for include directories#5
shumpohl wants to merge 2 commits intonanoporetech:mainfrom
shumpohl:includes

Conversation

@shumpohl
Copy link

@shumpohl shumpohl commented Feb 10, 2025

This PR adds an option for passing additional include directories to protoc.

I only tested it for my usecase.

This should probably be thought together with #4

The naming is confusing because it is proto_path but without adding the sources.

Copy link
Member

@amerry amerry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it's taken me a while to get to this - it turns out I didn't have notifications enabled for this repo.

args.append(f"--{generator.name}_out={generator.output_path}")

for include in self._includes:
args.append(f"-I{include}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rather use --proto_path like with self._proto_paths above (and also either merge it with that loop or put it immediately next to that loop) - -I and --proto_path do the same thing, but i'd like to be consistent about which we use

| `generate_pyi` | `true` | Whether to generate .pyi output files. Note that these are not generated for the gRPC output. You may want to use mypy-protobuf instead. |
| `proto_paths` | `["."]` or `["src"]` | An array of paths to search for `.proto` files. Also passed as `--proto_path` arguments to `protoc`. |
| `output_path` | `"."` or `"src"` | The default output directory. This can be overridden on a per-generator basis for custom generators. |
| `includes` | `[]` | Additional include directories to pass to `protoc` via `-I` flag. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with my other comment, I'd like to be consistent about using -I vs --proto_path. I think it would also be worth explicitly stating (either in the table or below it) that proto_paths and includes both add to the list of places that protoc searches for includes, but only files in proto_paths will be generated into code

@amerry amerry self-assigned this Mar 20, 2025
@amerry
Copy link
Member

amerry commented Jun 4, 2025

this functionality has been covered by #14

@amerry amerry closed this Jun 4, 2025
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.

2 participants