Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_toto_attestation broken on Python < 3.9 #300

Closed
woodruffw opened this issue Dec 7, 2023 · 2 comments · Fixed by #301
Closed

in_toto_attestation broken on Python < 3.9 #300

woodruffw opened this issue Dec 7, 2023 · 2 comments · Fixed by #301

Comments

@woodruffw
Copy link
Contributor

It looks like in_toto_attestation is marked for Python 3.7+ but is using annotation features that were only stabilized in 3.9+, e.g. type[T] instead of typing.Type[T]`.

From https://github.com/sigstore/sigstore-python/actions/runs/7134485043/job/19429407875?pr=804:

Traceback (most recent call last):
  File "/home/runner/work/sigstore-python/sigstore-python/env/bin/sigstore", line 5, in <module>
    from sigstore._cli import main
  File "/home/runner/work/sigstore-python/sigstore-python/sigstore/_cli.py", line 54, in <module>
    from sigstore.sign import SigningContext
  File "/home/runner/work/sigstore-python/sigstore-python/sigstore/sign.py", line 55, in <module>
    from in_toto_attestation.v1.statement import Statement
  File "/home/runner/work/sigstore-python/sigstore-python/env/lib/python3.8/site-packages/in_toto_attestation/v1/statement.py", line 4, in <module>
    from in_toto_attestation.v1.resource_descriptor import ResourceDescriptor
  File "/home/runner/work/sigstore-python/sigstore-python/env/lib/python3.8/site-packages/in_toto_attestation/v1/resource_descriptor.py", line 8, in <module>
    class ResourceDescriptor:
  File "/home/runner/work/sigstore-python/sigstore-python/env/lib/python3.8/site-packages/in_toto_attestation/v1/resource_descriptor.py", line [22](https://github.com/sigstore/sigstore-python/actions/runs/7134485043/job/19429407875?pr=804#step:5:23), in ResourceDescriptor
    def copy_from_pb(proto: type[rdpb.ResourceDescriptor]) -> 'ResourceDescriptor':
TypeError: 'type' object is not subscriptable
@woodruffw
Copy link
Contributor Author

In terms of post-mortems: it looks like this could have been prevented by running tests/lints in CI/CD for the supported Python versions here. If there's interest, I can do that.

@joshuagl
Copy link
Contributor

joshuagl commented Dec 8, 2023

Yes please! If we're going to generate API it would be good to test it comprehensively and have confidence in what we publish.

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 a pull request may close this issue.

2 participants