From 19cc774680b0a6d0f10b7f57d1ec79546e00f68f Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Mon, 8 Jul 2024 13:43:33 -0400 Subject: [PATCH] fix: fix pydantic smart union in older versions, and add minreqs test (#178) * add minreqs test * bump * use main * pin higher --- .github/workflows/ci.yml | 14 +++++++++++++- pyproject.toml | 2 +- src/useq/_mda_sequence.py | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fda18f5..d5c8a7a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,9 +34,21 @@ jobs: - os: ubuntu-latest python-version: "3.8" + test-minreqs: + uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@main + with: + os: ubuntu-latest + python-version: ${{ matrix.python-version }} + pip-install-min-reqs: true + coverage-upload: artifact + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.12"] + upload_coverage: if: always() - needs: [test] + needs: [test, test-minreqs] uses: pyapp-kit/workflows/.github/workflows/upload-coverage.yml@v2 secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 7efb8c2e..75df06c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ classifiers = [ "Typing :: Typed", ] dynamic = ["version"] -dependencies = ["pydantic >=2,!=2.4.1", "numpy", "typing-extensions"] +dependencies = ["pydantic >=2.6", "numpy", "typing-extensions"] # extras # https://peps.python.org/pep-0621/#dependencies-optional-dependencies diff --git a/src/useq/_mda_sequence.py b/src/useq/_mda_sequence.py index 726966f7..dc9e2eeb 100644 --- a/src/useq/_mda_sequence.py +++ b/src/useq/_mda_sequence.py @@ -184,7 +184,9 @@ class MDASequence(UseqModel): stage_positions: Union[WellPlatePlan, Tuple[Position, ...]] = Field( default_factory=tuple ) - grid_plan: Optional[MultiPointPlan] = None + grid_plan: Optional[MultiPointPlan] = Field( + default=None, union_mode="left_to_right" + ) channels: Tuple[Channel, ...] = Field(default_factory=tuple) time_plan: Optional[AnyTimePlan] = None z_plan: Optional[AnyZPlan] = None