View on GitHub

FreeCAD Developers Handbook

A handbook about FreeCAD development

Python stubs #

Python is a dynamically typed language, so there is no error when compiling (Yes, Python can compile. Compiling/interpreting is an abstract concept, language independent. See more on stackoverflow). Instead, an error is reported at runtime which may significantly slow down developing process.

To overcome this problem, Python introduced Type Hints. Using an external tool (type checker like Mypy, Pyright ) it is possible to detect runtime errors.

Also, stub files allow IDE (integrated development environment) detect possible names for imported classes or method names.

Installation #

PyPi #

It is possible to install stubs directly from PyPI:

pip install FreeCAD-stubs

From GitHub repo (especially older versions) #

To install stubs for older FreeCAD version (replace FreeCAD-0-20 with tag/branch you want), you can run:

pip install git+

Or manually using cloning repo:

  1. Clone repo:

     git clone
  2. Choose desired version:

    git checkout FreeCAD-0-20
  3. And install directly:

    pip install freecad-stubs

False positives in stubs #

Probably not all types are correctly detected. Reporting issues are very welcome.