docs: define the stable 1.0 public API - #294
Merged
Merged
Conversation
Mattsface
marked this pull request as ready for review
August 6, 2026 01:47
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
cursor
Bot
force-pushed
the
docs/v1-public-api-contract
branch
from
August 6, 2026 01:49
f6a0b3c to
087b66d
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.
Closes #286
Summary
Defines the supported public API contract for the
python-mlb-statsapi1.x series: package-root symbols, constructor signatures, exception/warning inheritance, Session ownership,Mlbendpoint inventory, and Python support wording. This is primarily documentation and contract testing; no runtime redesign.Public symbols classified
Mlb,MlbDataAdapter,MlbResult,create_retry_policyTheMlbStatsApiException, transport/timeout/HTTP/decode)MlbHttpCompatibilityWarningreturn_splits,get_stat_attributesexceptions,warnings,mlb_api,mlb_dataadapter,mlb_module,models)Legacy helpers and their status
return_splitsandget_stat_attributesremain package-root importable and stable in 1.x. They are not preferred for new code and are not deprecated (no replacement/warning/timeline/issue yet).Whether
__all__was added and whyNo. Adding
__all__with only supported symbols would silently remove accidentally exposed submodule names fromfrom mlbstatsapi import *. Promoting those submodules into__all__would incorrectly freeze accidental exposure. Omission is documented indocs/public-api.mdandmlbstatsapi/__init__.py.Constructor contracts documented
Documented and tested for
Mlb,MlbDataAdapter, andMlbResult, including parameter order, defaults, keyword-onlystrict_http=True, context-manager/closebehavior, and Session ownership.Endpoint-method inventory approach
Explicit
MLB_PUBLIC_METHOD_MANIFESTintests/test_public_api.py(43 public methods:close,__enter__,__exit__, and 40 endpoints). Newly exposed methods require an intentional manifest update.Exception and warning contracts
Hierarchy and
MlbHttpErrorattributes documented/tested.MlbHttpCompatibilityWarningremains aFutureWarningsubclass.Session ownership contract
Library-created vs caller-injected Session rules documented as stable public API; covered by public API and existing session tests.
Python support wording
>=3.10Built-wheel validation results
Smoke coverage includes supported package-root imports, constructor signatures, exception/warning inheritance,
MlbResult, legacy helpers, andstrict_httpdefaults ofTrue.Focused test results
Full offline-suite results
After rebase onto current
origin/release/1.0.0(includes #293 migration guide):Follow-up issues recommended
__all__after deciding how to handle accidental submodule star-import exposureget_venue400-path returning[]while annotated asVenue | Noneget_homerun_derbybareNoneinstead ofreturn Noneon 400–499get_game_line_score400 handling with sibling game helpersRebase status relative to #285 / current release
Rebased cleanly onto current
origin/release/1.0.0after #293 (docs/v1-migration-guide) merged. Branch is 0 behind / 2 ahead. Contains #284 and #285 ancestry. NoPending #285/XFAIL_PENDING_WARNING_CALL_SITEmarkers. No rebase conflicts.Risk assessment
Low. Documentation, contract tests, release-smoke updates for the already-merged strict default, and two unambiguous docstring/annotation fixes (
get_game_line_scoreexample typo;get_division_idreturn annotationList[Division]→List[int]). No HTTP decision logic, Session behavior, exception hierarchy, retry values, or endpoint return models were redesigned. No supported symbol was removed or renamed.