diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index ad76d3d..438028c 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -10,12 +10,17 @@ env: jobs: pytest: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + version: ["3.10", "3.11", "3.12"] + steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version-file: .python-version + python-version: ${{ matrix.version }} - name: Install Dependencies run: make install diff --git a/paracelsus/pyproject.py b/paracelsus/pyproject.py index 7bd81c6..02df80d 100644 --- a/paracelsus/pyproject.py +++ b/paracelsus/pyproject.py @@ -1,8 +1,12 @@ import os -import tomllib from pathlib import Path from typing import Any, Dict +try: + import tomllib +except: # noqa: E722 + import toml as tomllib # type: ignore + def get_pyproject_settings(dir: Path = Path(os.getcwd())) -> Dict[str, Any] | None: pyproject = dir / "pyproject.toml" @@ -11,6 +15,6 @@ def get_pyproject_settings(dir: Path = Path(os.getcwd())) -> Dict[str, Any] | No return None with open(pyproject, "rb") as f: - data = tomllib.load(f) + data = tomllib.loads(f.read().decode()) return data.get("tool", {}).get("paracelsus", None) diff --git a/pyproject.toml b/pyproject.toml index cdd7651..728f246 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,8 @@ authors = [{"name" = "Robert Hafner"}] dependencies = [ "pydot", "sqlalchemy", - "typer" + "typer", + "toml; python_version < '3.11'" ] description = "" dynamic = ["version"] diff --git a/tests/assets/example/models.py b/tests/assets/example/models.py index 7b879c6..bfeb658 100644 --- a/tests/assets/example/models.py +++ b/tests/assets/example/models.py @@ -1,4 +1,4 @@ -from datetime import UTC, datetime +from datetime import datetime, timezone from uuid import uuid4 from sqlalchemy import Boolean, DateTime, ForeignKey, String, Text, Uuid @@ -6,6 +6,8 @@ from .base import Base +UTC = timezone.utc + class User(Base): __tablename__ = "users" diff --git a/tests/conftest.py b/tests/conftest.py index aa19311..4b326b8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,7 @@ import os import shutil import tempfile -from datetime import UTC, datetime +from datetime import datetime, timezone from pathlib import Path from uuid import uuid4 @@ -9,6 +9,8 @@ from sqlalchemy import Boolean, DateTime, ForeignKey, String, Text, Uuid from sqlalchemy.orm import declarative_base, mapped_column +UTC = timezone.utc + @pytest.fixture def metaclass():