Skip to content

Commit 196f2bc

Browse files
authored
bump sigstore ~= 3.1 (#39)
1 parent 2c96d7b commit 196f2bc

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

pyproject.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies = [
1717
"cryptography",
1818
"packaging",
1919
"pydantic",
20-
"sigstore~=3.0.0",
20+
"sigstore~=3.1.0",
2121
"sigstore-protobuf-specs",
2222
]
2323
requires-python = ">=3.11"
@@ -49,10 +49,7 @@ name = "pypi_attestations"
4949

5050
[tool.coverage.run]
5151
# don't attempt code coverage for the CLI entrypoints
52-
omit = [
53-
"src/pypi_attestations/_cli.py",
54-
"src/pypi_attestations/__main__.py"
55-
]
52+
omit = ["src/pypi_attestations/_cli.py", "src/pypi_attestations/__main__.py"]
5653

5754
[tool.mypy]
5855
mypy_path = "src"
@@ -100,7 +97,7 @@ exclude = [
10097
"env",
10198
"test",
10299
"src/pypi_attestations/_cli.py",
103-
"src/pypi_attestations/__main__.py"
100+
"src/pypi_attestations/__main__.py",
104101
]
105102
ignore-semiprivate = true
106103
fail-under = 100

src/pypi_attestations/_impl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
from pydantic import Base64Bytes, BaseModel, field_validator
1818
from pydantic_core import ValidationError
1919
from sigstore._utils import _sha256_streaming
20+
from sigstore.dsse import DigestSet, StatementBuilder, Subject, _Statement
2021
from sigstore.dsse import Envelope as DsseEnvelope
2122
from sigstore.dsse import Error as DsseError
22-
from sigstore.dsse import _DigestSet, _Statement, _StatementBuilder, _Subject
2323
from sigstore.models import Bundle, LogEntry
2424
from sigstore.sign import ExpiredCertificate, ExpiredIdentity
2525
from sigstore_protobuf_specs.io.intoto import Envelope as _Envelope
@@ -128,12 +128,12 @@ def sign(cls, signer: Signer, dist: Distribution) -> Attestation:
128128
"""
129129
try:
130130
stmt = (
131-
_StatementBuilder()
131+
StatementBuilder()
132132
.subjects(
133133
[
134-
_Subject(
134+
Subject(
135135
name=dist.name,
136-
digest=_DigestSet(root={"sha256": dist.digest}),
136+
digest=DigestSet(root={"sha256": dist.digest}),
137137
)
138138
]
139139
)

test/test_impl.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pytest
1010
import sigstore
1111
from pydantic import ValidationError
12-
from sigstore.dsse import _DigestSet, _StatementBuilder, _Subject
12+
from sigstore.dsse import DigestSet, StatementBuilder, Subject
1313
from sigstore.models import Bundle
1414
from sigstore.oidc import IdentityToken
1515
from sigstore.sign import SigningContext
@@ -72,12 +72,12 @@ def test_roundtrip(self, id_token: IdentityToken) -> None:
7272
roundtripped_attestation.verify(verifier, policy.UnsafeNoOp(), dist)
7373

7474
def test_wrong_predicate_raises_exception(self, monkeypatch: pytest.MonkeyPatch) -> None:
75-
def dummy_predicate(self_: _StatementBuilder, _: str) -> _StatementBuilder:
75+
def dummy_predicate(self_: StatementBuilder, _: str) -> StatementBuilder:
7676
# wrong type here to have a validation error
7777
self_._predicate_type = False
7878
return self_
7979

80-
monkeypatch.setattr(sigstore.dsse._StatementBuilder, "predicate_type", dummy_predicate)
80+
monkeypatch.setattr(sigstore.dsse.StatementBuilder, "predicate_type", dummy_predicate)
8181
with pytest.raises(impl.AttestationError, match="invalid statement"):
8282
impl.Attestation.sign(pretend.stub(), dist)
8383

@@ -224,11 +224,11 @@ def test_verify_bad_payload(self) -> None:
224224

225225
def test_verify_too_many_subjects(self) -> None:
226226
statement = (
227-
_StatementBuilder() # noqa: SLF001
227+
StatementBuilder() # noqa: SLF001
228228
.subjects(
229229
[
230-
_Subject(name="foo", digest=_DigestSet(root={"sha256": "abcd"})),
231-
_Subject(name="bar", digest=_DigestSet(root={"sha256": "1234"})),
230+
Subject(name="foo", digest=DigestSet(root={"sha256": "abcd"})),
231+
Subject(name="bar", digest=DigestSet(root={"sha256": "1234"})),
232232
]
233233
)
234234
.predicate_type("foo")
@@ -253,10 +253,10 @@ def test_verify_too_many_subjects(self) -> None:
253253

254254
def test_verify_subject_missing_name(self) -> None:
255255
statement = (
256-
_StatementBuilder() # noqa: SLF001
256+
StatementBuilder() # noqa: SLF001
257257
.subjects(
258258
[
259-
_Subject(name=None, digest=_DigestSet(root={"sha256": "abcd"})),
259+
Subject(name=None, digest=DigestSet(root={"sha256": "abcd"})),
260260
]
261261
)
262262
.predicate_type("foo")
@@ -281,12 +281,12 @@ def test_verify_subject_missing_name(self) -> None:
281281

282282
def test_verify_subject_invalid_name(self) -> None:
283283
statement = (
284-
_StatementBuilder() # noqa: SLF001
284+
StatementBuilder() # noqa: SLF001
285285
.subjects(
286286
[
287-
_Subject(
287+
Subject(
288288
name="foo-bar-invalid-wheel.whl",
289-
digest=_DigestSet(root={"sha256": "abcd"}),
289+
digest=DigestSet(root={"sha256": "abcd"}),
290290
),
291291
]
292292
)
@@ -312,12 +312,12 @@ def test_verify_subject_invalid_name(self) -> None:
312312

313313
def test_verify_unknown_attestation_type(self) -> None:
314314
statement = (
315-
_StatementBuilder() # noqa: SLF001
315+
StatementBuilder() # noqa: SLF001
316316
.subjects(
317317
[
318-
_Subject(
318+
Subject(
319319
name="rfc8785-0.1.2-py3-none-any.whl",
320-
digest=_DigestSet(
320+
digest=DigestSet(
321321
root={
322322
"sha256": (
323323
"c4e92e9ecc828bef2aa7dba1de8ac983511f7532a0df11c770d39099a25cf201"

0 commit comments

Comments
 (0)