Skip to content

Commit b36acf2

Browse files
authored
Implement Async Schema Registry client (#1965)
* Refactor for async support * remove avro module import * Add top level __all__ to refactored modules * reduce diffs * refactor * formatting * style fix * fix flake8 * fix * fix flake8 * revert * reduce diff * Implement async variants of SR clients and serdes * refactor in prep for adding async * Implement async variants of SR clients and serdes * Refactor * make functions async * make schema id serializer changes to async * fix * add async changes and refactor into separate unasync script * add check to source-package-verification * fixes * fix flake8 * ignore build * fix tests * fix * fix flake8 * add async sr import * Auto-generate README * use timeout * Refactor unasync and add tests to prove functionality * fix
1 parent c9de3bb commit b36acf2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5831
-80
lines changed

DEVELOPER.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ or:
3131

3232
Documentation will be generated in `build/sphinx/html`.
3333

34+
## Unasync -- maintaining sync versions of async code
35+
36+
$ python tools/unasync.py
37+
38+
# Run the script with the --check flag to ensure the sync code is up to date
39+
$ python tools/unasync.py --check
40+
41+
If you make any changes to the async code (in `src/confluent_kafka/schema_registry/_async` and `tests/integration/schema_registry/_async`), you **must** run this script to generate the sync counter parts (in `src/confluent_kafka/schema_registry/_sync` and `tests/integration/schema_registry/_sync`). Otherwise, this script will be run in CI with the --check flag and fail the build.
42+
3443

3544
## Tests
3645

LICENSE

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,3 +652,36 @@ For the files wingetopt.c wingetopt.h downloaded from https://github.com/alex85k
652652
*/
653653

654654

655+
656+
LICENSE.unasync
657+
--------------------------------------------------------------
658+
For unasync code in setup.py, derived from
659+
https://github.com/encode/httpcore/blob/ae46dfbd4330eefaa9cd6ab1560dec18a1d0bcb8/scripts/unasync.py
660+
661+
Copyright © 2020, [Encode OSS Ltd](https://www.encode.io/).
662+
All rights reserved.
663+
664+
Redistribution and use in source and binary forms, with or without
665+
modification, are permitted provided that the following conditions are met:
666+
667+
* Redistributions of source code must retain the above copyright notice, this
668+
list of conditions and the following disclaimer.
669+
670+
* Redistributions in binary form must reproduce the above copyright notice,
671+
this list of conditions and the following disclaimer in the documentation
672+
and/or other materials provided with the distribution.
673+
674+
* Neither the name of the copyright holder nor the names of its
675+
contributors may be used to endorse or promote products derived from
676+
this software without specific prior written permission.
677+
678+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
679+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
680+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
681+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
682+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
683+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
684+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
685+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
686+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
687+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ optional-dependencies.all = { file = [
7373
"requirements/requirements-avro.txt",
7474
"requirements/requirements-json.txt",
7575
"requirements/requirements-protobuf.txt"] }
76+
77+
[tool.pytest.ini_options]
78+
asyncio_mode = "auto"

requirements/requirements-tests.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ requests-mock
99
respx
1010
pytest_cov
1111
pluggy<1.6.0
12+
pytest-asyncio
13+
async-timeout

src/confluent_kafka/schema_registry/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
RuleSet,
3232
Schema,
3333
SchemaRegistryClient,
34+
AsyncSchemaRegistryClient,
3435
SchemaRegistryError,
3536
SchemaReference,
3637
ServerConfig
@@ -57,6 +58,7 @@
5758
"RuleSet",
5859
"Schema",
5960
"SchemaRegistryClient",
61+
"AsyncSchemaRegistryClient",
6062
"SchemaRegistryError",
6163
"SchemaReference",
6264
"ServerConfig",

src/confluent_kafka/schema_registry/_async/__init__.py

Whitespace-only changes.

src/confluent_kafka/schema_registry/_async/avro.py

Lines changed: 603 additions & 0 deletions
Large diffs are not rendered by default.

src/confluent_kafka/schema_registry/_async/json_schema.py

Lines changed: 659 additions & 0 deletions
Large diffs are not rendered by default.

src/confluent_kafka/schema_registry/_async/protobuf.py

Lines changed: 717 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)