Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6ec71fe
AVRO-4232: [Python] Modernize the Python tooling
martin-g Feb 18, 2026
9902208
Ignore uv.lock for ASFv2 licence check
martin-g Feb 18, 2026
d81a4a7
Add librt as a dev dependency
martin-g Feb 18, 2026
a411989
Drop librt as dev-dep. It fails at CI with another error
martin-g Feb 18, 2026
9a2ff4e
Do not test Python 3.9 since it is not supported
martin-g Feb 18, 2026
34eae25
Try with mypy<1.19
martin-g Feb 18, 2026
a427cfb
Use uv for the Java interop tests too
martin-g Feb 18, 2026
d401b80
Remove the flake8 settings. Now we use ruff
martin-g Feb 18, 2026
9e71d4b
Update uv.lock
martin-g Feb 18, 2026
d73daa5
Set cwd to lang/py for `uv sync`. Do not use uv for C# scripts
martin-g Feb 18, 2026
cb2b731
Update the usage. Wrap variables in quotes
martin-g Feb 18, 2026
7023260
Move more entries from setup.cfg to pyproject.toml
martin-g Feb 18, 2026
7ff957b
Remove typechecks dependency. It seems to be tox specific
martin-g Feb 18, 2026
f246a65
Do not shadow Python built-in `type`
martin-g Feb 18, 2026
cdedb56
Use `--frozen` for `uv sync` in CI
martin-g Feb 18, 2026
78f3a5c
Update setup-uv Github action to v7
martin-g Feb 18, 2026
e462824
Fix the package name for AvroException
martin-g Feb 18, 2026
e0484b3
First declare the local variable and then assign it a value
martin-g Feb 18, 2026
3c7c8c7
Use Python 3.10 for mypy
martin-g Feb 18, 2026
aeb32b9
Move "scripts" from setup.cfg to pyproject.toml
martin-g Feb 18, 2026
c15c680
Re-add the optional dependencies from setup.cfg to pyproject.toml
martin-g Feb 18, 2026
4724e89
Re-add the package-data from setup.cfg to pyproject.toml
martin-g Feb 18, 2026
91747aa
Use SHA for the external actions
martin-g Feb 19, 2026
712fde3
No need to call `build.sh` thru `uv run`
martin-g Feb 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 40 additions & 38 deletions .github/workflows/test-lang-java.yml
Comment thread
martin-g marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Test Java'
name: "Test Java"
on:
workflow_dispatch:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
paths:
- .github/workflows/test-lang-java.yml
- lang/java/**
- pom.xml
- .github/workflows/test-lang-java.yml
- lang/java/**
- pom.xml

defaults:
run:
Expand All @@ -35,137 +35,139 @@ concurrency:

jobs:
test:
name: 'Java Test'
name: "Java Test"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
os:
- ubuntu-latest
- ubuntu-24.04-arm
steps:
- name: 'Checkout sourcecode'
- name: "Checkout sourcecode"
uses: actions/checkout@v6

- name: 'Cache Local Maven Repository'
- name: "Cache Local Maven Repository"
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: 'Setup Temurin JDK 11, 17 & 21'
- name: "Setup Temurin JDK 11, 17 & 21"
uses: actions/setup-java@v5
with:
distribution: 'temurin'
distribution: "temurin"
java-version: |
11
17
21

- name: 'Setup Maven 3.9.11'
- name: "Setup Maven 3.9.11"
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
with:
maven-version: 3.9.11

- name: 'Install Java Avro Toplevel'
- name: "Install Java Avro Toplevel"
working-directory: ./
run: mvn -B install -PskipQuality -DskipTests

- name: 'Java Lint'
- name: "Java Lint"
run: ./build.sh lint

- name: 'Java Test'
- name: "Java Test"
run: ./build.sh test

- name: 'Install Java Avro'
- name: "Install Java Avro"
working-directory: .
run: mvn -B clean install -PskipQuality -DskipTests

- name: 'Test Reproducible Build'
- name: "Test Reproducible Build"
working-directory: .
run: mvn clean verify -PskipQuality artifact:compare

interop:
name: 'Java Interop'
name: "Java Interop"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
os:
- ubuntu-latest
- ubuntu-24.04-arm

steps:
- uses: actions/checkout@v6

- name: 'Cache Local Maven Repository'
- name: "Cache Local Maven Repository"
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: 'Setup Temurin JDK 11, 17 & 21'
- name: "Setup Temurin JDK 11, 17 & 21"
uses: actions/setup-java@v5
with:
distribution: 'temurin'
distribution: "temurin"
java-version: |
11
17
21

- name: 'Setup Maven 3.9.11'
- name: "Setup Maven 3.9.11"
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
with:
maven-version: 3.9.11

- name: 'Setup Python for Generating Input Data'
- name: "Setup Python for Generating Input Data"
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.12'
python-version: "3.12"

- name: 'Apt Install Compression Libs Required by Python'
- name: Setup uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867

- name: "Apt Install Compression Libs Required by Python"
run: |
sudo apt-get update && \
sudo apt-get install -qqy --no-install-recommends libbz2-dev \
liblzma-dev \
libsnappy-dev \
libzstd-dev

- name: 'Install Python Dependencies'
run: |
python3 -m pip install --break-system-packages --upgrade pip setuptools tox
python3 -m pip install --break-system-packages python-snappy zstandard
- name: "Install Python Dependencies"
working-directory: lang/py
run: uv sync --frozen

- name: 'Setup C# for Generating Interop Data'
- name: "Setup C# for Generating Interop Data"
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x

- name: 'Create Interop Data Directory'
- name: "Create Interop Data Directory"
working-directory: .
run: mkdir -p build/interop/data

- name: 'Generate Interop Data using Python'
- name: "Generate Interop Data using Python"
working-directory: lang/py
run: ./build.sh interop-data-generate

- name: 'Generate Interop Data using C#'
- name: "Generate Interop Data using C#"
working-directory: lang/csharp
run: ./build.sh interop-data-generate

- name: 'Install Java Avro for other tests'
- name: "Install Java Avro for other tests"
working-directory: .
run: mvn -B install -PskipQuality

- name: 'Generate Interop Data using Java 11, 17 & 21'
- name: "Generate Interop Data using Java 11, 17 & 21"
working-directory: lang/java/interop-data-test
run: mvn -B verify -Pgenerate-test-data

- name: 'Run Interop Tests using Java 11, 17 & 21'
- name: "Run Interop Tests using Java 11, 17 & 21"
working-directory: lang/java/interop-data-test
run: mvn -B verify -Pcheck-test-data
58 changes: 30 additions & 28 deletions .github/workflows/test-lang-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Test Python'
name: "Test Python"
on:
workflow_dispatch:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
paths:
- .github/workflows/test-lang-py.yml
- lang/py/**
- .github/workflows/test-lang-py.yml
- lang/py/**

defaults:
run:
Expand All @@ -38,16 +38,17 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
os:
- ubuntu-latest
- ubuntu-24.04-arm
python:
- '3.13'
- '3.12'
- '3.11'
- '3.10'
- 'pypy-3.11'
- 'pypy-3.10'
- "3.14"
- "3.13"
- "3.12"
- "3.11"
- "3.10"
- "pypy-3.11"
- "pypy-3.10"

steps:
- uses: actions/checkout@v6
Expand All @@ -57,6 +58,9 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Setup uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867

- name: Apt Install Compression Libs
run: |
sudo apt-get update && \
Expand All @@ -67,33 +71,30 @@ jobs:
libzstd-dev

- name: Install Dependencies
run: |
python3 -m pip install --upgrade pip setuptools tox
run: uv sync --frozen

- name: Lint
if: ${{ matrix.python == '3.10' }}
run: python3 -m tox -e lint
run: ./build.sh lint

- name: Typechecks
if: ${{ matrix.python == '3.10' }}
run: python3 -m tox -e typechecks
run: ./build.sh typechecks

- name: Test
run: python3 -m tox -e py
run: ./build.sh test

interop:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
os:
- ubuntu-latest
- ubuntu-24.04-arm
python:
- '3.11'
- '3.10'
- '3.9'
- 'pypy-3.10'
- "3.13"
- "3.12"

steps:
- uses: actions/checkout@v6
Expand All @@ -103,6 +104,9 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Setup uv
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867

- name: Apt Install Compression Libs
run: |
sudo apt-get update && \
Expand All @@ -113,9 +117,7 @@ jobs:
libzstd-dev

- name: Install Dependencies
run: |
python3 -m pip install --upgrade pip setuptools tox
python3 -m pip install python-snappy zstandard
run: uv sync --frozen

- name: Cache Local Maven Repository
uses: actions/cache@v5
Expand All @@ -125,17 +127,17 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-

- name: 'Setup Temurin JDK 8, 11, 17 & 21'
- name: "Setup Temurin JDK 8, 11, 17 & 21"
uses: actions/setup-java@v5
with:
distribution: 'temurin'
distribution: "temurin"
java-version: |
8
11
17
21

- name: 'Setup Maven 3.9.11'
- name: "Setup Maven 3.9.11"
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
with:
maven-version: 3.9.11
Expand Down
2 changes: 1 addition & 1 deletion lang/py/avro/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def respond(self, call_request):
else:
writers_schema = local_message.errors
self.write_error(writers_schema, error, buffer_encoder)
except schema.AvroException as e:
except avro.errors.AvroException as e:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi.

This MR not only modernize the python tooling. But also fix that bug. Do you plane to update the library in pypi too?

Thanks a lot.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!
uv reported this problem and we fixed it!

It will be part of the 1.13.0 release but I cannot say when it will be made.

error = avro.errors.AvroRemoteException(str(e))
buffer_encoder = avro.io.BinaryEncoder(io.BytesIO())
META_WRITER.write(response_metadata, buffer_encoder)
Expand Down
13 changes: 10 additions & 3 deletions lang/py/avro/test/sample_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@
{
"name": "Message",
"type": "record",
"fields": [{"name": "to", "type": "string"}, {"name": "from", "type": "string"}, {"name": "body", "type": "string"}],
"fields": [
{"name": "to", "type": "string"},
{"name": "from", "type": "string"},
{"name": "body", "type": "string"},
],
}
],
"messages": {
"send": {"request": [{"name": "message", "type": "Message"}], "response": "string"},
"send": {
"request": [{"name": "message", "type": "Message"}],
"response": "string",
},
"replay": {"request": [], "response": "string"},
},
}
Expand Down Expand Up @@ -71,7 +78,7 @@ def do_POST(self) -> None:


def main():
mail_server = http_server.HTTPServer(SERVER_ADDRESS, MailHandler)
mail_server = http.server.HTTPServer(SERVER_ADDRESS, MailHandler)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how this worked before

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably didn't. Is there evidence it was ever covered?

mail_server.allow_reuse_address = True
mail_server.serve_forever()

Expand Down
Loading