Abstract class attributes
Project description
abcattrs
Abstract class attributes for ABCs.
Examples
import abc
from abcattrs import abstractattrs, Abstract
@abstractattrs
class A(abc.ABC):
foo: Abstract[int]
# Abstract subclasses can add more required attributes.
class B(A, abc.ABC):
bar: Abstract[str]
class C(B):
# C must assign values to both of these attributes to not raise an error.
foo = 1
bar = "str"
# This raises an error.
class MissingBar(B):
foo = 1
# This raises an error.
class MissingFoo(B):
bar = "str"
The Abstract
qualifier can be combined with other PEP 593 annotations.
from typing import Annotated
import abc
from abcattrs import abstractattrs, Abstract
@abstractattrs
class A(abc.ABC):
# Combine with other annotations
bar: Annotated[str, Abstract, "other info"]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
abcattrs-0.6.0.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file abcattrs-0.6.0.tar.gz
.
File metadata
- Download URL: abcattrs-0.6.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
ff7340d4326646797b07972640a3d426f4a672a9f61bb9ade86d310ba4208098
|
|
MD5 |
cfe919fe36de2386d1bc3317658e1086
|
|
BLAKE2b-256 |
7e2266118dd705be822d62fd0fefd8c7994ffa9385283cf3ba0723e073cec61b
|
Provenance
The following attestation bundles were made for abcattrs-0.6.0.tar.gz
:
Publisher:
release.yaml
on antonagestam/abcattrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
abcattrs-0.6.0.tar.gz
-
Subject digest:
ff7340d4326646797b07972640a3d426f4a672a9f61bb9ade86d310ba4208098
- Sigstore transparency entry: 216002866
- Sigstore integration time:
-
Permalink:
antonagestam/abcattrs@7293c3bbe53fea66447e3167f19c2c386cbebd15
-
Branch / Tag:
refs/tags/0.6.0
- Owner: https://github.com/antonagestam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
release.yaml@7293c3bbe53fea66447e3167f19c2c386cbebd15
-
Trigger Event:
release
-
Statement type:
File details
Details for the file abcattrs-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: abcattrs-0.6.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6b76ca38d8bf6f9a97620f6d0b19d7a00583ec49b90b8ab1b217a94f994bd85f
|
|
MD5 |
95d04eb218c7e53a8cbd00ec9410b9e7
|
|
BLAKE2b-256 |
cd8a105fce62b969ac1045f2941ad0eb73ec0befb64646effda1b043922f4af0
|
Provenance
The following attestation bundles were made for abcattrs-0.6.0-py3-none-any.whl
:
Publisher:
release.yaml
on antonagestam/abcattrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
abcattrs-0.6.0-py3-none-any.whl
-
Subject digest:
6b76ca38d8bf6f9a97620f6d0b19d7a00583ec49b90b8ab1b217a94f994bd85f
- Sigstore transparency entry: 216002875
- Sigstore integration time:
-
Permalink:
antonagestam/abcattrs@7293c3bbe53fea66447e3167f19c2c386cbebd15
-
Branch / Tag:
refs/tags/0.6.0
- Owner: https://github.com/antonagestam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
release.yaml@7293c3bbe53fea66447e3167f19c2c386cbebd15
-
Trigger Event:
release
-
Statement type: