diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 00000000..fdbd246e --- /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_betterproto2_out=lib example.proto +``` diff --git a/docs/index.md b/docs/index.md index c7c2fad3..0c719b65 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,4 +1,4 @@ Home ==== -Welcome to betterproto2-compiler's documentation! +Welcome to `betterproto2_compiler`'s documentation! This site will guide you through the steps needed to install and use the betterproto2 compiler. 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 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_*"] 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")