Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Renamed project to pypi-attestations
2fefc5a178844cff0c0b4e192ca055e4816ca90d
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL := /bin/bash

PY_IMPORT = pypi_attestation_models
PY_IMPORT = pypi_attestations

ALL_PY_SRCS := $(shell find src -name '*.py') \
$(shell find test -name '*.py')
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ python -m pip install pypi-attestation-models
## Usage as a command line tool

````bash
python -m pypi_attestation_models --help
usage: pypi-attestation-models [-h] [-v] [-V] COMMAND ...
python -m pypi_attestations --help
usage: pypi-attestation [-h] [-v] [-V] COMMAND ...

Sign, inspect or verify PEP 740 attestations

Expand All @@ -30,7 +30,7 @@ positional arguments:

options:
-h, --help show this help message and exit
-v, --verbose run with additional debug logging; supply multiple times to
-v, --verbose run with additional debug logging; supply multiple times to
increase verbosity (default: 0)
-V, --version show program's version number and exit
````
Expand All @@ -40,29 +40,29 @@ options:
```bash
# Generate a whl file
make package
python -m pypi_attestation_models sign dist/pypi_attestation_models-*.whl
python -m pypi_attestations sign dist/pypi_attestations-*.whl
```

_Note_: This will open a browser window to authenticate with the Sigstore
_Note_: This will open a browser window to authenticate with the Sigstore
OAuth flow.

### Inspecting a PEP 740 Attestation

```bash
python -m pypi_attestation_models inspect dist/pypi_attestation_models-*.whl.publish.attestation
python -m pypi_attestations inspect dist/pypi_attestations-*.whl.publish.attestation
```
_Warning_: Inspecting does not mean verifying. It only prints the structure of
_Warning_: Inspecting does not mean verifying. It only prints the structure of
the attestation.

### Verifying a PEP 740 Attestation

```bash
python -m pypi_attestation_models verify --staging \
python -m pypi_attestations verify --staging \
--identity william@yossarian.net \
test/assets/rfc8785-0.1.2-py3-none-any.whl
```
The attestation present in the test has been generated using the staging
environment of Sigstore and signed by William.
The attestation present in the test has been generated using the staging
environment of Sigstore and signed by William.

## Usage as a library

Expand All @@ -76,7 +76,7 @@ Use these APIs to create a PEP 740-compliant `Attestation` object by signing a P
```python
from pathlib import Path

from pypi_attestation_models import Attestation
from pypi_attestations import Attestation
from sigstore.oidc import Issuer
from sigstore.sign import SigningContext
from sigstore.verify import Verifier, policy
Expand Down Expand Up @@ -106,7 +106,7 @@ by signing a distribution file.

```python
from pathlib import Path
from pypi_attestation_models import Attestation
from pypi_attestations import Attestation
from sigstore.models import Bundle

