6.0: define the public API and ship py.typed
Why
EdgarTools has grown organically, and the boundary between public API and internals is implicit. That hurts twice: users can't tell which import paths are stable, and type checkers can't see our annotations at all because no py.typed marker ships.
Scope
- Declare the public API: explicit
__all__, documented stable import paths, underscore-prefix (or documented-private) internals. - Ship the
py.typedmarker so downstreammypy/pyrightconsume our type hints (a large typing-completeness push has already landed internally; this makes it visible). - Deprecation shims for any names that move, so 5.x code keeps importing with a warning before 6.0 enforces the new surface.
This is also the enabler for import-time lazy loading and for future removals to be non-surprising: if it's not in the public surface, it can change.
Acceptance
- The public surface is documented in one place users can cite.
py.typedships;mypy --strict-checkable on a downstream sample project.- Moved names keep working through 5.x with
DeprecationWarning, and every rename gets an upgrade-guide entry.
Downstream consumer data point on the public-surface declaration: could the 6.0 public API include a supported way to disable the on-disk HTTP cache?
Today configure_http(verify_ssl, use_system_certs, proxy, timeout, http2) has no cache parameter, and cache_enabled is reachable only via get_http_mgr(cache_enabled=..., request_per_sec_limit=...) inside edgar.httpclient — which is exactly the kind of internal module this issue is (correctly) about to declare non-public. We currently work around the gap by importing edgar.httpclient directly and swapping the module-level HTTP_MGR global for a cache-disabled instance at process startup, because our pipeline runs against thousands of tickers in one process and the default on-disk cache (which caches "forever" per /Archives/edgar/data) grows to multiple GB and risks exhausting disk mid-run.
Once the public/internal boundary is declared, we'd be permanently out-of-contract on a startup-critical path with no legitimate alternative. A configure_http(cache_enabled=...) parameter or an EDGAR_HTTP_CACHE env var (consistent with the existing EDGAR_* env vars) would close this cleanly and let us stop reaching into edgar.httpclient internals entirely.
Status update — the additive half of this is shipped and on PyPI.
Both pieces users can adopt today are live. Verified against the published wheels rather than the repo, because the packaging step is where this kind of thing silently fails:
| release | edgar/py.typed |
len(__all__) |
|---|---|---|
| 5.47.0 | absent | 110 |
| 5.48.0 | present | 123 |
| 5.51.0 | present | 123 |
__all__ landed in 5.47.0 declaring 110 names. It has since grown to 123 — not scope creep, but a ratchet doing its job: tests/issues/regression/test_public_api_surface.py fails when a new top-level name is neither in __all__ nor on an explicit internal list, so every added name forces the public/internal call at the moment it is added instead of accumulating unlabelled.
One honest note, since "add __all__" sounds purely additive and isn't: declaring it narrows from edgar import *, which stops supplying 31 names it used to. Direct imports are unaffected. If you star-import EdgarTools and something disappeared in 5.47.0, that's this, and it's in the changelog.
py.typed shipped in 5.48.0 (it was written for 5.47.0 but missed that wheel — the build include list is an allowlist keyed on edgar/**/*.py, and an extensionless zero-byte file drops out silently). Your type checker now sees our annotations. If you re-verify this, use mypy: pyright defaults useLibraryCodeForTypes to true and reads library source regardless of PEP 561, so it can't tell the difference.
What's left for the 6.0 window, and why this issue stays open:
- Making the 31 internal names actually private.
- Stabilising public import paths — several public classes still live in
_filings.py.
Both are genuine breaks, so they land in the announced breaking window with upgrade-guide entries rather than in a 5.x release.
Thanks for this, and apologies for the slow reply — this is exactly the kind of report the public roadmap was opened for, and it deserved an answer three weeks ago rather than a status update posted over it.
Your reading of the current state is correct. I checked rather than assuming:
configure_http()takesverify_ssl,use_system_certs,proxy,timeout,http2— no cache parameter.cache_enabledexists only as an argument toget_http_mgr()inedgar.httpclient, where it selectscache_dirandcache_mode("Hishel-File"vs"Disabled") when the manager is constructed.EDGAR_CACHE_DIRsets where the cache lives, not whether it exists.
So there is no supported way to turn the on-disk cache off, and swapping the module-level HTTP_MGR is the only thing that works. You are right that this becomes a contract problem the moment the public/internal boundary is declared — and it is worse than you flagged, because the edgar.paths plumbing is also on the internal list, so the escape hatch is internal at both ends.
This is the most useful kind of finding for #932: a case where declaring the boundary doesn't merely document a limitation, it strands a legitimate use case with no public alternative. A boundary that makes a real workload out-of-contract is a boundary drawn wrong, and the fix belongs on our side, not in your startup code.
On shape. Both options you propose fit the existing conventions — EDGAR_USE_HTTP2, EDGAR_VERIFY_SSL and EDGAR_CACHE_DIR are all read the same way, so an EDGAR_HTTP_CACHE reads naturally beside them, and configure_http(cache_enabled=...) matches how the other runtime knobs are reached. Worth noting one wrinkle so the implementation isn't underestimated: configure_http() currently works by mutating HTTP_MGR.httpx_params and dropping the cached client, whereas cache_mode/cache_dir are constructor arguments to the throttle-cache manager rather than httpx params. So the runtime path needs to either rebuild the manager or mutate it more deeply than the existing knobs do — tractable, but not a one-line addition to the signature.
On your workload. The detail that the cache is keyed per /Archives/edgar/data and caches indefinitely, so a thousands-of-tickers single-process run grows to multiple GB and can exhaust the disk mid-run, is worth more than the feature request itself — that's a failure mode we should describe in the docs regardless of what we add, since anyone doing bulk work hits it and the cache is on by default.
A couple of questions that would shape this:
- Is process-lifetime off/on enough, or would you rather keep caching the cheap things and stop caching the documents? That option is more real than I implied above: cache policy is already a per-host, per-path-regex map, and the rule driving your growth is a single entry —
"/Archives/edgar/data": True, literally commented "cache forever" — sitting beside index and submissions rules that already carry finite TTLs. So "cache the indexes, don't hoard the documents" is expressible today without a new mechanism, and might fit a bulk pipeline better than going fully uncached. - Would a bounded cache — a size cap with eviction — actually serve you better than disabling it? "Never exhaust the disk" and "don't cache at all" aren't the same requirement, and if the real need is the former, that's worth knowing before we ship the latter.
Answer either way and I'll take it from there; a boolean plus the env var is the obvious floor and I'd rather ship that than nothing while the larger question is open.
This shipped in 6.0.0 (2026-11-09). The wheel includes py.typed, the top-level package declares its public API in __all__, and every name that moved or went private is listed in docs/upgrade/6.0.md. Closing. If an import you rely on isn't covered, please open a new issue with the path.