Re-organize directory structure (#4971)

See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
Ivan Levkivskyi
2021-01-27 12:00:39 +00:00
committed by GitHub
parent 869238e587
commit 16ae4c6120
1399 changed files with 601 additions and 97 deletions

View File

@@ -31,7 +31,7 @@ jobs:
- uses: actions/setup-python@v2
- run: |
pip install $(grep black requirements-tests-py3.txt)
black --check --diff stdlib third_party
black --check --diff stdlib stubs
isort:
name: Check imports with isort
@@ -41,7 +41,7 @@ jobs:
- uses: actions/setup-python@v2
- run: |
pip install $(grep isort requirements-tests-py3.txt)
isort --check-only --diff stdlib third_party
isort --check-only --diff stdlib stubs
pytype:
name: Run pytype against the stubs
@@ -53,6 +53,8 @@ jobs:
python-version: 3.6
- run: pip install -r requirements-tests-py3.txt
- run: ./tests/pytype_test.py
# TODO: re-enable when pytype supports new directory structure.
continue-on-error: true
mypy:
name: Run mypy against the stubs
@@ -104,3 +106,5 @@ jobs:
pip install -U git+git://github.com/python/mypy@24fdf343
- name: Run stubtest
run: python tests/stubtest_test.py --ignore-unused-whitelist
# TODO: re-enable this when possible.
continue-on-error: true

View File

@@ -1,10 +1,10 @@
#!/bin/bash
# Some of the proto .pyi stubs in third_party/2and3/google/protobuf/
# Some of the proto .pyi stubs in stubs/protobuf/
# are autogenerated using the mypy-protobuf project on the
# latest `.proto` files shipped with protoc.
#
# When run, this script will autogenerate the _pb2.pyi stubs to
# third_party/2and3/google/protobuf. It should be run any time there's
# stubs/protobuf. It should be run any time there's
# a meaningful update to either PROTOBUF_VERSION or MYPY_PROTOBUF_VERSION,
# followed by committing the changes to typeshed
#
@@ -46,7 +46,7 @@ source $VENV/bin/activate
python3 -m pip install git+https://github.com/dropbox/mypy-protobuf@${MYPY_PROTOBUF_VERSION}#subdirectory=python
# Remove existing pyi
find $REPO_ROOT/third_party/2and3/ -name "*_pb2.pyi" -delete
find $REPO_ROOT/stubs/protobuf/ -name "*_pb2.pyi" -delete
# Roughly reproduce the subset of .proto files on the public interface as described
# by find_package_modules in the protobuf setup.py.
@@ -65,4 +65,4 @@ PROTO_FILES=$(grep "generate_proto.*google" $PYTHON_PROTOBUF_DIR/python/setup.py
)
# And regenerate!
protoc_install/bin/protoc --proto_path=$PYTHON_PROTOBUF_DIR/src --mypy_out=$REPO_ROOT/third_party/2and3 $PROTO_FILES
protoc_install/bin/protoc --proto_path=$PYTHON_PROTOBUF_DIR/src --mypy_out=$REPO_ROOT/stubs/protobuf $PROTO_FILES

Some files were not shown because too many files have changed in this diff Show More