Make external service clients optional - #176
Open
Gerrrr wants to merge 2 commits into
Open
Conversation
Gerrrr
force-pushed
the
dependency-extras
branch
from
August 29, 2026 19:06
d9f9cad to
2c28fe2
Compare
There was a problem hiding this comment.
Pull request overview
Makes external service clients optional while keeping core analysis, CLI, and built-in sources available by default.
Changes:
- Adds per-integration extras and lazy client imports.
- Adds missing-dependency handling and core-install tests.
- Updates Docker, CI, and installation documentation.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
Defines integration extras and local dev dependencies. |
uv.lock |
Locks the revised dependency structure. |
otava/_optional.py |
Adds optional-import error handling. |
otava/bigquery.py |
Lazily imports BigQuery clients. |
otava/grafana.py |
Lazily imports Requests. |
otava/importer.py |
Lazily creates BigQuery parameters. |
otava/influxdb.py |
Lazily imports the InfluxDB client. |
otava/main.py |
Lazily initializes Slack and handles missing extras. |
otava/postgres.py |
Lazily imports pg8000. |
otava/slack.py |
Lazily imports the Slack SDK. |
tests/core_install_smoke.py |
Tests a clean core installation. |
tests/optional_dependencies_test.py |
Tests optional-import behavior. |
.github/workflows/python-app.yml |
Adds the core-wheel CI job. |
Dockerfile |
Installs all integrations in production images. |
README.md |
Documents installation extras. |
docs/INSTALL.md |
Lists available extras. |
docs/GETTING_STARTED.md |
Updates setup instructions. |
docs/BIG_QUERY.md |
Documents the BigQuery extra. |
docs/GRAFANA.md |
Documents the Grafana extra. |
docs/INFLUXDB.md |
Documents the InfluxDB extra. |
docs/POSTGRESQL.md |
Documents the PostgreSQL extra. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Gerrrr
force-pushed
the
dependency-extras
branch
2 times, most recently
from
August 30, 2026 04:25
e274b70 to
f5cc644
Compare
Otava currently installs every database and notification client even when callers only need the analysis library, bundled CLI, or built-in data sources. Split BigQuery, PostgreSQL, InfluxDB, Grafana, and Slack clients into installable extras so users pay only for the integrations they need. Keep the production image's existing all-integrations behavior through the all extra, move contributor tools into the unpublished dev dependency group, load optional clients lazily with actionable installation errors, and verify a clean core wheel in CI. Update installation and integration documentation to describe the new choices.
Running the documented workflows exposed stale paths, timestamps, output, date selectors, and malformed code fences. Add a runnable source-checkout CSV configuration with regression coverage and align the CSV, Graphite, Grafana, PostgreSQL, and InfluxDB examples with the bundled fixtures.
Gerrrr
force-pushed
the
dependency-extras
branch
from
August 30, 2026 04:34
f5cc644 to
201354a
Compare
Gerrrr
marked this pull request as ready for review
August 30, 2026 04:36
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
pip install apache-otavacurrently installs every database and notification client, even when the caller only needs the analysis library, bundled CLI, built-in CSV and JSON sources, or the bundled NoSQLBench HistoStat and Graphite importers. This PR makes the default installation useful on its own while letting users opt into only the external services they need.Measured impact
Fresh measurements from the wheel built from this branch:
influxdbinfluxdb3-pythonbigquery--update-bigquerygoogle-cloud-bigqueryslack--notify-slackslack-sdkgrafana--update-grafana,remove-annotationsrequestspostgres--update-postgrespg8000allThe default installation avoids 212.2 MB (58.9%) and 29 packages (60.4%) compared with the full integration set.
NoSQLBench HistoStat and Graphite support remain bundled because their implementations add no external Python dependencies, so making them extras would not reduce installation size. We may still extract them into separate packages or plugins as follow-up work.
Measured on Python 3.14.7 on macOS arm64 using wheel-only installs with bytecode compilation and a fresh environment for each row. Installed size is the sum of file sizes under
site-packages. Absolute results vary by platform, but these measurements closely match those reported in #175.Installation examples
The production Docker image continues to include every integration by installing
[all].Contributor-only tools now live in the local
devdependency group rather than apublished
[dev]extra. A full contributor environment is installed with:uv sync --all-extras --devWhat changed
allextra.[dev]extra and into the standardized localdevdependency group.[all]in the production Docker image.Note
Exercising the documented workflows during testing also uncovered pre-existing
documentation issues, including stale paths, dates and expected output. Those
corrections and their executable CSV regression coverage are included in a
separate commit.
Verification
245 passedacross the complete test and performance suite, including Docker-backed Graphite, InfluxDB, and PostgreSQL end-to-end tests.[all]wheel: 48 packages and all service client imports pass.otava --helpruns successfully.Closes #55
Closes #175