FreeCAD stub files for enhanced development experience in external editors such as VS Code and Neovim.
Based on CyrilWaechter/freecad-stubs which uses mypy to automatically generate stubs.
This approach is limited.
For a more complex approach, see Vanuan/freecad-python-stubs and Type-checked Python forum discussion.
From the root of this repository:
pip install --editable .
- Install Miniconda (conda).
Execute the following commands from the root of this repository.
-
Create
freecad-stubs
conda environment.conda env create --file environment.yml
-
Activate
freecad-stubs
environment.conda activate freecad-stubs
-
Add the
$CONDA_PREFIX/lib
directory to$PYTHONPATH
(this allowsFreeCAD
to be imported as a module within python)../add_conda_path_to_python_path.sh
-
Deactivate and re-activate
freecad-stubs
environment.conda deactivate && conda activate freecad-stubs
-
Verify
freecad
executable is accessible:freecad --version
The version of FreeCAD is defined in environment.yml
within the root of this repository.
-
Check if there's a newer version from FreeCAD's GitHub releases page or Wiki.
-
Increase version for
freecad
inenvironment.yml
. -
Remove
freecad-stub
s conda environment created in the "Setup" section.conda remove --name freecad-stubs --all
-
Reperform steps in the Setup section to recreate
freecad-stubs
conda environment.