Skip to content

Commit

Permalink
feat: add proto_prefix.py
Browse files Browse the repository at this point in the history
Adds a script that can rewrite the protobuf files with a namespace
prefix, such as arrow.substrait. When public libraries generate their
own internal bindings and don't do this, users of said libraries can
get nasty surprises from the protobuf library (segfaults,
incomprehensible exceptions, or just wrong behavior) if there is even
the slightest difference between different instances of the substrait
namespace, even if those differences are otherwise just non-breaking
changes.
  • Loading branch information
jvanstraten committed Dec 7, 2022
1 parent 7f272f1 commit 886adf5
Show file tree
Hide file tree
Showing 4 changed files with 434 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401
max-line-length = 88
select = B,C,E,F,W,T4,B9
26 changes: 26 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,29 @@ jobs:
with:
node-version: "16"
- run: ./ci/release/dry_run.sh
python-style:
name: Style-check and lint Python files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: python3 -m pip install --upgrade pip black==22.3.0 flake8==4.0.1
- name: Black
run: python3 -m black --diff --check .
- name: Flake8
run: python3 -m flake8 .
check-proto-prefix:
name: Check proto-prefix.py
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bufbuild/[email protected]
- name: Run proto-prefix.py
run: tools/proto_prefix.py output test proto go_package=github.com/test/proto
- name: Modify buf config to build rewritten proto files
run: |
echo "version: v1" > buf.work.yaml
echo "directories:" >> buf.work.yaml
echo " - output" >> buf.work.yaml
- name: Compile rewritten proto files
run: buf generate
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ repos:
hooks:
- id: commitlint
stages: [commit-msg]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
Loading

0 comments on commit 886adf5

Please sign in to comment.