Skip to content

refactor: nightly hardening - pydantic config migration#15

Open
mouse-value-add wants to merge 1 commit intobrainsparker:mainfrom
mouse-value-add:chore/nightly-hardening-20260430-pydantic-configdict-migration
Open

refactor: nightly hardening - pydantic config migration#15
mouse-value-add wants to merge 1 commit intobrainsparker:mainfrom
mouse-value-add:chore/nightly-hardening-20260430-pydantic-configdict-migration

Conversation

@mouse-value-add
Copy link
Copy Markdown
Contributor

Problem

PromptLens still used Pydantic v1-style in core models, which emits deprecation warnings on Pydantic v2 and increases risk during future dependency upgrades.

Approach

  • Replaced remaining usages with in:

  • Preserved existing behavior for and examples.

Verification

  • Ran test suite: ============================= test session starts ==============================
    platform darwin -- Python 3.12.13, pytest-9.0.3, pluggy-1.6.0
    rootdir: /Users/mouse/.openclaw/workspace/PromptLens
    configfile: pyproject.toml
    testpaths: tests
    plugins: cov-7.1.0, anyio-4.13.0
    collected 9 items

tests/test_cli_hardening.py ... [ 33%]
tests/test_http_provider_response_parsing.py .... [ 77%]
tests/test_loader_top_level_validation.py .. [100%]

=============================== warnings summary ===============================
promptlens/providers/google.py:8
/Users/mouse/.openclaw/workspace/PromptLens/promptlens/providers/google.py:8: FutureWarning:

All support for the google.generativeai package has ended. It will no longer be receiving
updates or bug fixes. Please switch to the google.genai package as soon as possible.
See README for more details:

https://github.com/google-gemini/deprecated-generative-ai-python/blob/main/README.md

import google.generativeai as genai

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================ tests coverage ================================
______________ coverage: platform darwin, python 3.12.13-final-0 _______________

Name Stmts Miss Cover

promptlens/init.py 3 0 100%
promptlens/main.py 3 3 0%
promptlens/cli.py 169 120 29%
promptlens/exporters/init.py 6 0 100%
promptlens/exporters/base.py 15 5 67%
promptlens/exporters/csv_exporter.py 26 14 46%
promptlens/exporters/html_exporter.py 38 25 34%
promptlens/exporters/json_exporter.py 16 6 62%
promptlens/exporters/markdown_exporter.py 77 66 14%
promptlens/judges/init.py 3 0 100%
promptlens/judges/base.py 15 3 80%
promptlens/judges/llm_judge.py 71 50 30%
promptlens/judges/parser.py 107 97 9%
promptlens/judges/prompts.py 30 25 17%
promptlens/loaders/init.py 4 0 100%
promptlens/loaders/base.py 14 3 79%
promptlens/loaders/json_loader.py 23 8 65%
promptlens/loaders/yaml_loader.py 34 17 50%
promptlens/models/init.py 4 0 100%
promptlens/models/config.py 40 0 100%
promptlens/models/result.py 60 13 78%
promptlens/models/test_case.py 23 0 100%
promptlens/models/tools.py 73 34 53%
promptlens/providers/init.py 3 0 100%
promptlens/providers/anthropic.py 52 32 38%
promptlens/providers/base.py 23 6 74%
promptlens/providers/factory.py 21 10 52%
promptlens/providers/google.py 47 28 40%
promptlens/providers/http.py 67 26 61%
promptlens/providers/openai.py 57 36 37%
promptlens/providers/you.py 57 39 32%
promptlens/runners/init.py 2 0 100%
promptlens/runners/runner.py 96 74 23%
promptlens/utils/init.py 1 0 100%
promptlens/utils/cost.py 15 11 27%
promptlens/utils/diff.py 25 25 0%
promptlens/utils/retry.py 21 15 29%
promptlens/utils/timing.py 24 13 46%

TOTAL 1365 804 41%
Coverage HTML written to dir htmlcov
========================= 9 passed, 1 warning in 1.80s =========================

  • Result: 9 passed
  • Confirmed Pydantic deprecation warnings from these model modules are removed.

Risks

  • Low risk, this is a compatibility-focused refactor with no intended runtime behavior changes.

Rollback plan

  • Revert commit to restore prior model configuration style if unexpected issues appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant