diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000..b025f25 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,45 @@ +# This workflow will generate a Python protobuf bindings and type stubs with Maven and run Python tests. + +name: Python CI with Maven and Pytest + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +jobs: + run-python-ci: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Build with Maven + run: ./mvnw -B package -DskipTests # we run tests elsewhere + + - name: Install Python bindings + run: | + cd python && python3 -m pip install .[test] + + - name: Run Python tests + run: | + pytest + \ No newline at end of file diff --git a/docs/python.rst b/docs/python.rst index 8bd1785..a54316f 100644 --- a/docs/python.rst +++ b/docs/python.rst @@ -66,7 +66,7 @@ such as `bool`, `int`, `str`, or `float`, and the assignment will *NOT* work for >>> pf.type = spherocytosis Traceback (most recent call last): ... -AttributeError: Assignment not allowed to field "type" in protocol message object. +AttributeError: Assignment not allowed to composite field "type" in protocol message object. To set a message field, we must use the `CopyFrom` function: