Skip to main content

Type stubs for compose

Project description

Type stubs for compose.

Versioning

This library’s version numbers follow the SemVer 2.0.0 specification.

Installation

pip install compose-stubs

Usage

Like any other typing stub package, once installed it should “just work”. You might need to restart your type checker.

Limitations

  1. MyPy fails to match the return type of an async function to the argument type of the next function in the type hints of acompose and sacompose, leading to false errors about types not matching. (Pyright and Pyre don’t have this problem.)

  2. Due to limitations in Python type hints, these typing stubs only cover at most 16 arguments in a single call to compose, acompose, or sacompose. This limit could be higher, but the higher the limit, the slower the type-checking. A simple workaround is to just use multiple compose calls to build up compositions bigger than 16 functions.

  3. Due to limitations in Python type hints, there is an edge case in the type hints for sacompose if the return type of one function in a composition is awaitable and the next function accepts that awaitable (the most likely way for this to happen is if it accepts Any), then sacompose actually returns an async callable, but the type inference will think that it returns a sync callable.

  4. Requires Python 3.10 and above (compose itself remains supported on much older versions, but the type hints need typing.ParamSpec).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compose-stubs-1.0.0.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

compose_stubs-1.0.0-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page