Skip to content

Improve CI: Add Python 3.13, optimize linting, and fix unused import#4

Merged
chopratejas merged 3 commits intochopratejas:mainfrom
pythoninthegrasses:main
Jan 15, 2026
Merged

Improve CI: Add Python 3.13, optimize linting, and fix unused import#4
chopratejas merged 3 commits intochopratejas:mainfrom
pythoninthegrasses:main

Conversation

@pythoninthegrass
Copy link
Copy Markdown
Contributor

Summary

This PR includes three improvements to the CI workflow and test suite:

  1. Add Python 3.13 support - Extends the test matrix to include Python 3.13
  2. Optimize linting steps - Runs linting and type checking only on Python 3.12 instead of all versions, saving CI time and resources
  3. Use oldest Python for builds - Changes package build to use Python 3.10 (oldest supported) for maximum compatibility
  4. Fix unused import - Removes unused ProxyConfig import that was causing linting failures

Changes

  • Add Python 3.13 to the CI test matrix
  • Add conditional execution to linting/type checking (only run on Python 3.12)
  • Change build job from Python 3.11 to Python 3.10
  • Remove unused ProxyConfig import from compression tests

Benefits

  • Tests now run on 4 Python versions (3.10, 3.11, 3.12, 3.13)
  • CI runs faster by avoiding redundant linting on all Python versions
  • Package builds follow best practice of using oldest supported version
  • All linting checks now pass

Testing

All workflows passing: https://github.com/pythoninthegrass/headroom/actions/runs/21017516162

🤖 Generated with Claude Code

pythoninthegrass and others added 3 commits January 14, 2026 20:26
Adds Python 3.13 to the test matrix. Optimizes CI by running linting
and type checking only on Python 3.12 instead of all versions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Build artifacts with Python 3.10 to ensure maximum compatibility
and avoid accidentally using newer features in build tooling.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixes linting error F401 where ProxyConfig was imported but never used.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@chopratejas chopratejas merged commit 0022a1e into chopratejas:main Jan 15, 2026
7 checks passed
chopratejas added a commit that referenced this pull request Jan 21, 2026
Improve CI: Add Python 3.13, optimize linting, and fix unused import
chopratejas added a commit that referenced this pull request Jan 24, 2026
Previously, _gemini_contents_to_messages() only extracted text parts,
silently dropping non-text content like images, file references, and
function calls. This caused data loss when processing multimodal content.

Changes:
- Add _has_non_text_parts() helper to detect inlineData, fileData,
  functionCall, and functionResponse parts
- Modify _gemini_contents_to_messages() to return tuple of (messages,
  preserved_indices) tracking which content entries have non-text parts
- Update all call sites to preserve non-text content entries:
  - handle_google_batch_create
  - handle_gemini_generate_content
  - handle_gemini_count_tokens
  - _store_google_batch_context
- Skip compression entirely when all content has non-text parts
- Restore preserved entries after compression/optimization

Add comprehensive test coverage (54 tests) verifying:
- Detection of all non-text part types
- Correct index tracking in preserved_indices
- Role mapping and message conversion
- Realistic conversation flows with images, function calls, PDFs
chopratejas added a commit that referenced this pull request Jan 25, 2026
Tests verify with actual Google Gemini API calls that:
- Text-only requests work normally
- Image requests (inlineData) are processed correctly
- Function calling works (functionCall in response)
- Function response flow works (functionResponse preserved)
- Mixed conversations (text + images) work through proxy

All tests pass both direct to API and through Headroom proxy,
confirming Gap #4 fix works end-to-end.
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.

2 participants