Skip to content

Release/1.0.0 - #296

Merged
Mattsface merged 14 commits into
mainfrom
release/1.0.0
Aug 8, 2026
Merged

Release/1.0.0#296
Mattsface merged 14 commits into
mainfrom
release/1.0.0

Conversation

@Mattsface

Copy link
Copy Markdown
Member

release: prepare python-mlb-statsapi 1.0.0

Refs #289

Why

Version 1.0.0 establishes the stable public API contract for the 1.x series and changes the default HTTP behavior.

In 0.9.x, non-404 4xx responses could be handled through the historical compatibility path by default. In 1.0.0, strict HTTP behavior is now the default, so final non-404 4xx responses raise MlbHttpError.

This release also needed the documentation, release validation, supported Python matrix, and built artifacts to reflect the final 1.0 contract before anything is tagged or published.

What

This PR prepares the release/1.0.0 branch for final release into main.

Main changes include:

  • Bump the package version from 0.9.0 to 1.0.0
  • Make strict HTTP handling the default for Mlb and MlbDataAdapter
  • Preserve explicit compatibility behavior through strict_http=False
  • Preserve endpoint-specific 404 behavior
  • Keep structured HTTP, timeout, transport, and decode exceptions
  • Preserve caller-owned Session configuration and ownership
  • Define and document the supported public API for the 1.x series
  • Add the 1.0 migration guide and release notes
  • Update current User-Agent documentation to python-mlb-statsapi/1.0.0
  • Validate public package imports and constructor contracts from built artifacts
  • Clean-install and smoke-test both the wheel and source distribution
  • Validate strict mode and compatibility mode with deterministic offline HTTP responses
  • Expand offline CI coverage to Python 3.10 through 3.14
  • Run twine check against both distribution artifacts
  • Update the Home Run Derby external test to match the MLB API's actual 400 Bad Request response for an invalid game ID under the new strict HTTP default

No tag, PyPI upload, or GitHub release is created by this PR.

Tests

Deterministic tests were run with:

poetry run pytest \
  tests/ \
  --ignore=tests/external_tests \
  -v

GitHub Actions also passes the offline suite on:

  • Python 3.10
  • Python 3.11
  • Python 3.12
  • Python 3.13
  • Python 3.14

The package build and release validation pass with:

poetry check
rm -rf dist
poetry build
python3 scripts/validate_release.py
poetry run twine check dist/*
git diff --check

The release validator clean-installs and smoke-tests both:

python_mlb_statsapi-1.0.0-py3-none-any.whl
python_mlb_statsapi-1.0.0.tar.gz

It also verifies:

  • Mlb() uses strict HTTP behavior by default
  • Mlb(strict_http=True) remains supported
  • Mlb(strict_http=False) preserves compatibility behavior
  • MlbHttpCompatibilityWarning remains public
  • Public imports match the 1.x API contract
  • The library-created User-Agent matches installed package metadata
  • Caller-injected Session headers and adapters remain untouched

The live MLB API suite was also run. One outdated Home Run Derby test expected an invalid game ID to behave like a 404, but the live MLB API currently returns 400 Bad Request. The test was updated to expect MlbHttpError for that response, which matches the documented 1.0 strict HTTP contract.

Risk and impact

Risk level: Normal

This is a major-version release and intentionally changes the default handling of non-404 4xx responses, so applications that relied on the historical empty-result behavior may need to update their exception handling.

The risk is reduced by:

  • Keeping strict_http=False available as an explicit migration path
  • Preserving endpoint-specific 404 behavior
  • Documenting the migration path in the README, transport guide, and 1.0 release notes
  • Defining the supported 1.x public API explicitly
  • Running deterministic tests across Python 3.10 through 3.14
  • Validating both wheel and source-distribution installations
  • Testing the actual strict and compatibility behavior in built artifacts
  • Keeping publication separate from this PR

If something does go wrong, the most likely impact is an application receiving MlbHttpError where it previously relied on a suppressed non-404 4xx response.

The compatibility opt-out provides a temporary migration path:

mlb = mlbstatsapi.Mlb(strict_http=False)

This PR itself does not publish anything. Tagging v1.0.0, uploading to PyPI, performing the public PyPI smoke test, and creating the GitHub release will happen only after this PR is merged and the final release sequence is explicitly approved.

cursoragent and others added 14 commits August 5, 2026 21:25
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
…ault

feat: make strict HTTP behavior the default (#284)
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
feat: preserve explicit HTTP compatibility mode (#285)
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
…ract

docs: define the stable 1.0 public API
Python 3.14 formats typing.Union[a, b] as "a | b" while Python 3.10-3.13
format "Union[a, b]", so the get_persons signature manifest entry failed
only on 3.14. The annotation object is unchanged; normalize the legacy
rendering so one manifest stays valid on every supported interpreter.

Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
The release validator only clean-installed the wheel and only proved the
strict HTTP default through constructor signatures, so a broken source
distribution or a behavioral regression in strict handling could pass.
Offline CI also still watched the stale release/0.9.0 branch and tested
only Python 3.10-3.12.

Validator:

- clean-install the wheel and the source distribution in separate
  throwaway virtual environments and run the same smoke test against both
- generalize wheel-only terminology to cover both distribution artifacts
- verify a final fake 403 raises MlbHttpError under the default and under
  explicit strict_http=True, for Mlb and for MlbDataAdapter on v1 and v1.1
- verify strict_http=False returns the historical empty result and emits
  exactly one MlbHttpCompatibilityWarning mentioning strict_http=False
- assert MlbHttpError status_code, reason, method, url, and response_data
  without freezing the exception or warning strings
- verify an injected requests.Session keeps its headers and its exact
  adapter objects, never receives the library retry policy, and is never
  closed by the library
- verify a library-created Session carries the installed-metadata
  User-Agent and the documented retry policy
- label reverted strict defaults explicitly instead of raising a bare
  AssertionError
- name the failing artifact, field, or path with expected and actual
  values in every validation error
- expand the required source-distribution paths to the files the archive
  intentionally carries

Tests:

- unit-cover the validator helpers with synthetic wheel ZIPs and sdist
  tarballs, including every required failure mode
- prove validate() clean-installs both artifacts in separate environments
- lock the documentation Python-example checks to every release-notes
  file while keeping current-version checks off historical notes
- require the release/1.0.0 CI trigger literally instead of deriving it
  from the still-unbumped package version
- cover the Python matrix, twine check, and publishing-safety contract

CI and docs:

- watch main and release/1.0.0; drop release/0.9.0
- test Python 3.10 through 3.14 and build on 3.14
- add twine as a development dependency and run twine check on both
  artifacts; nothing is uploaded
- state the 3.10 minimum and 3.10-3.14 CI coverage in the current docs

The package version stays 0.9.0; the 1.0.0 bump belongs to a separate
issue and the validator keeps reading the expected version from
pyproject.toml.

Co-authored-by: Matthew Spah <spahmatthew@gmail.com>
…tion

build: harden 1.0 release validation
Update the invalid game ID test to expect MlbHttpError for the
live API's 400 response instead of treating it as a 404 result.

Also close the shared Mlb client during test cleanup.
@Mattsface Mattsface self-assigned this Aug 8, 2026

@Mattsface Mattsface left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ship it

@Mattsface
Mattsface merged commit 752a399 into main Aug 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants