historia.github#

Functions

dump_info_for_date(*, directory, date, username)

Fetch and save all GitHub info types for a given date.

dump_specific_info(*, directory, info_type, ...)

Fetch and save a specific type of GitHub info for a given date.

fetch_info_for_date(*, info_type, date, username)

Fetch GitHub info (issues, PRs, etc.) created by a specific user on a specific date.

update(*, directory, username, ...[, start_date])

Fetch and save GitHub info for the most recent past_number_of_days days.

historia.github.dump_info_for_date(
*,
directory: Path,
date: str,
username: str,
overwrite: bool = False,
) None[source]#

Fetch and save all GitHub info types for a given date.

Parameters:
  • directory (pathlib.Path) – The base directory to save the data to.

  • date (str) – The date to fetch information for, in the format “YYYY-MM-DD”.

  • username (str) – The GitHub username to fetch information about.

  • overwrite (bool, default=False) – Whether to overwrite existing files. If False, existing files will be left unchanged. Use of True is recommended for the most recent days (since API fetches may not be 100% accurate).

Returns:

Whether the GitHub API rate limit was hit during the query.

Return type:

bool

historia.github.dump_specific_info(
*,
directory: Path,
info_type: Literal['prs_opened', 'prs_assigned', 'issues_opened', 'issues_assigned'],
date: str,
username: str,
overwrite: bool = False,
) bool[source]#

Fetch and save a specific type of GitHub info for a given date.

Parameters:
  • directory (pathlib.Path) – The base directory to save the data to.

  • info_type ("prs_opened", "prs_assigned", "issues_opened", or "issues_assigned") – The type of information to fetch and save.

  • date (str) – The date to fetch information for, in the format “YYYY-MM-DD”.

  • username (str) – The GitHub username to fetch information about.

  • overwrite (bool, default=False) – Whether to overwrite existing files. If False, existing files will be left unchanged. Use of True is recommended for the most recent days (since API fetches may not be 100% accurate).

Returns:

Whether the GitHub API rate limit was hit during the query.

Return type:

bool

historia.github.fetch_info_for_date(
*,
info_type: Literal['prs_opened', 'prs_assigned', 'issues_opened', 'issues_assigned'],
date: str,
username: str,
) tuple[list[str], bool][source]#

Fetch GitHub info (issues, PRs, etc.) created by a specific user on a specific date.

Parameters:
  • info_type (Literal["prs_opened", "prs_assigned", "issues_opened", "issues_assigned"]) – The type of GitHub info to fetch.

  • date (str) – The date for which to fetch GitHub info, in ISO format (e.g., “2026-01-01”).

  • username (str) – The GitHub username for which to fetch info.

Returns:

  • list[str] – A list of GitHub issue or pull request URLs for the specified date and user.

  • bool – Whether or not the GitHub API rate limit was hit during the query.

historia.github.update(
*,
directory: Path,
username: str,
past_number_of_days: int,
start_date: str | None = None,
) None[source]#

Fetch and save GitHub info for the most recent past_number_of_days days.

Parameters:
  • directory (pathlib.Path) – The base directory to save the data to.

  • username (str) – The GitHub username to fetch information about.

  • past_number_of_days (int) – Number of days (in addition to the anchor date) to fetch backwards from.

  • start_date (str, optional) – Anchor date to count backwards from, in the format “YYYY-MM-DD”. Defaults to today’s date in the local timezone. Primarily intended to make the iteration deterministic for testing.