Skip to content

Commit 7723218

Browse files
Upgrade to Pants 2.10.dev3
The main change is switching to the new `[python].enable_resolves`, which allows us to have Pants generate the lockfile for us and use `--hash`! This also applies pantsbuild/example-python#90.
2 parents 6f3be4b + f4fbfeb commit 7723218

8 files changed

Lines changed: 66 additions & 37 deletions

File tree

.github/workflows/pants.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ubuntu-latest
2828
strategy:
2929
matrix:
30-
python-version: [3.7]
30+
python-version: [3.8]
3131
steps:
3232
- uses: actions/checkout@v2
3333
- uses: actions/cache@v2

3rdparty/python/constraints.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

3rdparty/python/default_lock.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This lockfile was autogenerated by Pants. To regenerate, run:
2+
#
3+
# ./pants generate-lockfiles --resolve=python-default
4+
#
5+
# --- BEGIN PANTS LOCKFILE METADATA: DO NOT EDIT OR REMOVE ---
6+
# {
7+
# "version": 2,
8+
# "valid_for_interpreter_constraints": [
9+
# "CPython<3.11,>=3.8"
10+
# ],
11+
# "generated_with_requirements": [
12+
# "protobuf>=3.19.0",
13+
# "thrift==0.15.0"
14+
# ]
15+
# }
16+
# --- END PANTS LOCKFILE METADATA ---
17+
18+
protobuf==3.19.4; python_version >= "3.5" \
19+
--hash=sha256:f51d5a9f137f7a2cec2d326a74b6e3fc79d635d69ffe1b036d39fc7d75430d37 \
20+
--hash=sha256:09297b7972da685ce269ec52af761743714996b4381c085205914c41fcab59fb \
21+
--hash=sha256:072fbc78d705d3edc7ccac58a62c4c8e0cec856987da7df8aca86e647be4e35c \
22+
--hash=sha256:7bb03bc2873a2842e5ebb4801f5c7ff1bfbdf426f85d0172f7644fcda0671ae0 \
23+
--hash=sha256:f358aa33e03b7a84e0d91270a4d4d8f5df6921abe99a377828839e8ed0c04e07 \
24+
--hash=sha256:1c91ef4110fdd2c590effb5dca8fdbdcb3bf563eece99287019c4204f53d81a4 \
25+
--hash=sha256:c438268eebb8cf039552897d78f402d734a404f1360592fef55297285f7f953f \
26+
--hash=sha256:835a9c949dc193953c319603b2961c5c8f4327957fe23d914ca80d982665e8ee \
27+
--hash=sha256:4276cdec4447bd5015453e41bdc0c0c1234eda08420b7c9a18b8d647add51e4b \
28+
--hash=sha256:6cbc312be5e71869d9d5ea25147cdf652a6781cf4d906497ca7690b7b9b5df13 \
29+
--hash=sha256:54a1473077f3b616779ce31f477351a45b4fef8c9fd7892d6d87e287a38df368 \
30+
--hash=sha256:435bb78b37fc386f9275a7035fe4fb1364484e38980d0dd91bc834a02c5ec909 \
31+
--hash=sha256:16f519de1313f1b7139ad70772e7db515b1420d208cb16c6d7858ea989fc64a9 \
32+
--hash=sha256:cdc076c03381f5c1d9bb1abdcc5503d9ca8b53cf0a9d31a9f6754ec9e6c8af0f \
33+
--hash=sha256:69da7d39e39942bd52848438462674c463e23963a1fdaa84d88df7fbd7e749b2 \
34+
--hash=sha256:48ed3877fa43e22bcacc852ca76d4775741f9709dd9575881a373bd3e85e54b2 \
35+
--hash=sha256:bd95d1dfb9c4f4563e6093a9aa19d9c186bf98fa54da5252531cc0d3a07977e7 \
36+
--hash=sha256:b38057450a0c566cbd04890a40edf916db890f2818e8682221611d78dc32ae26 \
37+
--hash=sha256:7ca7da9c339ca8890d66958f5462beabd611eca6c958691a8fe6eccbd1eb0c6e \
38+
--hash=sha256:36cecbabbda242915529b8ff364f2263cd4de7c46bbe361418b5ed859677ba58 \
39+
--hash=sha256:c1068287025f8ea025103e37d62ffd63fec8e9e636246b89c341aeda8a67c934 \
40+
--hash=sha256:96bd766831596d6014ca88d86dc8fe0fb2e428c0b02432fd9db3943202bf8c5e \
41+
--hash=sha256:84123274d982b9e248a143dadd1b9815049f4477dc783bf84efe6250eb4b836a \
42+
--hash=sha256:3112b58aac3bac9c8be2b60a9daf6b558ca3f7681c130dcdd788ade7c9ffbdca \
43+
--hash=sha256:8961c3a78ebfcd000920c9060a262f082f29838682b1f7201889300c1fbe0616 \
44+
--hash=sha256:9df0c10adf3e83015ced42a9a7bd64e13d06c4cf45c340d2c63020ea04499d0a
45+
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" \
46+
--hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 \
47+
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926
48+
thrift==0.15.0 \
49+
--hash=sha256:87c8205a71cf8bbb111cb99b1f7495070fbc9cabb671669568854210da5b3e29

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
# example-codegen
2+
23
An example repository to demonstrate codegen support in Pants.
4+
5+
Refer to these docs for more information:
6+
7+
* [Python Protobuf](https://www.pantsbuild.org/docs/protobuf-python
8+
* [Python Thrift](https://www.pantsbuild.org/docs/protobuf-python
9+
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.

pants.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[GLOBAL]
2-
pants_version = "2.10.0.dev2"
2+
pants_version = "2.10.0.dev3"
33
backend_packages = [
44
"pants.backend.codegen.protobuf.python",
55
"pants.backend.experimental.codegen.thrift.apache.python",
@@ -16,15 +16,11 @@ enabled = true
1616
repo_id = "205E301D-44A4-42FF-8495-C9D41871A431"
1717

1818
[python]
19-
interpreter_constraints = ["CPython>=3.8,<3.10"]
19+
interpreter_constraints = ["CPython>=3.8,<3.11"]
20+
enable_resolves = true
2021

2122
[python-protobuf]
22-
runtime_dependencies = [
23-
"3rdparty/python#protobuf",
24-
]
23+
runtime_dependencies = ["3rdparty/python#protobuf"]
2524

2625
[python-thrift]
27-
runtime_dependencies = [
28-
"3rdparty/python#thrift",
29-
]
30-
26+
runtime_dependencies = ["3rdparty/python#thrift"]

pants_from_sources

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,7 @@ PANTS_SOURCE="${PANTS_SOURCE:-../pants}"
1616
# you won't want pantsd running. You can override this by setting ENABLE_PANTSD=true.
1717
ENABLE_PANTSD="${ENABLE_PANTSD:-false}"
1818

19-
backend_packages=(
20-
)
21-
22-
pythonpath=(
23-
)
24-
25-
plugins=(
26-
)
27-
28-
function string_list() {
29-
eval local -r list_variable="\${$1[@]}"
30-
31-
echo -n "["
32-
for item in ${list_variable}; do
33-
echo -n "\"${item}\","
34-
done
35-
echo -n "]"
36-
}
37-
3819
export PANTS_VERSION="$(cat "${PANTS_SOURCE}/src/python/pants/VERSION")"
39-
export PANTS_PLUGINS="$(string_list plugins)"
40-
export PANTS_PYTHONPATH="+$(string_list pythonpath)"
41-
export PANTS_BACKEND_PACKAGES="+$(string_list backend_packages)"
4220
export PANTS_PANTSD="${ENABLE_PANTSD}"
4321
export no_proxy="*"
4422

src/python/protobuf_examples/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python_tests(dependencies=["src/protobuf/simple_example"])
1+
python_tests()

src/python/thrift_examples/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python_tests(dependencies=["//src/thrift:thrift"])
1+
python_tests(dependencies=["src/thrift:thrift"])

0 commit comments

Comments
 (0)