Micropython-Stubs Logo

Overview:

  • Introduction to MicroPython Stubs
  • Install the micropython-stubs
  • Static Type Checking of MicroPython code
  • Terms and Definitions

Configuration:

  • Configuring VSCode, Pylance or Pyright
  • Pylance/Pyright Advanced configuration
  • PyCharm Configuration
  • MicroPico Configuration [Pylance]
  • Type Checking with MyPy
  • Pylint Configuration
  • How to use the Micro:bit v2 stubs
  • Configuration using pyproject.toml

Advanced:

  • MicroPython’s typing.mpy module
  • Type check PIO code using the @rp2_asm decorator
  • Detailed Installation Guide
  • Micropython-Stubs
  • Stub Locations
  • DIY Stub file creation for MicroPython
  • Run the mcu stubber
  • Create a symbolic link
    • Windows 10 / 11
      • Powershell
      • mklink
    • Linux/Macos/Unix
  • Stub folder Naming Conventions.
  • Installing directy from the repository
  • Stub QA testing (Validation Snippets)

Stub index

  • List of available packages
  • Overview of all modules
  • Stubs by family and version
  • All stubs by type
Micropython-Stubs
  • Create a symbolic link
  • View page source

Create a symbolic link¶

This section is only relevant if you are using a local copy of the stubs and want to create a symbolic link from your project to a stubs or a publish sub-folder for testing or development purposes.

To create the symbolic link to the micropython-stubs/stubs folder the instructions differ slightly for each OS/ The below examples assume that the micropython-stubs repo is cloned ‘next-to’ your project folder. please adjust as needed.

Windows 10 / 11¶

Windows 10 and later requires Developer Mode to create symlinks as a regular user, or you can run the below commands from an elevated PowerShell prompt ( Run as Admin) .

Settings > Developer Settings > Developer Mode : On

Please see Activate Developer Mode for instruction on how to activate this. Or read the blogpost on the rationale and see some examples.

You can create a symlink using PowerShell or with the mklink cmdline tool. Both methods achieve exactly the same result.

Powershell¶

New-Item -ItemType SymbolicLink -Path "all-stubs" -Target (Resolve-Path -Path ../micropython-stubs/stubs)

Note

The target must be an absolute path.
Therefore Resolve-Path is used to resolve the relative path to an absolute path.

mklink¶

or use mklink in an (elevated) command prompt.

mklink /d all-stubs c:\develop\micropython-stubs\stubs

Note

The mklink target (last path) must be an absolute path

Linux/Macos/Unix¶

# target must be an absolute path
ln -s /path/to/micropython-stubs/stubs all-stubs

Note

The target (first path) must be an absolute path

Previous Next

© Copyright 2019-2024, Jos Verlinde.

Built with Sphinx using a theme provided by Read the Docs.