Registry / type-stubs / pika-stubs

pika-stubs

JSON →
library0.1.3pypypiunverified

Pika-stubs provides PEP-484 compliant type stubs and a Mypy plugin for the Pika RabbitMQ client library. Its purpose is to offer more precise static type checking and improved type inference for code written with Pika. The current version is 0.1.3, released in June 2020. The project appears to be in an unmaintained or abandoned state, classified as '1 - Planning' on PyPI with no subsequent releases.

pip install pika-stubs
INSTALL
IMPORT
SIG · PIKA-STUBS
P
pika-stubs
type-stubspythonv0.1.3
Install
2.4s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BlockingConnection
from pika_stubs import BlockingConnection
from pika_stubs import BlockingConnection

This quickstart demonstrates how pika-stubs enhances type checking for a basic Pika consumer. After installing `pika-stubs` alongside `pika` and `mypy`, running `mypy` on the Python file will utilize the provided type information to catch potential errors or provide better IDE suggestions. The example uses environment variables for RabbitMQ host for flexibility.

# consumer.py import pika import os def callback(ch: pika.channel.Channel, method: pika.spec.Basic.Deliver, properties: pika.spec.BasicProperties, body: bytes) -> None: print(f" [x] Received {body.decode()}") def main() -> None: rabbitmq_host = os.environ.get('RABBITMQ_HOST', 'localhost') connection = pika.BlockingConnection( pika.ConnectionParameters(host=rabbitmq_host) ) channel = connection.channel() channel.queue_declare(queue='hello') channel.basic_consume(queue='hello', on_message_callback=callback, auto_ack=True) print(' [*] Waiting for messages. To exit press CTRL+C') try: channel.start_consuming() except KeyboardInterrupt: channel.stop_consuming() finally: connection.close() if __name__ == '__main__': main() # To run mypy with pika-stubs: # 1. pip install pika pika-stubs mypy # 2. RABBITMQ_HOST=localhost python consumer.py (in one terminal) # 3. mypy consumer.py (in another terminal)
Debug
Known issues
breakingPika-stubs requires Python 3.8 or newer. Attempting to install on older Python versions (e.g., 3.7) will result in an installation failure.
fix
Ensure your Python environment is 3.8 or newer before installing `pika-stubs`. Consider using a virtual environment.
affects: <=0.1.3 on Python <3.8
gotchaThis library (pika-stubs) appears to be unmaintained. Its last release was in June 2020, and its PyPI status is '1 - Planning'. More actively maintained alternatives like `types-pika-ts` (part of typeshed) or `types-pika` may offer more up-to-date and complete typings for recent Pika versions.
fix
For newer Pika versions or more active maintenance, consider `pip install types-pika-ts` or `pip install types-pika` instead. Consult their respective documentation for usage.
affects: All versions of pika-stubs (0.1.3)
Upgrade
Version history
0.1.3latest on PyPI · released Jun 10, 2020
Audit
Dependencies
pikarequiredProvides type stubs for the pika library; essential for its functionality.
mypyrequiredA static type checker that utilizes these stubs for type inference.
Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
1
Resources
pika-stubs — pip install pika-stubs · libregistry