Skip to content

fix: align provider mypy/test with op_engine pattern#52

Merged
jc-macdonald merged 1 commit intomainfrom
fix/51-provider-mypy
Apr 8, 2026
Merged

fix: align provider mypy/test with op_engine pattern#52
jc-macdonald merged 1 commit intomainfrom
fix/51-provider-mypy

Conversation

@jc-macdonald
Copy link
Copy Markdown
Collaborator

Fix provider mypy type-checking failures caused by incorrect mypy configuration in the provider subpackage.

Problem

mypy-provider fails with:

Module "op_system" does not explicitly export attribute "CompiledRhs"
Module "op_system" does not explicitly export attribute "compile_spec"

Root cause: the provider's [tool.mypy] in pyproject.toml set mypy_path = "$MYPY_CONFIG_FILE_DIR/src" and explicit_package_bases = true, which caused mypy to resolve src/flepimop2/system/op_system/__init__.py as the top-level module op_system — shadowing the installed op_system package.

Fix

Align the provider build/check pattern with op_engine's working approach:

  1. Remove [tool.mypy] from flepimop2-op_system/pyproject.toml — provider mypy is driven entirely from the justfile CLI.
  2. Add provider-sync recipe — creates a clean .venv in the provider directory and installs all deps (including flepimop2 from git and op-system from the parent directory).
  3. Update mypy-provider — uses provider-sync as a dependency, invokes mypy via .venv/bin/python -m mypy --strict --namespace-packages --explicit-package-bases src/flepimop2 so mypy resolves the namespace package tree correctly.
  4. Update test-provider — uses provider-sync and .venv/bin/python -m pytest for the same isolation.

Validation

  • just mypy-providerSuccess: no issues found in 1 source file
  • just test → 62 root tests + 3 provider tests pass
  • just ci-ruff → all checks pass

Closes #51

Remove [tool.mypy] from provider pyproject.toml — it set mypy_path and
explicit_package_bases which caused mypy to resolve the namespace package
tree as a top-level module, shadowing the installed op_system package.

Provider mypy is now driven entirely from the justfile CLI with
--namespace-packages --explicit-package-bases flags. Add provider-sync
recipe (matching op_engine) to create an isolated venv for provider
checks.

Closes #51
@jc-macdonald jc-macdonald added bug Something isn't working provider flepimop2 provider/connector package ci-cd Build, release, and CI pipeline labels Apr 8, 2026
@jc-macdonald jc-macdonald self-assigned this Apr 8, 2026
@jc-macdonald jc-macdonald added this to the Provider Integration milestone Apr 8, 2026
@jc-macdonald jc-macdonald merged commit 7249b8a into main Apr 8, 2026
5 checks passed
@jc-macdonald jc-macdonald deleted the fix/51-provider-mypy branch April 8, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci-cd Build, release, and CI pipeline provider flepimop2 provider/connector package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix provider package mypy error: StateChangeEnum not found in flepimop2.typing

2 participants