feat: export missing public API types for 1.0 surface - #45
Open
rcbevans wants to merge 2 commits into
Open
Conversation
Add Backend, Clock, SystemClock, FakeClock, JobRow, JobPage, TaskQSettings, and WorkerSettings to the top-level taskq __all__. These are types users and third-party backend implementers already need; importing them from deep internal paths would break on any future restructure. New test file pins importability, __all__ membership, and structural shape (Protocol, dataclass, inheritance) for every new export, plus a regression guard that every name in __all__ is actually importable.
rcbevans
force-pushed
the
feat/api-surface-1.0
branch
from
July 30, 2026 04:54
eac6ce2 to
e41f49f
Compare
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.
Summary
Exports eight types that users and third-party backend implementers already need but had to import from deep internal paths:
Backend- the Protocol that storage backends implementClock,SystemClock- time abstraction and its production implementationFakeClock- the test clock, now importable from the top levelJobRow,JobPage- the data structures returned by job listing queriesTaskQSettings,WorkerSettings- configuration types for the client and workerImporting these from internal modules like
taskq.backend._protocolortaskq.testing.clockwould break on any future restructure. Adding them to__all__makes them part of the stable public API surface for 1.0.Test coverage
New
tests/test_public_api_exports.pyverifies:taskqand present in__all__ClockandBackendare@runtime_checkableProtocolsSystemClockis a frozen dataclass with no fieldsFakeClockhasnow()andmonotonic()methodsJobRowis a frozen dataclass withid,status, andactorfieldsJobPageis a frozen dataclass withjobsandnext_cursorfieldsTaskQSettingshas a callableloadclassmethodWorkerSettingsis a subclass ofTaskQSettings__all__is actually importable (regression guard)__all____all__are sortedVerification
ruff check- cleanpyright- cleanpytest tests/test_public_api_exports.py- all 16 tests pass