Skip to content

request.latest_version

Request copies of relational datasets.

latest_version()

Get the latest srlearn/datasets version from GitHub's REST API.

Danger

GitHub's REST API is limited to 60 requests per hour when an OAuth token is not passed. This function is included for convenience, but should only be used interactively.

Usually you'll be better looking at the latest version from your browser, see the Releases Page.

Read more on the GitHub REST API Authentication.

Returns:

Type Description
str

The latest version of datasets stored in the

str

srlearn/datasets repository.

Examples:

from relational_datasets.request import latest_version
latest_version()
# 'v0.0.3'
Source code in relational_datasets/request.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
def latest_version() -> str:
    """Get the latest ``srlearn/datasets`` version from GitHub's REST API.

    !!! danger end
        GitHub's REST API is limited to 60 requests per hour when an OAuth
        token is not passed. This function is included for convenience, but
        should only be used interactively.

        Usually you'll be better looking at the latest version from your browser,
        see the [Releases Page](https://github.com/srlearn/datasets/tags).

        Read more on the
        [GitHub REST API Authentication](https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api#authentication).

    Returns:
        The latest version of datasets stored in the
        [`srlearn/datasets`](https://github.com/srlearn/datasets/) repository.

    Examples:

    ```python
    from relational_datasets.request import latest_version
    latest_version()
    # 'v0.0.3'
    ```
    """

    with urlopen(
        "https://api.github.com/repos/srlearn/datasets/releases/latest"
    ) as url:
        api_response = json.loads(url.read().decode("utf-8"))
    return api_response["tag_name"]

Last update: June 20, 2022