Skip to content

Define the public API in otava/__init__.py - #179

Open
MrlixiangWE wants to merge 2 commits into
apache:masterfrom
MrlixiangWE:feat/101-public-api
Open

MrlixiangWE wants to merge 2 commits into
apache:masterfrom
MrlixiangWE:feat/101-public-api

Conversation

@MrlixiangWE

@MrlixiangWE MrlixiangWE commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Expose nine names from otava, including Series, AnalysisOptions and
compute_change_points, and document their use in docs/API.md. Existing
submodule imports remain available.

The package root now loads SciPy, so importing a lightweight module such as
otava.csv_options also loads those dependencies.
Median import overhead in milliseconds, measured over 21 runs per checkout,
alternating base and branch, on a 4-core QEMU/KVM VM with Python 3.12.14.
Each sample subtracts a separate Python startup measurement, which can yield
negative estimates.

Import d2d51c9 610066f
otava -1 593
otava.csv_options 17 581
otava.util 168 818
otava.series 598 601
otava.main 842 866

The tests check the documented export names against __all__, check option
names and defaults against AnalysisOptions(), and run the documentation
examples. The wheel smoke test checks the installed package's exports and
calls compute_change_points without extras.

Verified on Ubuntu 22.04 / x86_64 with uv sync --locked --all-extras --dev:
248 tests passed on each of Python 3.10.21, 3.11.16, 3.12.14, 3.13.15 and
3.14.7; the same suite passed 241 tests on d2d51c9. This covers tests and
perf, excluding the Graphite, PostgreSQL and InfluxDB container e2e modules.
On Python 3.12.14, sphinx-build -W --keep-going passed on both checkouts.
A wheel built from this branch passed tests/core_install_smoke.py in an
installation without extras.

Closes #101

otava had no __init__.py, so `import otava` gave an empty namespace package and
the types a library user needs were spread over three submodules. Re-export
them from the package root, and document the surface in docs/API.md.

Closes apache#101
@henrikingo

Copy link
Copy Markdown
Contributor

Thanks MirliangWE! I hope to review this soon.Defining an API for Otava use in a library is a valuable addition.

@MrlixiangWE

Copy link
Copy Markdown
Contributor Author

Thanks, Henrik! I’ve also pushed a small follow-up to clarify the documentation around timestamp handling and the supported import surface.

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.

API for using Otava as a library

2 participants