Skip to main content

Signatures

Utitilties for assessing Python function signature equality and compatibility, with the latter accounting for subtypes (including Generics!)

Examples

See the test suite for a full set of examples.

Equality

# Identical function signatures are equal.
import signatures

def foo(thing: Any) -> None:
    pass

def bar(thing: Any) -> None:
    pass

assert signatures.equal(foo, bar)
# Different function signatures are not equal.
import signatures

def foo(eggs: Any) -> None:
    pass

def bar(cheese: Any) -> None:
    pass

assert not signatures.equal(foo, bar)

Compatibility

# A function signature is compatible with a more
# generic function signature.
from typing import TypeVar

import signatures

T = TypeVar("T", bound=int)

def foo(thing: bool) -> None:
    pass

def bar(thing: T) -> None:
    pass

assert signatures.compatible(foo, bar)
# Compatibility checks support nested Generic types.
import signatures

def foo(thing: List[Tuple[bool, str]]) -> None:
    pass

def bar(thing: List[Tuple[int, str]]) -> None:
    pass

assert signatures.compatible(foo, bar)
# A function signature is not compatible when
# Generic types are not compatible.
import signatures

def foo(thing: List[int]) -> None:
    pass

def bar(thing: List[Tuple[int, str]]) -> None:
    pass

assert not signatures.compatible(foo, bar)

License

Mozilla Public License v2.0

Metadata

Release files for signatures 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for signatures 0.3.1
File Size Uploaded Provenance Actions
signatures-0.3.1.tar.gz 8.4 kB Without provenance Details for signatures-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for signatures 0.3.1
File Interpreter ABI Platform Actions
signatures-0.3.1-py3-none-any.whl Python 3 none any Details for signatures-0.3.1-py3-none-any.whl

Total release size: 17.2 kB

Release files / signatures-0.3.1.tar.gz

Download URL signatures-0.3.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
88c1fb6f176eebc9f8493993214f573785fc72fb107ec989cdf9b306ddc9a3bd
BLAKE2b-256 checksum
How to use checksums
9f69ae943b31e5876a12b38151d5b3527518a7470e43b3593c14be1e01db14fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.2 Linux/5.13.0-1031-azure

Release files / signatures-0.3.1-py3-none-any.whl

Download URL signatures-0.3.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d3c3850b81b2d5e22536dbdc8d22ba9dd1b51434244bb1d9a64325f4732cb58
BLAKE2b-256 checksum
How to use checksums
e8acf0c638f14901afe5f27aea790d5005c54a13c81289c4d5d49718d19f4de8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.2 Linux/5.13.0-1031-azure

Security for signatures 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page