Skip to main content

Stubmaker

Stubmaker is an easy-to-use tool for generating python stubs.

Requirements

  • Stubmaker is to be run under Python 3.7.4+
  • No side effects during module imports
  • Must contain __all__ (this restriction will be removed in upcomming releases)

How to install

pip install stubmaker
stubmaker --help

Usage example

Imagine you have a package with the following structure:

package
-> __init__.py

Contents of __init__.py:

__all__ = ['sleep_for']
from time import sleep


def some_decorator(func):
    return func


@some_decorator
def sleep_for(amount: float) -> None:
    sleep(amount)

There is a script that calls sleep_for method but passes wrong arguments:

from package import sleep_for

sleep_for(123, 123)

Due to dynamic nature of decorators static analysers (such as mypy) may not raise an error while checking the script:

>> mypy __main__.py

Success: no issues found in 1 source file

Stubs exist to help you! Stubmaker will provide stubs for your package so that its users can find the error using mypy:

>> stubmaker --module-root package --src-root <path to package>/package --output-dir <path to package>/package
>> mypy __main__.py

__main__.py:3: error: Too many arguments for "sleep_for"
Found 1 error in 1 file (checked 1 source file)

License

© YANDEX LLC, 2020-2021. Licensed under the Apache License, Version 2.0. See LICENSE file for more details.

Metadata

Release files for stubmaker 0.1.0

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

Source distribution (sdist)

Source distribution for stubmaker 0.1.0
File Size Uploaded
stubmaker-0.1.0.tar.gz 23.4 kB Details

Built distribution (wheel)

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

Total release size: 54.0 kB

Release files / stubmaker-0.1.0.tar.gz

Download URL stubmaker-0.1.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4905835c8a935c2da44c93ae782bbe53fa5f49142e0bc7fa550704c4a775856f
BLAKE2b-256 checksum
How to use checksums
eaee4a532b81e9932d98c7b2fa526128e24d1d84792865ca53584bcf5427c3da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / stubmaker-0.1.0-py3-none-any.whl

Download URL stubmaker-0.1.0-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a08ed4c8f14b464c440160428753bb7f2574c726cd6a9f1121663f1c55cabb69
BLAKE2b-256 checksum
How to use checksums
8e196e45f777246d6cf4763afadaec0694243a2c9277d2ee5ed4d12d6bea21c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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