Skip to content

feat: multi-Python CI and callback serialization#95

Open
acere wants to merge 6 commits into
awslabs:mainfrom
acere:feat/multi-python-ci
Open

feat: multi-Python CI and callback serialization#95
acere wants to merge 6 commits into
awslabs:mainfrom
acere:feat/multi-python-ci

Conversation

@acere

@acere acere commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • CI workflow: Add .github/workflows/ci.yml with lint (ruff, bandit) and test jobs. The test matrix is dynamically derived from pyproject.toml classifiers, so adding/removing a Python version only requires updating one file.
  • Python 3.10 compatibility: Constrain dependencies (onnxruntime, gevent) that dropped 3.10 wheels, fix f-string syntax, and replace standalone mock imports with unittest.mock.
  • Callback serialization: Implement to_dict/from_dict on Callback base class using a _callback_type marker ("module:ClassName") for dynamic dispatch. Any Callback subclass—built-in or third-party—can now round-trip through JSON without a hardcoded registry. _RunConfig.save()/load() now serialize and restore callbacks.

Test plan

  • uv run pytest --cov=llmeter -m "not integ" passes (921 tests, 89% coverage)
  • CI workflow runs on this PR (validates Python 3.10–3.13 matrix)
  • Verify classifiers badge renders correctly on PyPI

acere added 2 commits July 16, 2026 20:45
Implement to_dict/from_dict on Callback base class using a
"module:ClassName" type marker (_callback_type) for dynamic dispatch.
Any Callback subclass — built-in or third-party — can now round-trip
through JSON without a hardcoded registry.

- Callback.to_dict() emits _callback_type with fully-qualified class path
- Callback.from_dict() dynamically imports and instantiates the correct
  subclass, delegating to overridden from_dict when present
- CostModel.to_dict() injects _callback_type alongside existing _type
- CostModel.from_dict() strips both markers before construction
- MlflowCallback gains to_dict/from_dict (replaces NotImplementedError stubs)
- _RunConfig.save()/load() now serialize and restore callbacks
- Replace old Callback base tests with serialization round-trip tests
- Add uv constraint-dependencies to cap onnxruntime<1.24 and gevent<25.5
  on Python 3.10 (newer versions dropped cp310 wheels)
- Set default-groups to exclude heavy dev group (sagemaker) from test runs
- Rewrite multiline f-string in heatmap.py to 3.10-compatible syntax
- Replace standalone mock package imports with stdlib unittest.mock
@acere
acere force-pushed the feat/multi-python-ci branch 2 times, most recently from 7b145ac to a9e0560 Compare July 16, 2026 12:58
Add CI workflow (.github/workflows/ci.yml) with lint and test jobs.
The test matrix is dynamically derived from pyproject.toml classifiers,
so adding/removing a Python version only requires updating one file.

Uses actions/checkout@v7 and astral-sh/[email protected] (Node.js 22+).
setup-uv handles Python installation directly, no setup-python needed.

Also add trove classifiers to pyproject.toml.
@acere
acere force-pushed the feat/multi-python-ci branch from a9e0560 to 8ac34f4 Compare July 16, 2026 13:02
acere added 3 commits July 16, 2026 21:12
- Set dummy AWS credentials and region in test step env
- Add ruff, bandit, and ipykernel to test dependency group
- Scope ruff/format to llmeter/ and tests/ (skip example notebooks)
- Add ruff, bandit, ipykernel to test dependency group
- Fix abstract class error message match for Python 3.10
- Add audio/wave MIME type support in OpenAI endpoint
- Handle missing task.cancelling() on Python 3.10
- Remove unused imports and variables in tests
- Full Python version matrix (from classifiers) on pull_request
- Lint + Python 3.12 tests only on push to main
- Skip CI entirely for docs-only changes (docs/**, *.md)
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