You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the first public AsyncMlb client with a deliberately small set of representative endpoints to prove the end-to-end architecture before expanding coverage.
Initial scope
Implement AsyncMlb with:
public root import: from mlbstatsapi import AsyncMlb
#302 locks down the deterministic contract for AsyncMlbDataAdapter and the transport layer. This issue owns the higher-level AsyncMlb lifecycle that cannot be tested until AsyncMlb exists.
In particular, #303 owns deterministic coverage for:
async with AsyncMlb(...)
AsyncMlb.__aenter__() returning the AsyncMlb instance
AsyncMlb.__aexit__() awaiting cleanup
automatic cleanup on normal context exit
automatic cleanup when an exception leaves the async context
automatic cleanup when the surrounding task is cancelled
preserving the original exception or asyncio.CancelledError while cleanup runs
keeping caller-injected clients open during all of the above
Adapter-level ownership, explicit AsyncMlbDataAdapter.aclose(), retry, transport, and cancellation behavior remain covered by #301/#302 and should not be duplicated here except where needed to prove the public AsyncMlb behavior end to end.
One AsyncMlb instance supports multiple concurrent in-flight endpoint calls on the same event loop
Concurrency remains caller-controlled
Endpoint methods do not introduce hidden fan-out, detached tasks, worker pools, or unrelated background work
Per-request state remains independent
Caller-created in-flight operations must finish before the client is closed
Design requirement
Do not duplicate parsing/model-construction logic when a shared helper from #299 can be used.
Transport-specific implementation details must remain behind AsyncMlbDataAdapter rather than leaking into the public AsyncMlb API.
Do not duplicate the exhaustive adapter-level contract matrix from #302. Add only the transport assertions required to prove the public AsyncMlb lifecycle and endpoint behavior end to end.
Parent: #297
Depends on: #299, #301, #302
Goal
Add the first public
AsyncMlbclient with a deliberately small set of representative endpoints to prove the end-to-end architecture before expanding coverage.Initial scope
Implement
AsyncMlbwith:from mlbstatsapi import AsyncMlbasync with AsyncMlb()supportaclose()get_teamget_personget_scheduleScope boundary with #302
#302 locks down the deterministic contract for
AsyncMlbDataAdapterand the transport layer. This issue owns the higher-levelAsyncMlblifecycle that cannot be tested untilAsyncMlbexists.In particular, #303 owns deterministic coverage for:
async with AsyncMlb(...)AsyncMlb.__aenter__()returning theAsyncMlbinstanceAsyncMlb.__aexit__()awaiting cleanupasyncio.CancelledErrorwhile cleanup runsAdapter-level ownership, explicit
AsyncMlbDataAdapter.aclose(), retry, transport, and cancellation behavior remain covered by #301/#302 and should not be duplicated here except where needed to prove the publicAsyncMlbbehavior end to end.Contract requirements from #298
Public API
AsyncMlbis a stable public 1.x APIMlbbehavior and signatures remain unchangedNone,[], and{}behavior for equivalent responsesConstructor and lifecycle
Public shape should mirror sync as closely as practical:
async withreturns theAsyncMlbinstance__aexit__()awaitsaclose()aclose()is idempotent and closes only library-owned async transportEndpoint behavior
For
get_team,get_person, andget_schedule:Concurrency
AsyncMlbinstance supports multiple concurrent in-flight endpoint calls on the same event loopDesign requirement
Do not duplicate parsing/model-construction logic when a shared helper from #299 can be used.
Transport-specific implementation details must remain behind
AsyncMlbDataAdapterrather than leaking into the publicAsyncMlbAPI.Do not duplicate the exhaustive adapter-level contract matrix from #302. Add only the transport assertions required to prove the public
AsyncMlblifecycle and endpoint behavior end to end.Acceptance criteria
AsyncMlbis importable frommlbstatsapiasync withcorrectly cleans up library-owned resources on normal exitasync withcorrectly cleans up library-owned resources when an exception leaves the contextasync withcorrectly cleans up library-owned resources when the surrounding task is cancelledasyncio.CancelledErroraclose()is idempotent and safeget_team,get_person, andget_schedulework end to endMlbbehavior and signatures remain unchangedRefs #297
Contract: #298