Skip to content

Improve API and Configuration#4

Merged
folded merged 5 commits into
mainfrom
improve-api-and-config
Jan 5, 2026
Merged

Improve API and Configuration#4
folded merged 5 commits into
mainfrom
improve-api-and-config

Conversation

@folded
Copy link
Copy Markdown
Owner

@folded folded commented Jan 5, 2026

This PR addresses several usability improvements and configuration enhancements:

  • API Changes:

    • process_document signature updated to standard (file_path, settings, ...) order.
    • file_path now accepts strings.
    • process_document and Settings are now exposed at the top level (from gemini_ocr import process_document).
  • Configuration:

    • Settings class now supports loading from environment variables (e.g., GEMINI_OCR_PROJECT).
    • Added defaults for locations and optional fields.
  • Tests:

    • Added tests/test_settings.py.
    • Updated existing tests to reflect API changes.

- Changed `process_document` signature to `(file_path, settings=None, ...)`.
- Allowed `file_path` to be a string.
- Exposed `process_document` and `Settings` at the top-level package.
- Updated `Settings` to load from environment variables and provided better defaults.
- Updated tests to match API changes and added new settings tests.
gemini-code-assist[bot]

This comment was marked as outdated.

folded added 2 commits January 5, 2026 13:26
- Add return type annotations to `tests/test_settings.py`.
- Combine nested `with` statements in `tests/test_settings.py`.
- Fix argument order for `process_document` in `run_ocr.py`.
Repository owner deleted a comment from gemini-code-assist Bot Jan 5, 2026
@folded
Copy link
Copy Markdown
Owner Author

folded commented Jan 5, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the API usability and configuration management of the gemini-ocr package. The changes, such as refining the process_document signature, exposing key components at the top level, and enabling configuration from environment variables, are well-implemented. The accompanying test updates and additions are also thorough. My review includes a few suggestions for further refinement, mainly around improving code maintainability by reducing duplication and enhancing the new configuration loading mechanism. Overall, this is a strong contribution that enhances the library's flexibility.

Comment thread src/gemini_ocr/gemini_ocr.py Outdated
Comment thread src/gemini_ocr/settings.py
Comment thread src/gemini_ocr/settings.py Outdated
Comment thread tests/test_settings.py Outdated
@folded folded merged commit 6023259 into main Jan 5, 2026
2 checks passed
@folded folded deleted the improve-api-and-config branch January 5, 2026 05:31
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