Skip to content

fix: annotate push() subject as oras.oci.Subject - #256

Open
Shubham-Padkonde wants to merge 3 commits into
oras-project:mainfrom
Shubham-Padkonde:fix/push-subject-type-annotation
Open

Shubham-Padkonde wants to merge 3 commits into
oras-project:mainfrom
Shubham-Padkonde:fix/push-subject-type-annotation

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

push() documents subject as oras.oci.Subject and serializes it with dataclasses.asdict(), but the parameter was annotated Optional[str], so type checkers rejected the documented usage
push(..., subject=Subject.from_manifest(manifest)).

Closes #253

push() documents subject as oras.oci.Subject and serializes it with
dataclasses.asdict(), but the parameter was annotated Optional[str], so
type checkers rejected the documented usage
push(..., subject=Subject.from_manifest(manifest)).

Closes oras-project#253

Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com>
Comment thread oras/tests/test_provider.py Outdated
uploaded["manifest"] = manifest
return Response()

container = client.get_container("registry.example/repository:tag")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not want to test this with the testing (real) registry?

Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com>
@Shubham-Padkonde

Copy link
Copy Markdown
Contributor Author

Added the real-registry regression in dea276a: it pushes an artifact with subject metadata and checks the subject descriptor returned by the registry. The two subject tests passed against a local Distribution registry before this identical patch was signed; formatting, import ordering, pyflakes and diff checks passed. Hosted checks are running.

Prepared with Codex assistance.

@vsoch

vsoch commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

The intent of my comment is to ask what is the point of doing monkeypatch if the best test is against a real registry.

Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com>
@Shubham-Padkonde

Copy link
Copy Markdown
Contributor Author

Removed the mocked subject-upload test in 02c653b and retained the real-registry round-trip test, including the public type-annotation assertion. The retained test passes against the local Distribution registry; Black and isort checks pass. Hosted CI is rerunning.

Prepared with Codex assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

subject parameter in OrasClient.push has wrong type annotation

2 participants