Skip to content

MNT: deprecate round kwarg in Ergast methods (#890)#934

Open
divyanshrohatgi wants to merge 3 commits into
theOehrly:mainfrom
divyanshrohatgi:deprecate-round-ergast
Open

MNT: deprecate round kwarg in Ergast methods (#890)#934
divyanshrohatgi wants to merge 3 commits into
theOehrly:mainfrom
divyanshrohatgi:deprecate-round-ergast

Conversation

@divyanshrohatgi

Copy link
Copy Markdown
Contributor

Follow-up to #920 (the get_event_by_round pilot). Applies the same
round -> round_number deprecation to the Ergast data request methods.
Part of #890.

Changes:

  • ergast/interface.py:
    • _build_url (private): renamed round -> round_number. Just a rename,
      it's internal with no external callers.
    • the 12 public get_* methods: added round_number, kept round as a
      deprecated keyword-only alias that emits a FutureWarning, and raise
      ValueError if both are passed. get_lap_times / get_pit_stops also
      raise ValueError if neither is passed (round was required there).
  • test_ergast.py: parametrized tests for the deprecated path, the
    both passed case, and the neither passed case. Mocked so they don't
    hit the API.
  • test_core.py and the two examples/standings scripts: switched their
    round= calls to round_number= so they don't trip the new warning.
  • changelog: Deprecations entry under v3.9.0.
  • Also fixed `get_lap_times' docstring summary, which was copy-pasted from
    get_sprint_results.

Left pyproject.toml / the A002 rule out of this on purpose

AI disclosure: used Claude for navigating the codebase and grammar review on this PR description. All code typed and reviewed by me.

@Casper-Guo Casper-Guo self-assigned this Jun 15, 2026
@Casper-Guo

Copy link
Copy Markdown
Collaborator

Thanks for your contribution again. This is a bigger diff than last time but the contents are broadly similar. Rest assured that reviewing this is on my todo list.

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