Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Introspector

[WIP] A Python library to write strongly typed code.

Table of contents

Introduction

Introduce strict typing in your functions.
This project is under development.

Requirements

  • Python >= 3.10

Basic usage

import introspector

@introspector.strict
def foo(a: int, b: list[dict[str, Any]]) -> list[int]:
    # Some funny code...

    return [1, 2, 3, 4]

foo(
    42, 
    [
        {
            'x': ['hello', 'world'],
            'y': 3.14,
        },
    ],
)

When the code is executed, the instrospector.strict decorator will inspect the signature of the foo function and compare it with the values passed in its parameters.
If the typing of the values does not match the signature of the function, introspector will throw a TypeError exception.

Python 3.10 supported typing syntax

This paclage support the following typing syntaxes:

Name Description Example
| operator The Union type shortcut syntax int | float

Instrospector.strict available options

:arrow_right: ignore

A list of parameter names that will be excluded from the typing control.
Notice that the ignore option will always contains self and cls.

Example:

@instrospector.strict(ignore=['b'])
def foo(a: int, b: float) -> None:
    ...

The argument b will be ignored by the typing control.

Metadata

Release files for introspector 0.2.1a0

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

Source distribution (sdist)

Source distribution for introspector 0.2.1a0
File Size Uploaded
introspector-0.2.1a0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for introspector 0.2.1a0
File Interpreter ABI Platform
introspector-0.2.1a0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / introspector-0.2.1a0.tar.gz

Download URL introspector-0.2.1a0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4d96044f02e80e8ea85c8b5a8774068aca239d112488b1d19398a0e5526b2dd2
BLAKE2b-256 checksum
How to use checksums
145ddd0bf57712fcbcfa63691f1415fd29818cbf1cfe763b8fa6f4daede26dcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release files / introspector-0.2.1a0-py3-none-any.whl

Download URL introspector-0.2.1a0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
905c3dff1b74beb86d722b97fe171d57bf3d47d687d84d9f1f2f2a12f9a2aba7
BLAKE2b-256 checksum
How to use checksums
b85b975c630e1f18ffec738c2817bf10e87a8fa572f643dc721e31fb716a111d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.2.1a0 This release

2 release files

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