Skip to content

Commit

Permalink
feat: support avro 1.12.x (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Sep 5, 2024
1 parent ea375b6 commit 8ebfa39
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,32 @@ name: Python package

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
avro-version: ["1.10.2", "1.11.0"]
avro-version: ["1.10.2", "1.11.0", "1.12.0"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install avro ${{ matrix.avro-version }}
run: |
pip install avro==${{ matrix.avro-version }}
- name: Install package
run: |
pip install -e '.'
pip install coverage pytz
- name: Test
run: |
python -m coverage run -m unittest discover -s ./tests -p '*_tests.py'
python -m coverage report --show-missing
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install avro ${{ matrix.avro-version }}
run: |
pip install avro==${{ matrix.avro-version }}
- name: Install package
run: |
pip install -e '.'
pip install coverage pytz
- name: Test
run: |
python -m coverage run -m unittest discover -s ./tests -p '*_tests.py'
python -m coverage report --show-missing
8 changes: 5 additions & 3 deletions avrogen/avrojson.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import collections

import avro
import avro.constants
import six
from avro import io, schema

Expand All @@ -14,13 +15,14 @@
try:
from avro.errors import AvroException, AvroTypeException, SchemaResolutionException
except ImportError:
from avro.io import AvroException, AvroTypeException, SchemaResolutionException
# Compat with Avro 1.10.2.
from avro.io import AvroTypeException, SchemaResolutionException
from avro.schema import AvroException

try:
import avro.constants

_PRIMITIVE_TYPES = set(avro.constants.PRIMITIVE_TYPES)
except AttributeError:
# Compat with Avro < 1.12.0.
_PRIMITIVE_TYPES = set(schema.PRIMITIVE_TYPES)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

setup(
name="avro-gen3",
version="0.7.15",
version="0.7.16",
description="Avro record class and specific record reader generator",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 8ebfa39

Please sign in to comment.