From cae42404523a32edfd3229f30e05c77cae5c7475 Mon Sep 17 00:00:00 2001 From: Jarkko Jaakola Date: Wed, 25 Sep 2024 10:31:44 +0300 Subject: [PATCH] chore: use source layout --- .coveragerc | 6 ++--- .dockerignore | 4 +++- .github/workflows/container-smoke-test.yml | 3 ++- .github/workflows/lint.yml | 9 ++++++-- .github/workflows/schema.yml | 10 +++++--- .github/workflows/tests.yml | 4 ++-- GNUmakefile | 23 +++++++++++++++---- MANIFEST.in | 3 +-- container/Dockerfile | 2 +- pyproject.toml | 7 ++---- {karapace => src/karapace}/__init__.py | 0 .../karapace}/anonymize_schemas/__init__.py | 0 .../anonymize_schemas/anonymize_avro.py | 0 {karapace => src/karapace}/auth.py | 0 .../karapace}/avro_dataclasses/__init__.py | 0 .../karapace}/avro_dataclasses/introspect.py | 0 .../karapace}/avro_dataclasses/models.py | 0 .../karapace}/avro_dataclasses/schema.py | 0 {karapace => src/karapace}/backup/__init__.py | 0 {karapace => src/karapace}/backup/api.py | 0 .../karapace}/backup/backends/__init__.py | 0 .../karapace}/backup/backends/reader.py | 0 .../karapace}/backup/backends/v1.py | 0 .../karapace}/backup/backends/v2.py | 0 .../karapace}/backup/backends/v3/__init__.py | 0 .../backup/backends/v3/avro/DataFile.avsc | 0 .../backup/backends/v3/avro/Header.avsc | 0 .../backup/backends/v3/avro/Metadata.avsc | 0 .../backup/backends/v3/avro/Record.avsc | 0 .../karapace}/backup/backends/v3/backend.py | 0 .../karapace}/backup/backends/v3/checksum.py | 0 .../karapace}/backup/backends/v3/constants.py | 0 .../karapace}/backup/backends/v3/errors.py | 0 .../karapace}/backup/backends/v3/readers.py | 0 .../karapace}/backup/backends/v3/schema.py | 0 .../backup/backends/v3/schema_tool.py | 16 +++++++++++++ .../karapace}/backup/backends/v3/writers.py | 0 .../karapace}/backup/backends/writer.py | 0 {karapace => src/karapace}/backup/cli.py | 0 {karapace => src/karapace}/backup/encoders.py | 0 {karapace => src/karapace}/backup/errors.py | 0 .../karapace}/backup/poll_timeout.py | 0 .../karapace}/backup/safe_writer.py | 0 .../karapace}/backup/topic_configurations.py | 0 {karapace => src/karapace}/client.py | 0 .../karapace}/compatibility/__init__.py | 0 .../compatibility/jsonschema/__init__.py | 0 .../compatibility/jsonschema/checks.py | 0 .../compatibility/jsonschema/types.py | 0 .../compatibility/jsonschema/utils.py | 0 .../compatibility/protobuf/__init__.py | 0 .../compatibility/protobuf/checks.py | 0 {karapace => src/karapace}/config.py | 0 {karapace => src/karapace}/constants.py | 0 .../karapace}/coordinator/__init__.py | 0 .../coordinator/master_coordinator.py | 0 .../coordinator/schema_coordinator.py | 0 {karapace => src/karapace}/dataclasses.py | 0 {karapace => src/karapace}/dependency.py | 0 {karapace => src/karapace}/errors.py | 0 .../karapace}/in_memory_database.py | 0 .../karapace}/instrumentation/__init__.py | 0 .../karapace}/instrumentation/prometheus.py | 0 {karapace => src/karapace}/kafka/__init__.py | 0 {karapace => src/karapace}/kafka/admin.py | 0 {karapace => src/karapace}/kafka/common.py | 0 {karapace => src/karapace}/kafka/consumer.py | 0 {karapace => src/karapace}/kafka/producer.py | 0 {karapace => src/karapace}/kafka/types.py | 0 .../karapace}/kafka_error_handler.py | 0 .../karapace}/kafka_rest_apis/__init__.py | 0 .../kafka_rest_apis/authentication.py | 0 .../kafka_rest_apis/consumer_manager.py | 0 .../karapace}/kafka_rest_apis/error_codes.py | 0 .../karapace}/kafka_rest_apis/schema_cache.py | 0 {karapace => src/karapace}/kafka_utils.py | 0 {karapace => src/karapace}/karapace.py | 0 {karapace => src/karapace}/karapace_all.py | 0 {karapace => src/karapace}/key_format.py | 0 {karapace => src/karapace}/messaging.py | 0 {karapace => src/karapace}/offset_watcher.py | 0 .../karapace}/protobuf/__init__.py | 0 .../karapace}/protobuf/compare_result.py | 0 .../karapace}/protobuf/compare_type_lists.py | 0 .../protobuf/compare_type_storage.py | 0 .../karapace}/protobuf/encoding_variants.py | 0 .../protobuf/enum_constant_element.py | 0 .../karapace}/protobuf/enum_element.py | 0 .../karapace}/protobuf/exception.py | 0 .../karapace}/protobuf/extend_element.py | 0 .../karapace}/protobuf/extensions_element.py | 0 {karapace => src/karapace}/protobuf/field.py | 0 .../karapace}/protobuf/field_element.py | 0 .../karapace}/protobuf/group_element.py | 0 {karapace => src/karapace}/protobuf/io.py | 0 .../karapace}/protobuf/known_dependency.py | 0 .../karapace}/protobuf/kotlin_wrapper.py | 0 .../karapace}/protobuf/location.py | 0 .../karapace}/protobuf/message_element.py | 0 .../karapace}/protobuf/one_of_element.py | 0 .../karapace}/protobuf/option_element.py | 0 .../karapace}/protobuf/option_reader.py | 0 .../karapace}/protobuf/proto_file_element.py | 0 .../protobuf/proto_normalizations.py | 0 .../karapace}/protobuf/proto_parser.py | 0 .../karapace}/protobuf/proto_type.py | 0 .../karapace}/protobuf/protobuf_to_dict.py | 0 .../karapace}/protobuf/protopace/__init__.py | 0 .../karapace}/protobuf/protopace/protopace.py | 0 .../karapace}/protobuf/reserved_element.py | 0 .../karapace}/protobuf/rpc_element.py | 0 {karapace => src/karapace}/protobuf/schema.py | 0 .../karapace}/protobuf/serialization.py | 0 .../karapace}/protobuf/service_element.py | 0 {karapace => src/karapace}/protobuf/syntax.py | 0 .../karapace}/protobuf/syntax_reader.py | 0 .../karapace}/protobuf/type_element.py | 0 .../karapace}/protobuf/type_tree.py | 0 {karapace => src/karapace}/protobuf/utils.py | 0 {karapace => src/karapace}/rapu.py | 0 {karapace => src/karapace}/schema_models.py | 0 {karapace => src/karapace}/schema_reader.py | 0 .../karapace}/schema_references.py | 0 {karapace => src/karapace}/schema_registry.py | 0 .../karapace}/schema_registry_apis.py | 0 {karapace => src/karapace}/schema_type.py | 0 {karapace => src/karapace}/sentry/__init__.py | 0 .../karapace}/sentry/sentry_client.py | 0 .../karapace}/sentry/sentry_client_api.py | 0 {karapace => src/karapace}/serialization.py | 0 {karapace => src/karapace}/statsd.py | 0 {karapace => src/karapace}/typing.py | 0 {karapace => src/karapace}/utils.py | 0 133 files changed, 62 insertions(+), 25 deletions(-) rename {karapace => src/karapace}/__init__.py (100%) rename {karapace => src/karapace}/anonymize_schemas/__init__.py (100%) rename {karapace => src/karapace}/anonymize_schemas/anonymize_avro.py (100%) rename {karapace => src/karapace}/auth.py (100%) rename {karapace => src/karapace}/avro_dataclasses/__init__.py (100%) rename {karapace => src/karapace}/avro_dataclasses/introspect.py (100%) rename {karapace => src/karapace}/avro_dataclasses/models.py (100%) rename {karapace => src/karapace}/avro_dataclasses/schema.py (100%) rename {karapace => src/karapace}/backup/__init__.py (100%) rename {karapace => src/karapace}/backup/api.py (100%) rename {karapace => src/karapace}/backup/backends/__init__.py (100%) rename {karapace => src/karapace}/backup/backends/reader.py (100%) rename {karapace => src/karapace}/backup/backends/v1.py (100%) rename {karapace => src/karapace}/backup/backends/v2.py (100%) rename {karapace => src/karapace}/backup/backends/v3/__init__.py (100%) rename {karapace => src/karapace}/backup/backends/v3/avro/DataFile.avsc (100%) rename {karapace => src/karapace}/backup/backends/v3/avro/Header.avsc (100%) rename {karapace => src/karapace}/backup/backends/v3/avro/Metadata.avsc (100%) rename {karapace => src/karapace}/backup/backends/v3/avro/Record.avsc (100%) rename {karapace => src/karapace}/backup/backends/v3/backend.py (100%) rename {karapace => src/karapace}/backup/backends/v3/checksum.py (100%) rename {karapace => src/karapace}/backup/backends/v3/constants.py (100%) rename {karapace => src/karapace}/backup/backends/v3/errors.py (100%) rename {karapace => src/karapace}/backup/backends/v3/readers.py (100%) rename {karapace => src/karapace}/backup/backends/v3/schema.py (100%) rename {karapace => src/karapace}/backup/backends/v3/schema_tool.py (89%) rename {karapace => src/karapace}/backup/backends/v3/writers.py (100%) rename {karapace => src/karapace}/backup/backends/writer.py (100%) rename {karapace => src/karapace}/backup/cli.py (100%) rename {karapace => src/karapace}/backup/encoders.py (100%) rename {karapace => src/karapace}/backup/errors.py (100%) rename {karapace => src/karapace}/backup/poll_timeout.py (100%) rename {karapace => src/karapace}/backup/safe_writer.py (100%) rename {karapace => src/karapace}/backup/topic_configurations.py (100%) rename {karapace => src/karapace}/client.py (100%) rename {karapace => src/karapace}/compatibility/__init__.py (100%) rename {karapace => src/karapace}/compatibility/jsonschema/__init__.py (100%) rename {karapace => src/karapace}/compatibility/jsonschema/checks.py (100%) rename {karapace => src/karapace}/compatibility/jsonschema/types.py (100%) rename {karapace => src/karapace}/compatibility/jsonschema/utils.py (100%) rename {karapace => src/karapace}/compatibility/protobuf/__init__.py (100%) rename {karapace => src/karapace}/compatibility/protobuf/checks.py (100%) rename {karapace => src/karapace}/config.py (100%) rename {karapace => src/karapace}/constants.py (100%) rename {karapace => src/karapace}/coordinator/__init__.py (100%) rename {karapace => src/karapace}/coordinator/master_coordinator.py (100%) rename {karapace => src/karapace}/coordinator/schema_coordinator.py (100%) rename {karapace => src/karapace}/dataclasses.py (100%) rename {karapace => src/karapace}/dependency.py (100%) rename {karapace => src/karapace}/errors.py (100%) rename {karapace => src/karapace}/in_memory_database.py (100%) rename {karapace => src/karapace}/instrumentation/__init__.py (100%) rename {karapace => src/karapace}/instrumentation/prometheus.py (100%) rename {karapace => src/karapace}/kafka/__init__.py (100%) rename {karapace => src/karapace}/kafka/admin.py (100%) rename {karapace => src/karapace}/kafka/common.py (100%) rename {karapace => src/karapace}/kafka/consumer.py (100%) rename {karapace => src/karapace}/kafka/producer.py (100%) rename {karapace => src/karapace}/kafka/types.py (100%) rename {karapace => src/karapace}/kafka_error_handler.py (100%) rename {karapace => src/karapace}/kafka_rest_apis/__init__.py (100%) rename {karapace => src/karapace}/kafka_rest_apis/authentication.py (100%) rename {karapace => src/karapace}/kafka_rest_apis/consumer_manager.py (100%) rename {karapace => src/karapace}/kafka_rest_apis/error_codes.py (100%) rename {karapace => src/karapace}/kafka_rest_apis/schema_cache.py (100%) rename {karapace => src/karapace}/kafka_utils.py (100%) rename {karapace => src/karapace}/karapace.py (100%) rename {karapace => src/karapace}/karapace_all.py (100%) rename {karapace => src/karapace}/key_format.py (100%) rename {karapace => src/karapace}/messaging.py (100%) rename {karapace => src/karapace}/offset_watcher.py (100%) rename {karapace => src/karapace}/protobuf/__init__.py (100%) rename {karapace => src/karapace}/protobuf/compare_result.py (100%) rename {karapace => src/karapace}/protobuf/compare_type_lists.py (100%) rename {karapace => src/karapace}/protobuf/compare_type_storage.py (100%) rename {karapace => src/karapace}/protobuf/encoding_variants.py (100%) rename {karapace => src/karapace}/protobuf/enum_constant_element.py (100%) rename {karapace => src/karapace}/protobuf/enum_element.py (100%) rename {karapace => src/karapace}/protobuf/exception.py (100%) rename {karapace => src/karapace}/protobuf/extend_element.py (100%) rename {karapace => src/karapace}/protobuf/extensions_element.py (100%) rename {karapace => src/karapace}/protobuf/field.py (100%) rename {karapace => src/karapace}/protobuf/field_element.py (100%) rename {karapace => src/karapace}/protobuf/group_element.py (100%) rename {karapace => src/karapace}/protobuf/io.py (100%) rename {karapace => src/karapace}/protobuf/known_dependency.py (100%) rename {karapace => src/karapace}/protobuf/kotlin_wrapper.py (100%) rename {karapace => src/karapace}/protobuf/location.py (100%) rename {karapace => src/karapace}/protobuf/message_element.py (100%) rename {karapace => src/karapace}/protobuf/one_of_element.py (100%) rename {karapace => src/karapace}/protobuf/option_element.py (100%) rename {karapace => src/karapace}/protobuf/option_reader.py (100%) rename {karapace => src/karapace}/protobuf/proto_file_element.py (100%) rename {karapace => src/karapace}/protobuf/proto_normalizations.py (100%) rename {karapace => src/karapace}/protobuf/proto_parser.py (100%) rename {karapace => src/karapace}/protobuf/proto_type.py (100%) rename {karapace => src/karapace}/protobuf/protobuf_to_dict.py (100%) rename {karapace => src/karapace}/protobuf/protopace/__init__.py (100%) rename {karapace => src/karapace}/protobuf/protopace/protopace.py (100%) rename {karapace => src/karapace}/protobuf/reserved_element.py (100%) rename {karapace => src/karapace}/protobuf/rpc_element.py (100%) rename {karapace => src/karapace}/protobuf/schema.py (100%) rename {karapace => src/karapace}/protobuf/serialization.py (100%) rename {karapace => src/karapace}/protobuf/service_element.py (100%) rename {karapace => src/karapace}/protobuf/syntax.py (100%) rename {karapace => src/karapace}/protobuf/syntax_reader.py (100%) rename {karapace => src/karapace}/protobuf/type_element.py (100%) rename {karapace => src/karapace}/protobuf/type_tree.py (100%) rename {karapace => src/karapace}/protobuf/utils.py (100%) rename {karapace => src/karapace}/rapu.py (100%) rename {karapace => src/karapace}/schema_models.py (100%) rename {karapace => src/karapace}/schema_reader.py (100%) rename {karapace => src/karapace}/schema_references.py (100%) rename {karapace => src/karapace}/schema_registry.py (100%) rename {karapace => src/karapace}/schema_registry_apis.py (100%) rename {karapace => src/karapace}/schema_type.py (100%) rename {karapace => src/karapace}/sentry/__init__.py (100%) rename {karapace => src/karapace}/sentry/sentry_client.py (100%) rename {karapace => src/karapace}/sentry/sentry_client_api.py (100%) rename {karapace => src/karapace}/serialization.py (100%) rename {karapace => src/karapace}/statsd.py (100%) rename {karapace => src/karapace}/typing.py (100%) rename {karapace => src/karapace}/utils.py (100%) diff --git a/.coveragerc b/.coveragerc index 7d422503e..2a6a5d055 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,4 @@ [run] -branch = True -relative_files = True -source = karapace +branch = true +relative_files = true +source = src/karapace diff --git a/.dockerignore b/.dockerignore index 2245fd0d9..57efb59ad 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,11 +3,13 @@ * # Include source directories and files required for building. -!karapace !go +!src !requirements/*.txt !README.rst +!LICENSE !pyproject.toml +!setup.py !container/start.sh !container/healthcheck.py diff --git a/.github/workflows/container-smoke-test.yml b/.github/workflows/container-smoke-test.yml index e17aa2641..cced926bd 100644 --- a/.github/workflows/container-smoke-test.yml +++ b/.github/workflows/container-smoke-test.yml @@ -18,10 +18,11 @@ jobs: fetch-depth: 0 - name: Install requirements - run: pip install . + run: make install - name: Resolve Karapace version run: | + source ./venv/bin/activate KARAPACE_VERSION=$(python -c "from karapace import version; print(version.__version__)") echo KARAPACE_VERSION=$KARAPACE_VERSION >> $GITHUB_ENV diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ed98fc671..b8f9b57c3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -44,5 +44,10 @@ jobs: - name: Install libsnappy-dev run: sudo apt install libsnappy-dev - name: Install requirements and typing requirements - run: pip install .[typing] - - run: mypy + run: | + python -m venv venv + source ./venv/bin/activate + pip --require-virtualenv install .[typing] + - run: | + source ./venv/bin/activate + mypy src diff --git a/.github/workflows/schema.yml b/.github/workflows/schema.yml index 851ed47f1..d02a347d8 100644 --- a/.github/workflows/schema.yml +++ b/.github/workflows/schema.yml @@ -22,12 +22,16 @@ jobs: - name: Install libsnappy-dev run: sudo apt install libsnappy-dev - name: Install requirements - - run: pip install . + run: make install-dev # Compare with latest release when running on main. - - run: make schema against=$(git describe --abbrev=0 --tags) + - run: | + source ./venv/bin/activate + make schema against=$(git describe --abbrev=0 --tags) if: github.ref == 'refs/heads/main' # Compare with main when running on branches/PRs. - - run: make schema + - run: | + source ./venv/bin/activate + make schema if: github.ref != 'refs/heads/main' - run: | diff=$(git --no-pager diff) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5322b4d7e..d3ae1c40f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,7 +40,7 @@ jobs: with: go-version: '1.21.0' - - run: make install + - run: make install-dev - run: make unit-tests env: COVERAGE_FILE: ".coverage.${{ matrix.python-version }}" @@ -73,7 +73,7 @@ jobs: steps: - uses: actions/checkout@v4 - - run: make install + - run: make install-dev - name: Download coverage id: download_coverage diff --git a/GNUmakefile b/GNUmakefile index 522e481e1..9d318a5cc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -42,29 +42,42 @@ venv/.make: .PHONY: install install: venv/.deps -venv/.deps: requirements/requirements-dev.txt requirements/requirements.txt | venv/.make +venv/.deps: venv/.make set +x source ./bin/get-java source ./bin/get-protoc source ./bin/get-snappy set -x - $(PIP) install --use-pep517 . .[dev] + $(PIP) install --use-pep517 . $(PIP) check touch '$(@)' +.PHONY: install-dev +install-dev: venv/.deps-dev +venv/.deps-dev: venv/.make + set +x + source ./bin/get-java + source ./bin/get-protoc + source ./bin/get-snappy + set -x + $(PIP) install -e .[dev] + $(PIP) check + touch '$(@)' + + .PHONY: test tests: unit-tests integration-tests .PHONY: unit-tests unit-tests: export PYTEST_ARGS ?= -unit-tests: venv/.deps +unit-tests: venv/.deps-dev rm -fr runtime/* $(PYTHON) -m pytest -s -vvv $(PYTEST_ARGS) tests/unit/ rm -fr runtime/* .PHONY: integration-tests unit-tests: export PYTEST_ARGS ?= -integration-tests: venv/.deps +integration-tests: venv/.deps-dev rm -fr runtime/* $(PYTHON) -m pytest -s -vvv $(PYTEST_ARGS) tests/integration/ rm -fr runtime/* @@ -82,7 +95,7 @@ cleanest: cleaner rm -fr '$(VENV_DIR)' .PHONY: requirements -requirements: export CUSTOM_COMPILE_COMMAND='make requirements' +requirements: requirements: $(PIP) install --upgrade pip setuptools pip-tools $(PIP) install .[dev,typing] diff --git a/MANIFEST.in b/MANIFEST.in index 9a9525ac0..4ee222daa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include karapace/*.py +graft src include karapace.json include karapace.unit include tests/*.py @@ -7,6 +7,5 @@ include README.rst include pyproject.toml include LICENSE include MANIFEST.in -include *.so recursive-exclude examples *~ *.pyc \.* diff --git a/container/Dockerfile b/container/Dockerfile index efa862dff..2e1544319 100644 --- a/container/Dockerfile +++ b/container/Dockerfile @@ -29,7 +29,7 @@ COPY . /build/karapace-repo WORKDIR /build/karapace-repo RUN --mount=type=cache,target=/root/.cache/pip \ if [ -z "${KARAPACE_VERSION}" ]; then \ - PRETEND_VERSION="$(python -c 'from karapace import version; print(version.__version__)')"; \ + PRETEND_VERSION="$(python -c 'from src.karapace import version; print(version.__version__)')"; \ else \ PRETEND_VERSION=$KARAPACE_VERSION; \ fi; \ diff --git a/pyproject.toml b/pyproject.toml index 348dd4dd7..516d548be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools > 64", "setuptools-scm", "setuptools-golang"] +requires = ["setuptools > 64", "setuptools-scm > 8.0.0", "setuptools-golang"] build-backend = "setuptools.build_meta" [project] @@ -102,11 +102,8 @@ typing = [ [tool.setuptools] include-package-data = true -[tool.setuptools.packages.find] -include = ["karapace"] - [tool.setuptools_scm] -version_file = "karapace/version.py" +version_file = "src/karapace/version.py" [tool.black] target-version = ["py38"] diff --git a/karapace/__init__.py b/src/karapace/__init__.py similarity index 100% rename from karapace/__init__.py rename to src/karapace/__init__.py diff --git a/karapace/anonymize_schemas/__init__.py b/src/karapace/anonymize_schemas/__init__.py similarity index 100% rename from karapace/anonymize_schemas/__init__.py rename to src/karapace/anonymize_schemas/__init__.py diff --git a/karapace/anonymize_schemas/anonymize_avro.py b/src/karapace/anonymize_schemas/anonymize_avro.py similarity index 100% rename from karapace/anonymize_schemas/anonymize_avro.py rename to src/karapace/anonymize_schemas/anonymize_avro.py diff --git a/karapace/auth.py b/src/karapace/auth.py similarity index 100% rename from karapace/auth.py rename to src/karapace/auth.py diff --git a/karapace/avro_dataclasses/__init__.py b/src/karapace/avro_dataclasses/__init__.py similarity index 100% rename from karapace/avro_dataclasses/__init__.py rename to src/karapace/avro_dataclasses/__init__.py diff --git a/karapace/avro_dataclasses/introspect.py b/src/karapace/avro_dataclasses/introspect.py similarity index 100% rename from karapace/avro_dataclasses/introspect.py rename to src/karapace/avro_dataclasses/introspect.py diff --git a/karapace/avro_dataclasses/models.py b/src/karapace/avro_dataclasses/models.py similarity index 100% rename from karapace/avro_dataclasses/models.py rename to src/karapace/avro_dataclasses/models.py diff --git a/karapace/avro_dataclasses/schema.py b/src/karapace/avro_dataclasses/schema.py similarity index 100% rename from karapace/avro_dataclasses/schema.py rename to src/karapace/avro_dataclasses/schema.py diff --git a/karapace/backup/__init__.py b/src/karapace/backup/__init__.py similarity index 100% rename from karapace/backup/__init__.py rename to src/karapace/backup/__init__.py diff --git a/karapace/backup/api.py b/src/karapace/backup/api.py similarity index 100% rename from karapace/backup/api.py rename to src/karapace/backup/api.py diff --git a/karapace/backup/backends/__init__.py b/src/karapace/backup/backends/__init__.py similarity index 100% rename from karapace/backup/backends/__init__.py rename to src/karapace/backup/backends/__init__.py diff --git a/karapace/backup/backends/reader.py b/src/karapace/backup/backends/reader.py similarity index 100% rename from karapace/backup/backends/reader.py rename to src/karapace/backup/backends/reader.py diff --git a/karapace/backup/backends/v1.py b/src/karapace/backup/backends/v1.py similarity index 100% rename from karapace/backup/backends/v1.py rename to src/karapace/backup/backends/v1.py diff --git a/karapace/backup/backends/v2.py b/src/karapace/backup/backends/v2.py similarity index 100% rename from karapace/backup/backends/v2.py rename to src/karapace/backup/backends/v2.py diff --git a/karapace/backup/backends/v3/__init__.py b/src/karapace/backup/backends/v3/__init__.py similarity index 100% rename from karapace/backup/backends/v3/__init__.py rename to src/karapace/backup/backends/v3/__init__.py diff --git a/karapace/backup/backends/v3/avro/DataFile.avsc b/src/karapace/backup/backends/v3/avro/DataFile.avsc similarity index 100% rename from karapace/backup/backends/v3/avro/DataFile.avsc rename to src/karapace/backup/backends/v3/avro/DataFile.avsc diff --git a/karapace/backup/backends/v3/avro/Header.avsc b/src/karapace/backup/backends/v3/avro/Header.avsc similarity index 100% rename from karapace/backup/backends/v3/avro/Header.avsc rename to src/karapace/backup/backends/v3/avro/Header.avsc diff --git a/karapace/backup/backends/v3/avro/Metadata.avsc b/src/karapace/backup/backends/v3/avro/Metadata.avsc similarity index 100% rename from karapace/backup/backends/v3/avro/Metadata.avsc rename to src/karapace/backup/backends/v3/avro/Metadata.avsc diff --git a/karapace/backup/backends/v3/avro/Record.avsc b/src/karapace/backup/backends/v3/avro/Record.avsc similarity index 100% rename from karapace/backup/backends/v3/avro/Record.avsc rename to src/karapace/backup/backends/v3/avro/Record.avsc diff --git a/karapace/backup/backends/v3/backend.py b/src/karapace/backup/backends/v3/backend.py similarity index 100% rename from karapace/backup/backends/v3/backend.py rename to src/karapace/backup/backends/v3/backend.py diff --git a/karapace/backup/backends/v3/checksum.py b/src/karapace/backup/backends/v3/checksum.py similarity index 100% rename from karapace/backup/backends/v3/checksum.py rename to src/karapace/backup/backends/v3/checksum.py diff --git a/karapace/backup/backends/v3/constants.py b/src/karapace/backup/backends/v3/constants.py similarity index 100% rename from karapace/backup/backends/v3/constants.py rename to src/karapace/backup/backends/v3/constants.py diff --git a/karapace/backup/backends/v3/errors.py b/src/karapace/backup/backends/v3/errors.py similarity index 100% rename from karapace/backup/backends/v3/errors.py rename to src/karapace/backup/backends/v3/errors.py diff --git a/karapace/backup/backends/v3/readers.py b/src/karapace/backup/backends/v3/readers.py similarity index 100% rename from karapace/backup/backends/v3/readers.py rename to src/karapace/backup/backends/v3/readers.py diff --git a/karapace/backup/backends/v3/schema.py b/src/karapace/backup/backends/v3/schema.py similarity index 100% rename from karapace/backup/backends/v3/schema.py rename to src/karapace/backup/backends/v3/schema.py diff --git a/karapace/backup/backends/v3/schema_tool.py b/src/karapace/backup/backends/v3/schema_tool.py similarity index 89% rename from karapace/backup/backends/v3/schema_tool.py rename to src/karapace/backup/backends/v3/schema_tool.py index 5bcf7664a..65a3ea2bf 100644 --- a/karapace/backup/backends/v3/schema_tool.py +++ b/src/karapace/backup/backends/v3/schema_tool.py @@ -58,6 +58,17 @@ def relative_path(path: pathlib.Path) -> pathlib.Path: return pathlib.Path(str_path[len(cwd) + 1 :]) if str_path.startswith(cwd) else path +def target_has_source_layout(git_target: str) -> bool: + with subprocess.Popen( + ["git", "show", f"{git_target}:src"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) as cp: + if cp.returncode == 128: + return False + return True + + def check_compatibility(git_target: str) -> None: errored = False found_any = False @@ -70,8 +81,13 @@ def check_compatibility(git_target: str) -> None: subprocess.run(["git", "fetch", remote, branch], check=True, capture_output=True) + # Does the target version have source layout + source_layout = target_has_source_layout(git_target) + for file in schema_directory.glob(f"*{extension}"): relative = relative_path(file) + if source_layout: + relative = pathlib.Path(*relative.parts[1:]) with subprocess.Popen( ["git", "show", f"{git_target}:{relative}"], stdout=subprocess.PIPE, diff --git a/karapace/backup/backends/v3/writers.py b/src/karapace/backup/backends/v3/writers.py similarity index 100% rename from karapace/backup/backends/v3/writers.py rename to src/karapace/backup/backends/v3/writers.py diff --git a/karapace/backup/backends/writer.py b/src/karapace/backup/backends/writer.py similarity index 100% rename from karapace/backup/backends/writer.py rename to src/karapace/backup/backends/writer.py diff --git a/karapace/backup/cli.py b/src/karapace/backup/cli.py similarity index 100% rename from karapace/backup/cli.py rename to src/karapace/backup/cli.py diff --git a/karapace/backup/encoders.py b/src/karapace/backup/encoders.py similarity index 100% rename from karapace/backup/encoders.py rename to src/karapace/backup/encoders.py diff --git a/karapace/backup/errors.py b/src/karapace/backup/errors.py similarity index 100% rename from karapace/backup/errors.py rename to src/karapace/backup/errors.py diff --git a/karapace/backup/poll_timeout.py b/src/karapace/backup/poll_timeout.py similarity index 100% rename from karapace/backup/poll_timeout.py rename to src/karapace/backup/poll_timeout.py diff --git a/karapace/backup/safe_writer.py b/src/karapace/backup/safe_writer.py similarity index 100% rename from karapace/backup/safe_writer.py rename to src/karapace/backup/safe_writer.py diff --git a/karapace/backup/topic_configurations.py b/src/karapace/backup/topic_configurations.py similarity index 100% rename from karapace/backup/topic_configurations.py rename to src/karapace/backup/topic_configurations.py diff --git a/karapace/client.py b/src/karapace/client.py similarity index 100% rename from karapace/client.py rename to src/karapace/client.py diff --git a/karapace/compatibility/__init__.py b/src/karapace/compatibility/__init__.py similarity index 100% rename from karapace/compatibility/__init__.py rename to src/karapace/compatibility/__init__.py diff --git a/karapace/compatibility/jsonschema/__init__.py b/src/karapace/compatibility/jsonschema/__init__.py similarity index 100% rename from karapace/compatibility/jsonschema/__init__.py rename to src/karapace/compatibility/jsonschema/__init__.py diff --git a/karapace/compatibility/jsonschema/checks.py b/src/karapace/compatibility/jsonschema/checks.py similarity index 100% rename from karapace/compatibility/jsonschema/checks.py rename to src/karapace/compatibility/jsonschema/checks.py diff --git a/karapace/compatibility/jsonschema/types.py b/src/karapace/compatibility/jsonschema/types.py similarity index 100% rename from karapace/compatibility/jsonschema/types.py rename to src/karapace/compatibility/jsonschema/types.py diff --git a/karapace/compatibility/jsonschema/utils.py b/src/karapace/compatibility/jsonschema/utils.py similarity index 100% rename from karapace/compatibility/jsonschema/utils.py rename to src/karapace/compatibility/jsonschema/utils.py diff --git a/karapace/compatibility/protobuf/__init__.py b/src/karapace/compatibility/protobuf/__init__.py similarity index 100% rename from karapace/compatibility/protobuf/__init__.py rename to src/karapace/compatibility/protobuf/__init__.py diff --git a/karapace/compatibility/protobuf/checks.py b/src/karapace/compatibility/protobuf/checks.py similarity index 100% rename from karapace/compatibility/protobuf/checks.py rename to src/karapace/compatibility/protobuf/checks.py diff --git a/karapace/config.py b/src/karapace/config.py similarity index 100% rename from karapace/config.py rename to src/karapace/config.py diff --git a/karapace/constants.py b/src/karapace/constants.py similarity index 100% rename from karapace/constants.py rename to src/karapace/constants.py diff --git a/karapace/coordinator/__init__.py b/src/karapace/coordinator/__init__.py similarity index 100% rename from karapace/coordinator/__init__.py rename to src/karapace/coordinator/__init__.py diff --git a/karapace/coordinator/master_coordinator.py b/src/karapace/coordinator/master_coordinator.py similarity index 100% rename from karapace/coordinator/master_coordinator.py rename to src/karapace/coordinator/master_coordinator.py diff --git a/karapace/coordinator/schema_coordinator.py b/src/karapace/coordinator/schema_coordinator.py similarity index 100% rename from karapace/coordinator/schema_coordinator.py rename to src/karapace/coordinator/schema_coordinator.py diff --git a/karapace/dataclasses.py b/src/karapace/dataclasses.py similarity index 100% rename from karapace/dataclasses.py rename to src/karapace/dataclasses.py diff --git a/karapace/dependency.py b/src/karapace/dependency.py similarity index 100% rename from karapace/dependency.py rename to src/karapace/dependency.py diff --git a/karapace/errors.py b/src/karapace/errors.py similarity index 100% rename from karapace/errors.py rename to src/karapace/errors.py diff --git a/karapace/in_memory_database.py b/src/karapace/in_memory_database.py similarity index 100% rename from karapace/in_memory_database.py rename to src/karapace/in_memory_database.py diff --git a/karapace/instrumentation/__init__.py b/src/karapace/instrumentation/__init__.py similarity index 100% rename from karapace/instrumentation/__init__.py rename to src/karapace/instrumentation/__init__.py diff --git a/karapace/instrumentation/prometheus.py b/src/karapace/instrumentation/prometheus.py similarity index 100% rename from karapace/instrumentation/prometheus.py rename to src/karapace/instrumentation/prometheus.py diff --git a/karapace/kafka/__init__.py b/src/karapace/kafka/__init__.py similarity index 100% rename from karapace/kafka/__init__.py rename to src/karapace/kafka/__init__.py diff --git a/karapace/kafka/admin.py b/src/karapace/kafka/admin.py similarity index 100% rename from karapace/kafka/admin.py rename to src/karapace/kafka/admin.py diff --git a/karapace/kafka/common.py b/src/karapace/kafka/common.py similarity index 100% rename from karapace/kafka/common.py rename to src/karapace/kafka/common.py diff --git a/karapace/kafka/consumer.py b/src/karapace/kafka/consumer.py similarity index 100% rename from karapace/kafka/consumer.py rename to src/karapace/kafka/consumer.py diff --git a/karapace/kafka/producer.py b/src/karapace/kafka/producer.py similarity index 100% rename from karapace/kafka/producer.py rename to src/karapace/kafka/producer.py diff --git a/karapace/kafka/types.py b/src/karapace/kafka/types.py similarity index 100% rename from karapace/kafka/types.py rename to src/karapace/kafka/types.py diff --git a/karapace/kafka_error_handler.py b/src/karapace/kafka_error_handler.py similarity index 100% rename from karapace/kafka_error_handler.py rename to src/karapace/kafka_error_handler.py diff --git a/karapace/kafka_rest_apis/__init__.py b/src/karapace/kafka_rest_apis/__init__.py similarity index 100% rename from karapace/kafka_rest_apis/__init__.py rename to src/karapace/kafka_rest_apis/__init__.py diff --git a/karapace/kafka_rest_apis/authentication.py b/src/karapace/kafka_rest_apis/authentication.py similarity index 100% rename from karapace/kafka_rest_apis/authentication.py rename to src/karapace/kafka_rest_apis/authentication.py diff --git a/karapace/kafka_rest_apis/consumer_manager.py b/src/karapace/kafka_rest_apis/consumer_manager.py similarity index 100% rename from karapace/kafka_rest_apis/consumer_manager.py rename to src/karapace/kafka_rest_apis/consumer_manager.py diff --git a/karapace/kafka_rest_apis/error_codes.py b/src/karapace/kafka_rest_apis/error_codes.py similarity index 100% rename from karapace/kafka_rest_apis/error_codes.py rename to src/karapace/kafka_rest_apis/error_codes.py diff --git a/karapace/kafka_rest_apis/schema_cache.py b/src/karapace/kafka_rest_apis/schema_cache.py similarity index 100% rename from karapace/kafka_rest_apis/schema_cache.py rename to src/karapace/kafka_rest_apis/schema_cache.py diff --git a/karapace/kafka_utils.py b/src/karapace/kafka_utils.py similarity index 100% rename from karapace/kafka_utils.py rename to src/karapace/kafka_utils.py diff --git a/karapace/karapace.py b/src/karapace/karapace.py similarity index 100% rename from karapace/karapace.py rename to src/karapace/karapace.py diff --git a/karapace/karapace_all.py b/src/karapace/karapace_all.py similarity index 100% rename from karapace/karapace_all.py rename to src/karapace/karapace_all.py diff --git a/karapace/key_format.py b/src/karapace/key_format.py similarity index 100% rename from karapace/key_format.py rename to src/karapace/key_format.py diff --git a/karapace/messaging.py b/src/karapace/messaging.py similarity index 100% rename from karapace/messaging.py rename to src/karapace/messaging.py diff --git a/karapace/offset_watcher.py b/src/karapace/offset_watcher.py similarity index 100% rename from karapace/offset_watcher.py rename to src/karapace/offset_watcher.py diff --git a/karapace/protobuf/__init__.py b/src/karapace/protobuf/__init__.py similarity index 100% rename from karapace/protobuf/__init__.py rename to src/karapace/protobuf/__init__.py diff --git a/karapace/protobuf/compare_result.py b/src/karapace/protobuf/compare_result.py similarity index 100% rename from karapace/protobuf/compare_result.py rename to src/karapace/protobuf/compare_result.py diff --git a/karapace/protobuf/compare_type_lists.py b/src/karapace/protobuf/compare_type_lists.py similarity index 100% rename from karapace/protobuf/compare_type_lists.py rename to src/karapace/protobuf/compare_type_lists.py diff --git a/karapace/protobuf/compare_type_storage.py b/src/karapace/protobuf/compare_type_storage.py similarity index 100% rename from karapace/protobuf/compare_type_storage.py rename to src/karapace/protobuf/compare_type_storage.py diff --git a/karapace/protobuf/encoding_variants.py b/src/karapace/protobuf/encoding_variants.py similarity index 100% rename from karapace/protobuf/encoding_variants.py rename to src/karapace/protobuf/encoding_variants.py diff --git a/karapace/protobuf/enum_constant_element.py b/src/karapace/protobuf/enum_constant_element.py similarity index 100% rename from karapace/protobuf/enum_constant_element.py rename to src/karapace/protobuf/enum_constant_element.py diff --git a/karapace/protobuf/enum_element.py b/src/karapace/protobuf/enum_element.py similarity index 100% rename from karapace/protobuf/enum_element.py rename to src/karapace/protobuf/enum_element.py diff --git a/karapace/protobuf/exception.py b/src/karapace/protobuf/exception.py similarity index 100% rename from karapace/protobuf/exception.py rename to src/karapace/protobuf/exception.py diff --git a/karapace/protobuf/extend_element.py b/src/karapace/protobuf/extend_element.py similarity index 100% rename from karapace/protobuf/extend_element.py rename to src/karapace/protobuf/extend_element.py diff --git a/karapace/protobuf/extensions_element.py b/src/karapace/protobuf/extensions_element.py similarity index 100% rename from karapace/protobuf/extensions_element.py rename to src/karapace/protobuf/extensions_element.py diff --git a/karapace/protobuf/field.py b/src/karapace/protobuf/field.py similarity index 100% rename from karapace/protobuf/field.py rename to src/karapace/protobuf/field.py diff --git a/karapace/protobuf/field_element.py b/src/karapace/protobuf/field_element.py similarity index 100% rename from karapace/protobuf/field_element.py rename to src/karapace/protobuf/field_element.py diff --git a/karapace/protobuf/group_element.py b/src/karapace/protobuf/group_element.py similarity index 100% rename from karapace/protobuf/group_element.py rename to src/karapace/protobuf/group_element.py diff --git a/karapace/protobuf/io.py b/src/karapace/protobuf/io.py similarity index 100% rename from karapace/protobuf/io.py rename to src/karapace/protobuf/io.py diff --git a/karapace/protobuf/known_dependency.py b/src/karapace/protobuf/known_dependency.py similarity index 100% rename from karapace/protobuf/known_dependency.py rename to src/karapace/protobuf/known_dependency.py diff --git a/karapace/protobuf/kotlin_wrapper.py b/src/karapace/protobuf/kotlin_wrapper.py similarity index 100% rename from karapace/protobuf/kotlin_wrapper.py rename to src/karapace/protobuf/kotlin_wrapper.py diff --git a/karapace/protobuf/location.py b/src/karapace/protobuf/location.py similarity index 100% rename from karapace/protobuf/location.py rename to src/karapace/protobuf/location.py diff --git a/karapace/protobuf/message_element.py b/src/karapace/protobuf/message_element.py similarity index 100% rename from karapace/protobuf/message_element.py rename to src/karapace/protobuf/message_element.py diff --git a/karapace/protobuf/one_of_element.py b/src/karapace/protobuf/one_of_element.py similarity index 100% rename from karapace/protobuf/one_of_element.py rename to src/karapace/protobuf/one_of_element.py diff --git a/karapace/protobuf/option_element.py b/src/karapace/protobuf/option_element.py similarity index 100% rename from karapace/protobuf/option_element.py rename to src/karapace/protobuf/option_element.py diff --git a/karapace/protobuf/option_reader.py b/src/karapace/protobuf/option_reader.py similarity index 100% rename from karapace/protobuf/option_reader.py rename to src/karapace/protobuf/option_reader.py diff --git a/karapace/protobuf/proto_file_element.py b/src/karapace/protobuf/proto_file_element.py similarity index 100% rename from karapace/protobuf/proto_file_element.py rename to src/karapace/protobuf/proto_file_element.py diff --git a/karapace/protobuf/proto_normalizations.py b/src/karapace/protobuf/proto_normalizations.py similarity index 100% rename from karapace/protobuf/proto_normalizations.py rename to src/karapace/protobuf/proto_normalizations.py diff --git a/karapace/protobuf/proto_parser.py b/src/karapace/protobuf/proto_parser.py similarity index 100% rename from karapace/protobuf/proto_parser.py rename to src/karapace/protobuf/proto_parser.py diff --git a/karapace/protobuf/proto_type.py b/src/karapace/protobuf/proto_type.py similarity index 100% rename from karapace/protobuf/proto_type.py rename to src/karapace/protobuf/proto_type.py diff --git a/karapace/protobuf/protobuf_to_dict.py b/src/karapace/protobuf/protobuf_to_dict.py similarity index 100% rename from karapace/protobuf/protobuf_to_dict.py rename to src/karapace/protobuf/protobuf_to_dict.py diff --git a/karapace/protobuf/protopace/__init__.py b/src/karapace/protobuf/protopace/__init__.py similarity index 100% rename from karapace/protobuf/protopace/__init__.py rename to src/karapace/protobuf/protopace/__init__.py diff --git a/karapace/protobuf/protopace/protopace.py b/src/karapace/protobuf/protopace/protopace.py similarity index 100% rename from karapace/protobuf/protopace/protopace.py rename to src/karapace/protobuf/protopace/protopace.py diff --git a/karapace/protobuf/reserved_element.py b/src/karapace/protobuf/reserved_element.py similarity index 100% rename from karapace/protobuf/reserved_element.py rename to src/karapace/protobuf/reserved_element.py diff --git a/karapace/protobuf/rpc_element.py b/src/karapace/protobuf/rpc_element.py similarity index 100% rename from karapace/protobuf/rpc_element.py rename to src/karapace/protobuf/rpc_element.py diff --git a/karapace/protobuf/schema.py b/src/karapace/protobuf/schema.py similarity index 100% rename from karapace/protobuf/schema.py rename to src/karapace/protobuf/schema.py diff --git a/karapace/protobuf/serialization.py b/src/karapace/protobuf/serialization.py similarity index 100% rename from karapace/protobuf/serialization.py rename to src/karapace/protobuf/serialization.py diff --git a/karapace/protobuf/service_element.py b/src/karapace/protobuf/service_element.py similarity index 100% rename from karapace/protobuf/service_element.py rename to src/karapace/protobuf/service_element.py diff --git a/karapace/protobuf/syntax.py b/src/karapace/protobuf/syntax.py similarity index 100% rename from karapace/protobuf/syntax.py rename to src/karapace/protobuf/syntax.py diff --git a/karapace/protobuf/syntax_reader.py b/src/karapace/protobuf/syntax_reader.py similarity index 100% rename from karapace/protobuf/syntax_reader.py rename to src/karapace/protobuf/syntax_reader.py diff --git a/karapace/protobuf/type_element.py b/src/karapace/protobuf/type_element.py similarity index 100% rename from karapace/protobuf/type_element.py rename to src/karapace/protobuf/type_element.py diff --git a/karapace/protobuf/type_tree.py b/src/karapace/protobuf/type_tree.py similarity index 100% rename from karapace/protobuf/type_tree.py rename to src/karapace/protobuf/type_tree.py diff --git a/karapace/protobuf/utils.py b/src/karapace/protobuf/utils.py similarity index 100% rename from karapace/protobuf/utils.py rename to src/karapace/protobuf/utils.py diff --git a/karapace/rapu.py b/src/karapace/rapu.py similarity index 100% rename from karapace/rapu.py rename to src/karapace/rapu.py diff --git a/karapace/schema_models.py b/src/karapace/schema_models.py similarity index 100% rename from karapace/schema_models.py rename to src/karapace/schema_models.py diff --git a/karapace/schema_reader.py b/src/karapace/schema_reader.py similarity index 100% rename from karapace/schema_reader.py rename to src/karapace/schema_reader.py diff --git a/karapace/schema_references.py b/src/karapace/schema_references.py similarity index 100% rename from karapace/schema_references.py rename to src/karapace/schema_references.py diff --git a/karapace/schema_registry.py b/src/karapace/schema_registry.py similarity index 100% rename from karapace/schema_registry.py rename to src/karapace/schema_registry.py diff --git a/karapace/schema_registry_apis.py b/src/karapace/schema_registry_apis.py similarity index 100% rename from karapace/schema_registry_apis.py rename to src/karapace/schema_registry_apis.py diff --git a/karapace/schema_type.py b/src/karapace/schema_type.py similarity index 100% rename from karapace/schema_type.py rename to src/karapace/schema_type.py diff --git a/karapace/sentry/__init__.py b/src/karapace/sentry/__init__.py similarity index 100% rename from karapace/sentry/__init__.py rename to src/karapace/sentry/__init__.py diff --git a/karapace/sentry/sentry_client.py b/src/karapace/sentry/sentry_client.py similarity index 100% rename from karapace/sentry/sentry_client.py rename to src/karapace/sentry/sentry_client.py diff --git a/karapace/sentry/sentry_client_api.py b/src/karapace/sentry/sentry_client_api.py similarity index 100% rename from karapace/sentry/sentry_client_api.py rename to src/karapace/sentry/sentry_client_api.py diff --git a/karapace/serialization.py b/src/karapace/serialization.py similarity index 100% rename from karapace/serialization.py rename to src/karapace/serialization.py diff --git a/karapace/statsd.py b/src/karapace/statsd.py similarity index 100% rename from karapace/statsd.py rename to src/karapace/statsd.py diff --git a/karapace/typing.py b/src/karapace/typing.py similarity index 100% rename from karapace/typing.py rename to src/karapace/typing.py diff --git a/karapace/utils.py b/src/karapace/utils.py similarity index 100% rename from karapace/utils.py rename to src/karapace/utils.py