# Sigstore Bundle -> PEP 740 Attestation object
Expand Down
24 changes: 12 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["flit_core >=3.5,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "pypi-attestation-models"
name = "pypi-attestations"
dynamic = ["version"]
description = "A library to convert between Sigstore Bundles and PEP-740 Attestation objects"
readme = "README.md"
Expand Down Expand Up @@ -35,28 +35,28 @@ lint = [
"types-toml",
"interrogate",
]
dev = ["pypi-attestation-models[doc,test,lint]", "twine", "wheel", "build"]
dev = ["pypi-attestations[doc,test,lint]", "twine", "wheel", "build"]


[project.urls]
Homepage = "https://pypi.org/project/pypi-attestation-models"
Documentation = "https://trailofbits.github.io/pypi-attestation-models/"
Issues = "https://github.com/trailofbits/pypi-attestation-models/issues"
Source = "https://github.com/trailofbits/pypi-attestation-models"
Homepage = "https://pypi.org/project/pypi-attestations"
Documentation = "https://trailofbits.github.io/pypi-attestations/"
Issues = "https://github.com/trailofbits/pypi-attestations/issues"
Source = "https://github.com/trailofbits/pypi-attestations"

[tool.flit.module]
name = "pypi_attestation_models"
name = "pypi_attestations"

[tool.coverage.run]
# don't attempt code coverage for the CLI entrypoints
omit = [
"src/pypi_attestation_models/_cli.py",
"src/pypi_attestation_models/__main__.py"
"src/pypi_attestations/_cli.py",
"src/pypi_attestations/__main__.py"
]

[tool.mypy]
mypy_path = "src"
packages = "pypi_attestation_models"
packages = "pypi_attestations"
allow_redefinition = true
check_untyped_defs = true
disallow_incomplete_defs = true
Expand Down Expand Up @@ -99,8 +99,8 @@ ignore = ["ANN101", "ANN102", "D203", "D213", "COM812", "ISC001"]
exclude = [
"env",
"test",
"src/pypi_attestation_models/_cli.py",
"src/pypi_attestation_models/__main__.py"
"src/pypi_attestations/_cli.py",
"src/pypi_attestations/__main__.py"
]
ignore-semiprivate = true
fail-under = 100
6 changes: 0 additions & 6 deletions src/pypi_attestation_models/__main__.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""The `pypi-attestation-models` APIs."""
"""The `pypi-attestations` APIs."""

__version__ = "0.0.5"

Expand Down
6 changes: 6 additions & 0 deletions src/pypi_attestations/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""The pypi-attestations entrypoint."""

if __name__ == "__main__":
from pypi_attestations._cli import main

main()
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from sigstore.sign import SigningContext
from sigstore.verify import Verifier, policy

from pypi_attestation_models import Attestation, AttestationError, VerificationError, __version__
from pypi_attestations import Attestation, AttestationError, VerificationError, __version__

if typing.TYPE_CHECKING:
from collections.abc import Iterable
Expand All @@ -36,7 +36,7 @@ def _parser() -> argparse.ArgumentParser:
)

parser = argparse.ArgumentParser(
prog="pypi-attestation-models",
prog="python -m pypi_attestations",
description="Sign, inspect or verify PEP 740 attestations",
parents=[parent_parser],
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
Expand All @@ -46,7 +46,7 @@ def _parser() -> argparse.ArgumentParser:
"-V",
"--version",
action="version",
version=f"pypi-attestation-models {__version__}",
version=f"pypi-attestations {__version__}",
)

subcommands = parser.add_subparsers(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Internal implementation module for `pypi-attestation-models`.
"""Internal implementation module for `pypi-attestations`.

This module is NOT a public API, and is not considered stable.
"""
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import tempfile
from pathlib import Path

import pypi_attestation_models._cli
import pypi_attestations._cli
import pytest
import sigstore.oidc
from pypi_attestation_models._cli import (
from pypi_attestations._cli import (
_logger,
_validate_files,
get_identity_token,
main,
)
from pypi_attestation_models._impl import Attestation
from pypi_attestations._impl import Attestation
from sigstore.oidc import IdentityError

ONLINE_TESTS = "CI" in os.environ or "TEST_INTERACTIVE" in os.environ
Expand All @@ -41,7 +41,7 @@ def test_main_verbose_level(monkeypatch: pytest.MonkeyPatch) -> None:
def default_sign(_: argparse.Namespace) -> None:
return

monkeypatch.setattr(pypi_attestation_models._cli, "_sign", default_sign)
monkeypatch.setattr(pypi_attestations._cli, "_sign", default_sign)

run_main_with_command(["sign", "-v", ""])
assert _logger.level == logging.DEBUG
Expand Down
2 changes: 1 addition & 1 deletion test/test_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path

import pretend
import pypi_attestation_models._impl as impl
import pypi_attestations._impl as impl
import pytest
from sigstore.dsse import _DigestSet, _StatementBuilder, _Subject
from sigstore.models import Bundle
Expand Down
4 changes: 2 additions & 2 deletions test/test_init.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Initial testing module."""

import pypi_attestation_models
import pypi_attestations


def test_version() -> None:
version = getattr(pypi_attestation_models, "__version__", None)
version = getattr(pypi_attestations, "__version__", None)
assert version is not None
assert isinstance(version, str)