Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit b96e38a

Browse files
Documentation: better design, add installation instructions (#11)
* Document betterproto2 installation * Fix protoc path * New getting started page * Include link to betterproto2 docs * Update version in plugin name * Fix plugin version in test generation
1 parent 6c759a1 commit b96e38a

File tree

5 files changed

+47
-4
lines changed

5 files changed

+47
-4
lines changed

docs/getting-started.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Getting started
2+
3+
## Install protoc
4+
5+
The betterproto2 compiler is a plugin of `protoc`, you first need to [install](https://grpc.io/docs/protoc-installation/) it.
6+
7+
## Install `betterproto2_compiler`
8+
9+
It is possible to install `betterproto2_compiler` using pip:
10+
11+
```
12+
pip install betterproto2_compiler
13+
```
14+
15+
## Compile a proto file
16+
17+
Create the following `example.proto` file.
18+
19+
```proto
20+
syntax = "proto3";
21+
22+
package helloworld;
23+
24+
message HelloWorld {
25+
string message = 1;
26+
}
27+
```
28+
29+
You should now be able to compile it using:
30+
31+
```
32+
mkdir lib
33+
protoc -I . --python_betterproto2_out=lib example.proto
34+
```

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Home
22
====
33

4-
Welcome to betterproto2-compiler's documentation!
4+
Welcome to `betterproto2_compiler`'s documentation! This site will guide you through the steps needed to install and use the betterproto2 compiler.

mkdocs.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
site_name: Betterproto2 Compiler
1+
site_name: Betterproto2
22
site_url: https://betterproto.github.io/python-betterproto2-compiler/
33
theme:
44
name: material
55
palette:
66
primary: deep orange
77
accent: deep orange
88

9+
features:
10+
- navigation.tabs
11+
12+
nav:
13+
- Betterproto2: https://betterproto.github.io/python-betterproto2/
14+
- Betterproto2 compiler:
15+
- index.md
16+
- Getting started: getting-started.md
17+
918
plugins:
1019
- mkdocstrings
1120

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pytest = "^6.2.5"
3434
protobuf = "^4"
3535

3636
[tool.poetry.scripts]
37-
protoc-gen-python_betterproto = "betterproto2_compiler.plugin:main"
37+
protoc-gen-python_betterproto2 = "betterproto2_compiler.plugin:main"
3838

3939
[tool.ruff]
4040
extend-exclude = ["tests/output_*"]

tests/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def protoc(
4646
):
4747
path: Path = Path(path).resolve()
4848
output_dir: Path = Path(output_dir).resolve()
49-
python_out_option: str = "python_betterproto_out" if not reference else "python_out"
49+
python_out_option: str = "python_betterproto2_out" if not reference else "python_out"
5050

5151
if pydantic_dataclasses:
5252
plugin_path = Path("src/betterproto2_compiler/plugin/main.py")

0 commit comments

Comments
 (0)