Document and prepare release 0.9.0 - #280
Merged
Merged
Conversation
Bump the project version to 0.9.0 and add scripts/validate_release.py, a focused validator for the built wheel and source distribution. The validator checks artifact presence, wheel metadata (name, version, Requires-Python), required sdist contents, and then installs the wheel into a temporary virtual environment and runs a public-import smoke test from outside the repository so the checkout cannot shadow the installed package. It never contacts the MLB API. Offline CI now watches release/0.9.0 alongside main and runs the validator after poetry build instead of only confirming that artifacts exist. Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
Update the README HTTP section for 0.9.0: compatibility mode as the default, opt-in strict mode, MlbHttpCompatibilityWarning and selective filtering, the public create_retry_policy() helper on a caller-managed Session, the richer MlbHttpError attributes, the versioned User-Agent, Session ownership, and Session cleanup. Adds links to the transport document and release notes. Audit docs/http-transport.md against the implementation: drop stale 0.8.0 'current release' references, list the public transport API, promote Session ownership to its own section, complete the compatibility/strict behavior table with the successful and warning cases, spell out exactly when a warning is and is not emitted, and describe the 1.0 migration direction without committing to an implementation. Add docs/releases/0.9.0.md and offline tests that keep the documented examples compilable, free of private attributes, and consistent with the declared version. Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
Mattsface
marked this pull request as ready for review
August 4, 2026 00:52
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 #272
Refs #265
Why
Issues #266 through #271 landed the configurable HTTP behavior for 0.9.0 on
release/0.9.0, but the release itself was never prepared. Project metadata still reported0.8.0,docs/http-transport.mdstill described 0.8.0 as the current release and predated the strict-mode and warning work, there were no 0.9.0 release notes, offline CI still watchedrelease/0.8.0, and the build job only confirmed thatpoetry buildproduced files rather than checking what was inside them.This branch documents, validates, and packages the already-completed functionality. No production HTTP behavior was changed.
What
Version metadata
poetry version 0.9.0;poetry version --shortreports0.9.0importlib.metadata, and the built wheel drives itpoetry.lockwas not touched; Poetry did not need to change itREADME
Revised the HTTP section for 0.9.0 while keeping the 0.8.0 transport background (shared Sessions, timeouts, retries, exception hierarchy). New or reworked subsections cover compatibility mode as the default and its
strict_http=Falseequivalence, opt-in strict mode,MlbHttpCompatibilityWarningwith a package-specificwarnings.filterwarnings("error", ...)example, the publiccreate_retry_policy()on a caller-managed Session, Session ownership and cleanup, the richerMlbHttpErrorattributes, the versioned User-Agent, unchanged 404 behavior, an at-a-glance behavior table, and links todocs/http-transport.mdanddocs/releases/0.9.0.md.Also retagged the installation code fence from
pythontobash; it holds a shell command and was failing the new example syntax check.Detailed transport documentation
Audited
docs/http-transport.mdagainst the implementation rather than rewriting it:DEFAULT_TIMEOUTsnippet from apythonfence to atextfence so it does not read as an importable public namepython-mlb-statsapi/0.9.0for this releaseRelease notes
Added
docs/releases/0.9.0.md, following the organization and tone ofdocs/releases/0.8.0.mdbut written from scratch. It is phrased as notes being prepared for publication and does not claim 0.9.0 is on PyPI.CI
.github/workflows/build-and-test.ymlnow watchesmainandrelease/0.9.0for both pull requests and pushes. The build job removes stale artifacts, builds, and then runs the release validator. It stays offline apart from dependency and package installation, and no publishing was added.Release validator
I searched for an existing validator first (
validate_release,release_valid,smokeacross*.py,*.yml,*.md,*.sh); the only hit was a mention inAGENTS.md, so there was nothing to update. Addedscripts/validate_release.py, called from both the README development instructions and CI. It verifies:dist/Name: python-mlb-statsapi,Version: 0.9.0,Requires-Python: >=3.10README.md,pyproject.toml, andmlbstatsapi/venvinstallation of the wheel succeedscreate_retry_policy()returning a freshurllib3Retry,MlbHttpCompatibilityWarningbeing importable and aFutureWarning, both HTTP modes constructing, compatibility mode being the default, the library-created Session sendingpython-mlb-statsapi/0.9.0, and injected Session headers surviving untouchedThe smoke test runs from a temporary directory and asserts
mlbstatsapi.__file__resolves undersite-packages, so the repository checkout cannot shadow the installed wheel. It usesvenv,tempfile,subprocess, andpathlibwith no Unix-only paths, and never contacts the MLB API. The one private access (Mlb._session.headers) is confined to the validator and is what verifies the outgoing library-owned User-Agent.Added
tests/test_release_validation.py(offline) to keep documentation honest: every non-REPLpythonexample in the README, transport document, and release notes must compile; documentation examples must not use_sessionor import internal modules; release notes must exist for the declared version; the documented User-Agent must match the declared version; and CI must watch the current release branch.Tests
All commands run from the repository root on Python 3.12.
poetry check— passes (pre-existing[tool.poetry]deprecation warnings only, unchanged by this PR)poetry run pytest tests/ --ignore=tests/external_tests -v— 318 passed (309 before, plus the 9 new documentation-consistency tests)poetry run pytest tests/test_http_contract.py -v— 58 passedpoetry run pytest tests/test_http_warnings.py -v— 53 passedpoetry run pytest tests/test_mlb_retries.py -v— 29 passedpoetry run pytest tests/test_mlb_exceptions.py -v— 29 passedpoetry run pytest tests/test_mlb_session.py -v— 45 passedpoetry run pytest tests/external_tests/ -v— 119 passed, 1 skipped against the live MLB API. This was actually run; the skip is pre-existing and not caused by this branchrm -rf dist && poetry build— succeededpython3 scripts/validate_release.py— passed, including the clean-virtual-environment wheel install and public import smoke testgit diff --check— cleanNo warnings were silenced globally to make anything pass.
Manual live example validation (run separately, not in offline CI): executed the new README examples against the live API. Compatibility mode, strict mode, and the injected-Session-with-retry-policy example all returned
Ty Franceforget_person(664034); the injected Session kept itsmy-baseball-project/1.0User-Agent; a final 400 raisedMlbHttpErrorin strict mode withmethod=GET,status_code=400,reason=Bad Request, a populatedresponse_datadictionary, and a 133-characterbody_excerpt; the same call in compatibility mode raisedMlbHttpCompatibilityWarningonce promoted with a package-specific filter; andget_person(1)still returnedNonefor a 404.Build artifacts (not committed;
dist/is gitignored)python_mlb_statsapi-0.9.0-py3-none-any.whlpython_mlb_statsapi-0.9.0.tar.gzRisk and impact
Minimal.
The only non-documentation production change is the version string in
pyproject.toml. No endpoint, model, adapter, retry, warning, or exception behavior was modified, and no dependency versions changed. Documentation and the new validator carry no runtime risk.The realistic failure mode is documentation drifting from behavior, which the new offline tests now guard against for example syntax, private-API usage, and the documented version. If the validator itself were wrong it would fail the build job rather than ship a bad package.
Notes
release/0.9.0, notmainrelease/0.9.0was not merged intomainrelease/0.9.0and were not reimplemented. All nine required public imports resolve from the source environment