Skip to content

Commit

Permalink
Deprecate helpers.sigstore_verify_release_asset (#304)
Browse files Browse the repository at this point in the history
* Deprecate helpers.sigstore_verify_release_asset

* Rename extra

* move import

* add noqa

* lint

* Add setuptools
  • Loading branch information
ludeeus authored May 21, 2024
1 parent 2fbde11 commit 2a5c714
Show file tree
Hide file tree
Showing 6 changed files with 626 additions and 711 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ help: ## Shows this help message
@echo

requirements: install-poetry ## Install requirements
@poetry install
@poetry install --extras "deprecated-verify"
@poetry check

install: ## Install aiogithubapi
@poetry install
@poetry install --extras "deprecated-verify"

install-poetry:
@curl -sSL https://install.python-poetry.org | python3 -
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Which includes:
- The [`aiogithubapi.legacy`](./aiogithubapi/legacy) module
- The [`aiogithubapi.objects`](./aiogithubapi/objects) module
- All classes starting with `AIOGitHub`
- The `async_call_api` function in the [`aiogithubapi.helpers.py`](./aiogithubapi/helpers.py) file
- The `async_call_api` function in the [`aiogithubapi/helpers.py`](./aiogithubapi/helpers.py) file
- The `sigstore_verify_release_asset` function in the [`aiogithubapi/helpers.py`](./aiogithubapi/helpers.py) file
- The `GitHubDevice` class in `aiogithubapi`, replaced with `GitHubDeviceAPI`
- The `GitHub` class in `aiogithubapi`, replaced with `GitHubAPI`

Expand Down
28 changes: 18 additions & 10 deletions aiogithubapi/helpers.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
"""Helpers for AIOGitHubAPI."""
from __future__ import annotations

from io import BytesIO
from typing import Optional
from typing import TYPE_CHECKING, Optional

import aiohttp
from sigstore.verify import (
VerificationMaterials,
VerificationResult,
Verifier,
models,
policy,
)

from .const import HttpMethod, Repository, RepositoryType
from .legacy.helpers import (
Expand All @@ -21,6 +13,9 @@
)
from .objects.base import AIOGitHubAPIResponse

if TYPE_CHECKING:
from sigstore.verify import VerificationResult


def repository_full_name(repository: RepositoryType) -> str:
"""Return the repository name."""
Expand Down Expand Up @@ -59,7 +54,20 @@ def sigstore_verify_release_asset(
offline_verification: bool = False,
**kwargs,
) -> VerificationResult:
"""Verify release asset."""
"""Verify release asset.
Deprecated function, a replacement will not be added.
"""
from warnings import warn # noqa

warn(
"The 'sigstore_verify_release_asset' function is deprecated and will be removed in a future version.",
stacklevel=2,
)
from io import BytesIO # noqa

from sigstore.verify import VerificationMaterials, Verifier, models, policy # noqa

verifier = Verifier.production()
policies = [
policy.Identity(
Expand Down
Loading

0 comments on commit 2a5c714

Please sign in to comment.