Skip to content

About

Crowdsourced (a crowd of one) stub type-files for third-party Python packages.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

stubFileNotFound: Stub Type Files that reduce complaints from Pylance and Ruff

  • I usually run stubdefaulter.
  • I sometimes add missing annotations.
  • I sometimes use Any for missing annotations so type checkers don't complain about "UNKNOWN".
  • Most changes are automated, but not sophisticated.

This is a useful tool for me, but I haven't really figured out how to make it useful for more people.

stub files got found

  1. I donated resampy to typeshed: PyPI install.
  2. I'm contributing work on cytoolz and toolz to toolz-stubs, which is incorporating cytoolz-stubs, too.

How to Contribute

  1. Create or improve a stub file.
  2. Submit a Pull Request.

Usage

The following might work for you, but I don't really know for sure.

To use the stub files from this repository:

  1. Clone the repository.

    git clone https://github.com/hunterhogan/stubFileNotFound.git
  2. Tell your type checker about the stubs directory.

Visual Studio Code

Relevant settings may include

  • python.analysis.stubPath
  • mypy-type-checker.args "--custom-typeshed-dir=typings"

Virtual directories (symlinks)

(.venv) C:\apps\Z0Z_tools> MKLINK /D typings \apps\stubFileNotFound\stubs

Tools I might use to create a stub

  1. Copy and paste the signature into a stub file. Improve it.

  2. mypy stubgen

    stubgen --verbose --include-docstrings ^
    --include-private --output typings ^
    --package nameOfAnInstalledPackage

    VS Code: workbench.action.openGlobalKeybindingsFile

     {
         "args": {
             "text": "stubgen --include-private --include-docstrings --output typings --verbose -p ${selectedText}\n"
         },
         "command": "workbench.action.terminal.sendSequence",
         "key": "ctrl+shift+t"
     },

    2026-10-16: "Hey, thanks, old me! I wanted the keybinding information, and here it is!"

  3. pyright

    1. pyright --createstub nameOfAnInstalledPackage
    2. "Quick Fix" in VS Code.
  4. Pylance if reportMissingTypeStubs is enabled and the stub is missing: "Quick Fix"

Tools that can allegedly create a stub

  1. MonkeyType
  2. stubgen-pyx: stubgen-pyx /path/to/package
  3. stub-generator

Tools I probably won't use

  1. Nuitka-Stubgen: pip install AST-Stubgen

    import pathlib
    import Ast_Stubgen
    pathlib.Path('typings/Ast_Stubgen').mkdir(parents=True, exist_ok=True)
    Ast_Stubgen.generate_stub('.venv/Lib/site-packages/Ast_Stubgen/stubgen.py', 'typings/Ast_Stubgen/stubgen.pyi')
    Ast_Stubgen.generate_stub('.venv/Lib/site-packages/Ast_Stubgen/__init__.py', 'typings/Ast_Stubgen/__init__.pyi')

My recovery

Static Badge

CC-BY-NC-4.0

By law, authors retain their copyrights unless they grant exceptions. The Attribution-NonCommercial 4.0 International Deed outlines how you may use this work.

The restriction on commercial use (without a license) limits advantage-taking, unjust enrichment, and exploitation. You would be morally wrong if you were to enrich yourself by using this work while I am denied healthcare, housing, security of property, and the safety of my person.

To obtain and retain the right to use this work, you incur the cost of attributing the work to me. Your nominal cost might accrue as a benefit that mitigates my suffering or saves my life.

About

Crowdsourced (a crowd of one) stub type-files for third-party Python packages.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages