Skip to content

Commit 3f1e08f

Browse files
Upgrade to 2.11 and use Buf (#13)
1 parent e79d331 commit 3f1e08f

6 files changed

Lines changed: 18 additions & 16 deletions

File tree

.github/workflows/pants.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ jobs:
4949
./pants --version
5050
- name: Check BUILD files
5151
run: ./pants tailor --check update-build-files --check
52-
- name: Test
52+
- name: Lint and test
5353
run: |
54-
./pants test ::
54+
./pants lint test ::

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ An example repository to demonstrate codegen support in Pants.
44

55
Refer to these docs for more information:
66

7-
* [Python Protobuf](https://www.pantsbuild.org/v2.10/docs/protobuf-python)
8-
* [Python Thrift](https://www.pantsbuild.org/v2.10/docs/thrift-python)
7+
* [Python Protobuf](https://www.pantsbuild.org/docs/protobuf-python)
8+
* [Python Thrift](https://www.pantsbuild.org/docs/thrift-python)
99

10-
Run `./pants export-codegen ::` to see the generated files. This isn't necessary for Pants to
11-
use the generated files, but can be useful when debugging or to generate files for IDEs.
10+
Some commands you can try out:
11+
12+
* `./pants export-codegen ::` - see the generated files.
13+
* This isn't necessary for Pants to use the generated files, but can be useful when
14+
debugging or to generate files for IDEs.
15+
* `./pants test ::` - run all tests
16+
* `./pants fmt ::` - format Protobuf with `buf`
17+
* `./pants lint ::` - lint Protobuf with `buf`
18+
* `./pants dependencies <path/to/file>` - see what depends on what
1219

1320
Check out our other [example repositories](https://www.pantsbuild.org/docs/example-repos) to see
14-
other features like running linters and formatters, and packaging binaries.
21+
other features like packaging binaries.

pants.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
[GLOBAL]
2-
pants_version = "2.10.0"
2+
pants_version = "2.11.0rc3"
33
backend_packages = [
4+
"pants.backend.codegen.protobuf.lint.buf",
45
"pants.backend.codegen.protobuf.python",
56
"pants.backend.codegen.thrift.apache.python",
67
"pants.backend.python",
78
]
89

9-
# This will become the default in 2.11, and is only explicitly set to not break
10-
# backwards-compatibility for existing users. If you are setting up Pants for
11-
# the first time, set this to false.
12-
use_deprecated_python_macros = false
13-
1410
[anonymous-telemetry]
1511
enabled = true
1612
repo_id = "205E301D-44A4-42FF-8495-C9D41871A431"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
syntax = "proto3";
22

3-
package simple_example;
3+
package simple_example.v1;
44

55
message Person {
66
string name = 1;
77
int32 id = 2;
88
string email = 3;
99
}
10-

src/python/protobuf_examples/simple_example_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from simple_example.person_pb2 import Person
1+
from simple_example.v1.person_pb2 import Person
22

33
def test_person() -> None:
44
p = Person()

0 commit comments

Comments
 (0)