Python stubs for FreeCAD
Project description
freecad-stubs
Python stubs generated from FreeCAD source code.
Stub source
Stubs are generated based on several available info:
*Py.xmlfiles - mainly docstrings, argument names, properties.- corresponding
*PyImp.cppfile - argument types are extracted from C code. - other
*.cppfiles - functions for modules.
Unfortunately not all typing information may be generated.
For example some objects are added dynamically.
There are also many special cases
therefore not all object are correctly mapped.
Moreover, some of C function has errors - invalid types, missing arguments
(you can see more these errors if you change logger flag in configuration file freecad-stubs/lib/freecad_stub_gen/config.py)
Install stubs
You can install all stubs for freeCAD packages by running:
python -m pip install freecad-stubs
Adding stubs to python path
There are a lot of possible methods. This is only example:
-
Copy stubs from a desired branch from this repository.
Checkout to desired branch and copy folder/freecad_stubs. -
(Optional) Or generate stubs manually. Copy/move generated stubs to location of your choice. For example:
cp -r ./freecad_stubs "$HOME/.local/lib/python3.9/freecad_stubs"
-
Add location with stubs to python search path. For example:
echo "$HOME/.local/lib/python3.9/freecad_stubs" > "$HOME/.local/lib/python3.9/site-packages/freecad_stubs.pth"
Stub Generation
-
Clone freecad repository.
git clone https://github.com/FreeCAD/FreeCAD.git
Warning: FreeCAD repository has over
1.29 GBYou may download only these required folders:
- /src/App
- /src/Base
- /src/Gui
- /src/Mod
-
Clone this repository
git clone https://github.com/ostr00000/freecad-stubs
-
Configure paths
In the filefreecad-stubs/lib/freecad_stub_gen/config.pyset desired configuration:SOURCE_DIR-srcfolder from FreeCAD repository,TARGET_DIR- target folder where stubs should be generated.Warning:
TARGET_DIRfolder and its content may be removed when generating stubs.
-
Run the main file from this project in Python
pytohn freecad-stubs/lib/freecad_stub_gen/__main__.pyRequired python version:
>=3.10.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freecad-stubs-1.0.1.tar.gz.
File metadata
- Download URL: freecad-stubs-1.0.1.tar.gz
- Upload date:
- Size: 137.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.10.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a19717bd8a5cacb4a7d6520fe2975f55c114a9b82666222ddb2371cd3754fece
|
|
| MD5 |
acd6a13a6cf3468eb7a879946a1c2f1e
|
|
| BLAKE2b-256 |
89d9b65f525551e3ac761b8285569bb8fca264e03ed332c76d7d44b9894b376b
|
File details
Details for the file freecad_stubs-1.0.1-py3-none-any.whl.
File metadata
- Download URL: freecad_stubs-1.0.1-py3-none-any.whl
- Upload date:
- Size: 145.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.10.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
423f690d4d8dc1e7942e84116efdc41fe30d57b255768a807fb9abaee7751b2c
|
|
| MD5 |
e7508b6d9eff42ee83cea61977e57f83
|
|
| BLAKE2b-256 |
42e49c8b2d41d68a47debca1f9d64224cab6709054e1546d081d29804e6dfaa6
|