From 233d72fa3ab2e279237f8b1269ed8e689b13ca25 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 22 Dec 2024 12:26:13 +0100 Subject: [PATCH 1/6] Document betterproto2 installation --- docs/index.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index c7c2fad3..73c15029 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,41 @@ Home ==== -Welcome to betterproto2-compiler's documentation! +Welcome to `betterproto2_compiler`'s documentation! This page will guide you through the +steps needed to install and use the betterproto2 compiler. + + +## Getting started + +### Install protoc + +The betterproto2 compiler is a plugin of `protoc`, you first need to [install](https://grpc.io/docs/protoc-installation/) it. + +### Install `betterproto2_compiler` + +It is possible to install `betterproto2_compiler` using pip: + +``` +pip install betterproto2_compiler +``` + +### Compile a proto file + +Create the following `example.proto` file. + +```proto +syntax = "proto3"; + +package helloworld; + +message HelloWorld { + string message = 1; +} +``` + +You should now be able to compile it using: + +``` +mkdir lib +./protoc -I . --python_betterproto_out=lib example.proto +``` From d0c07277a833da0a5f5f98d5b3089d4318d26a18 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 22 Dec 2024 12:34:55 +0100 Subject: [PATCH 2/6] Fix protoc path --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 73c15029..ce820c21 100644 --- a/docs/index.md +++ b/docs/index.md @@ -37,5 +37,5 @@ You should now be able to compile it using: ``` mkdir lib -./protoc -I . --python_betterproto_out=lib example.proto +protoc -I . --python_betterproto_out=lib example.proto ``` From 23953406abfeef29f3b14beb0931d07cf7d68731 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 22 Dec 2024 12:56:40 +0100 Subject: [PATCH 3/6] New getting started page --- docs/getting-started.md | 34 ++++++++++++++++++++++++++++++++++ docs/index.md | 39 +-------------------------------------- 2 files changed, 35 insertions(+), 38 deletions(-) create mode 100644 docs/getting-started.md diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 00000000..9ab602fe --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,34 @@ +# Getting started + +## Install protoc + +The betterproto2 compiler is a plugin of `protoc`, you first need to [install](https://grpc.io/docs/protoc-installation/) it. + +## Install `betterproto2_compiler` + +It is possible to install `betterproto2_compiler` using pip: + +``` +pip install betterproto2_compiler +``` + +## Compile a proto file + +Create the following `example.proto` file. + +```proto +syntax = "proto3"; + +package helloworld; + +message HelloWorld { + string message = 1; +} +``` + +You should now be able to compile it using: + +``` +mkdir lib +protoc -I . --python_betterproto_out=lib example.proto +``` diff --git a/docs/index.md b/docs/index.md index ce820c21..0c719b65 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,41 +1,4 @@ Home ==== -Welcome to `betterproto2_compiler`'s documentation! This page will guide you through the -steps needed to install and use the betterproto2 compiler. - - -## Getting started - -### Install protoc - -The betterproto2 compiler is a plugin of `protoc`, you first need to [install](https://grpc.io/docs/protoc-installation/) it. - -### Install `betterproto2_compiler` - -It is possible to install `betterproto2_compiler` using pip: - -``` -pip install betterproto2_compiler -``` - -### Compile a proto file - -Create the following `example.proto` file. - -```proto -syntax = "proto3"; - -package helloworld; - -message HelloWorld { - string message = 1; -} -``` - -You should now be able to compile it using: - -``` -mkdir lib -protoc -I . --python_betterproto_out=lib example.proto -``` +Welcome to `betterproto2_compiler`'s documentation! This site will guide you through the steps needed to install and use the betterproto2 compiler. From 4e953bb22f62e01d5aad270887343ef5f6f39b15 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 22 Dec 2024 12:57:26 +0100 Subject: [PATCH 4/6] Include link to betterproto2 docs --- mkdocs.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index e7089370..86192e02 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Betterproto2 Compiler +site_name: Betterproto2 site_url: https://betterproto.github.io/python-betterproto2-compiler/ theme: name: material @@ -6,6 +6,15 @@ theme: primary: deep orange accent: deep orange + features: + - navigation.tabs + +nav: + - Betterproto2: https://betterproto.github.io/python-betterproto2/ + - Betterproto2 compiler: + - index.md + - Getting started: getting-started.md + plugins: - mkdocstrings From 6ef70214520fe7bb68a5ea52b2586556f5a30cdc Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 22 Dec 2024 12:59:42 +0100 Subject: [PATCH 5/6] Update version in plugin name --- docs/getting-started.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 9ab602fe..fdbd246e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -30,5 +30,5 @@ You should now be able to compile it using: ``` mkdir lib -protoc -I . --python_betterproto_out=lib example.proto +protoc -I . --python_betterproto2_out=lib example.proto ``` diff --git a/pyproject.toml b/pyproject.toml index 3ff9091b..78d67c34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ pytest = "^6.2.5" protobuf = "^4" [tool.poetry.scripts] -protoc-gen-python_betterproto = "betterproto2_compiler.plugin:main" +protoc-gen-python_betterproto2 = "betterproto2_compiler.plugin:main" [tool.ruff] extend-exclude = ["tests/output_*"] From 09c589e3c6d6d1711b2f9ba5ae3ef49cbbc21874 Mon Sep 17 00:00:00 2001 From: Adrien Vannson Date: Sun, 22 Dec 2024 13:08:09 +0100 Subject: [PATCH 6/6] Fix plugin version in test generation --- tests/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/util.py b/tests/util.py index 4f67aaee..075a434b 100644 --- a/tests/util.py +++ b/tests/util.py @@ -46,7 +46,7 @@ async def protoc( ): path: Path = Path(path).resolve() output_dir: Path = Path(output_dir).resolve() - python_out_option: str = "python_betterproto_out" if not reference else "python_out" + python_out_option: str = "python_betterproto2_out" if not reference else "python_out" if pydantic_dataclasses: plugin_path = Path("src/betterproto2_compiler/plugin/main.py")