I need to pip install pydantic to improve the importing of Sweethome3d files.

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
gr4viton
Posts: 3
Joined: Wed Mar 23, 2022 9:16 pm

I need to pip install pydantic to improve the importing of Sweethome3d files.

Post by gr4viton »

Hello,

Just starting with FreeCad... Aaand accidentally I found myself in the middle of improving the Sweethome3d -> FreeCAD importer script. I am reusing a Sh3d parser from my other project, though for the parsing I use data model classes defined using the Pydantic python package.. And also i use glom.. :twisted:
Large oof
I got around it by extracting the AppImage of the FreeCAD (v0.19) locally. https://www.linuxfixes.com/2022/02/solv ... ython.html

Code: Select all

# I manually created a fresh venv by using the extracted python interpreter
> appimage/usr/bin/python -m venv venv
# ...
# then installed the required packages by using the venv
# ...
> appimage/usr/bin/venv/bin/python -m pip install pydantic glom ...
# then copied all the newly created folders and files from
> from=appimage/usr/bin/venv/lib/python-3.9/site-packages/
# to the ones in the extracted Appimage
> to=appimage/usr/lib/python-3.9/site-packages/
# ... i dare you to run this snippet ;)
That were pretty nice and engaging 4++ hours of my life (searching the web and trying all the other dead ends) :D.. Anyway, how to do it properly?

Do I get it correctly that there is no simple way how to install additional python dependencies to the FreeCAD python interpreter from the inside the FreeCAD interactive console (pip does not like doing this), nor anyhow from the script? I do not want to build the FreeCAD from sourcecode (I already did, but I do not need the base program to have new python dependencies just because of one importer..

Is the only way for me creating a separate FreeCAD addon - which can then install new python dependencies to be used by FreeCAD internal python interpreter?

I am not sure if this is "da wae", I tried to find some tutorial for new FreeCAD addons though I am bad at using Google.. I am kidding I did not find any, are there some?
Would anyone know which of the addons from https://github.com/FreeCAD/FreeCAD-addons I should try to mimic. I wen through a few of them, though I think someone can direct me much easier then me selecting not the easiest :).

I think there might be a few nice option check-boxes, so a separate addon might be a good next step anyway. I understood that in 0.20 there might be some big improvements for the Addons (again), though not really sure where to start in 0.19...
Post Reply