From 75923363e929e7c460878ce2e084e33331d1d135 Mon Sep 17 00:00:00 2001 From: Francesco Calcavecchia Date: Mon, 30 Oct 2023 11:20:08 +0100 Subject: [PATCH] remove pandera dependencies in src --- .github/workflows/actions.yml | 6 +++--- .gitlab-ci.yml | 10 ++++------ src/dac/_input/config.py | 11 +++-------- src/dac/_input/interface.py | 7 +++++++ 4 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 src/dac/_input/interface.py diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index eb27b82..00de107 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -19,7 +19,7 @@ jobs: - name: Setup python 🐍 uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.12' - name: Setup cache πŸ’Ύ uses: actions/cache@v3 with: @@ -39,7 +39,7 @@ jobs: strategy: matrix: os: ["ubuntu-latest"] - version: ["3.9", "3.10", "3.11"] + version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout πŸ”– uses: actions/checkout@v3 @@ -84,7 +84,7 @@ jobs: - name: Setup python 🐍 uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - name: Prepare release πŸ™†β€β™‚οΈπŸ“¦test run: | python -m venv venv || . venv/bin/activate diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc6582c..5ca52be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,6 @@ stages: - verification - deployment - check style: stage: verification before_script: @@ -13,7 +12,6 @@ check style: script: - pre-commit run - test: image: $image stage: verification @@ -25,10 +23,10 @@ test: parallel: matrix: - image: - - "python:3.9" - - "python:3.10" - - "python:3.11" - + - "python:3.9" + - "python:3.10" + - "python:3.11" + - "python:3.12" deploy package: stage: deployment diff --git a/src/dac/_input/config.py b/src/dac/_input/config.py index 491fed8..f9be80a 100644 --- a/src/dac/_input/config.py +++ b/src/dac/_input/config.py @@ -5,9 +5,8 @@ from pathlib import Path from typing import Optional -import pandera as pa - from dac._file_helper import temporarily_copied_file +from dac._input.interface import Validator from dac._input.pyproject import PyProjectConfig @@ -65,7 +64,7 @@ def _check_schema_contains_expected_class(self) -> None: ) from e try: - issubclass(pkg.Schema, pa.SchemaModel) + issubclass(pkg.Schema, Validator) except Exception as e: raise ValueError( (f"{self.schema_path.as_posix()} does not contain the required `class Schema(pa.SchemaModel)`") @@ -99,9 +98,5 @@ def _check_schema_match_data(self) -> None: try: schema_module.Schema.validate(data, lazy=True) - except pa.errors.SchemaErrors as e: - raise ValueError("Validation of the schema against the data has failed:" "\n" f"{e.failure_cases}") from e except Exception as e: - raise ValueError( - "Validation of the schema against the data has failed for unexpected reasons:" "\n" f"{e}" - ) from e + raise ValueError("Validation of the schema against the data has failed:" "\n" f"{e}") from e diff --git a/src/dac/_input/interface.py b/src/dac/_input/interface.py new file mode 100644 index 0000000..7b34063 --- /dev/null +++ b/src/dac/_input/interface.py @@ -0,0 +1,7 @@ +from typing import Any, Protocol, runtime_checkable + + +@runtime_checkable +class Validator(Protocol): + def validate(self, check_obj: Any, *args, **kwargs) -> Any: + pass