-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement command line interface #165
Draft
Gobot1234
wants to merge
54
commits into
danielgtaylor:master
Choose a base branch
from
Gobot1234:better-cli-interface
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This means the betterproto plugin no longer needs to depend durectly on protobuf. This requires a small runtime hack to monkey patch some google types to get around the fact that the compiler uses proto2, but betterproto expects proto3. Also: - regenerate google.protobuf package - fix a regex bug in the logic for determining whether to use a google wrapper type. - fix a bug causing comments to get mixed up when multiple proto files generate code into a single python module
- Remove plugin dependency on protobuf since it's no longer required. - Update poethepoet to for better pyproject toml syntax support - Add handy generate_lib poe task for maintaining generated libs
grcp support still needs to be tested but I currently can't do that myself. |
# Conflicts: # tests/test_features.py
# Conflicts: # poetry.lock # pyproject.toml # src/betterproto/plugin/main.py # src/betterproto/plugin/models.py # src/betterproto/plugin/parser.py # tests/inputs/oneof/test_oneof.py # tests/util.py
Gobot1234
commented
Apr 2, 2021
Small update on this and my parsing library, I can successfully parse file inputs using protoc, unfortunately making a run function doesn't appear to be very feasible ATM, but I'm hopeful I can get this figured out relatively quickly. |
# Conflicts: # README.md # pyproject.toml # src/betterproto/plugin/compiler.py # src/betterproto/plugin/main.py # src/betterproto/plugin/models.py # src/betterproto/plugin/parser.py # tests/generate.py # tests/test_features.py # tests/util.py
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements a command line interface for the module abstracting away the use of protoc to under the hood.
Objectives
How to improve current implementation
Custom options
Backwards compatibility
This is obviously important. I plan to achieve this with an ENV var which will determine whether or not protoc was invoked with the plugin if it wasn't invoked with protoc I would like to display a warning saying that direct invocation of protoc is depreciated and the command they could use in the future.
Programmatic access
I plan to make a few functions accessible using the betterproto API under the name
compile_protobufs
in the plugin package using https://github.com/Gobot1234/protobuf-parser.TODO:
Main entry point for compilation is with
betterproto compile
this will make it potentially easier to add custom arguments for compilation down the road and makes invocation much simpler as with the old system you would have to run:Whereas now it is: