Addon Manager and pip based Addons for 1.0?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
garlicbread
Posts: 14
Joined: Sun Mar 17, 2019 3:55 am

Addon Manager and pip based Addons for 1.0?

Post by garlicbread »

Hi,
I've noticed (after messing with the cadquery addon) that there's actually a new style of addon
which uses pip to install the addon instead of copying / pasting into a Mod directory

https://forum.freecadweb.org/viewtopic.php?t=36051
https://github.com/FreeCAD/freecad.workbench_starterkit

I was wondering if installing this type of addon was something that had been considered for the next 1.0 release?
I think it might have some advantages, one of which might be the use of pip's extra-index-url to search for freecad specific packages
(similar to https://github.com/FreeCAD/FreeCAD-addons but using pips inbuilt indexing)
although there may be some questions such as when uninstalling if to also uninstall any auto installed depends etc

For the metadata / manifest it may be an idea to borrow some ideas from the visual studio code one
that seems to have the best extension manager I've seen so far (although it's written in a different language)

https://code.visualstudio.com/api/refer ... n-manifest

One option might be to pick up metadata from the new pyproject.toml which I think replaces setup.py
I've been considering trying to write my own implementation of an extension manager possibly using rust
which I think would work but may have issues with Qt bindings which don't seem to have gotten a lot of attention from the rust side of things
User avatar
chennes
Veteran
Posts: 3906
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Addon Manager and pip based Addons for 1.0?

Post by chennes »

That type of addon should already work fine: you can use pip to install that type of workbench in the current version of FreeCAD (it should work with everything 0.19 and later).
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
garlicbread
Posts: 14
Joined: Sun Mar 17, 2019 3:55 am

Re: Addon Manager and pip based Addons for 1.0?

Post by garlicbread »

It does install / work via pip
but the question is, is it compatible with the existing Addon Manager?
Ideally you want everything available listed in the Addon Manager.
User avatar
chennes
Veteran
Posts: 3906
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Addon Manager and pip based Addons for 1.0?

Post by chennes »

The Addon Manager shows the packages available in the FreeCAD-Addons GitHub repository. If a pip-installable package is listed in that location it will show in the Addon Manager, but the AM does not use pip to install those packages. The pip installation process was designed to be an additional way to install packages, outside the Addon Manager.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
garlicbread
Posts: 14
Joined: Sun Mar 17, 2019 3:55 am

Re: Addon Manager and pip based Addons for 1.0?

Post by garlicbread »

When I read the description here - https://github.com/FreeCAD/freecad.workbench_starterkit
It mentions
Note: There are currently two FreeCAD workbench styles.
The origin workbench type is called "legacy-workbench".
In addition the "namespace-workbench" is now an optional (and preffered) way to extend the FreeCAD.
(See Glossary terms used in this discussion). For more discussion about the motivation behind the "namespace-workbench" see Motivation for namespace-workbenches.
This sort of suggests that the pip method is the newer preferred method rather than just an alternative.
(perhaps it shouldn't be describing the old method as legacy)
I might see if I can write my own addon manager as a proof of concept in python to cover pip installs
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Addon Manager and pip based Addons for 1.0?

Post by onekk »

I thunk that pip is not very usable if you have an AppInage or a Snap similar "compressed container", orvthere us a way to adree things using some external directory that will contain "added packages" and that us readed automagically when the Appimage (Snap or wathever else) is started?

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
chennes
Veteran
Posts: 3906
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Addon Manager and pip based Addons for 1.0?

Post by chennes »

You can tell pip to install in a specific directory: the Addon Manager already does this for dependencies. The real problem with pip is that it doesn't have a public API, so you are stuck with text processing to handle its output. The AM does this (and there is more coming as I add the ability to update those dependencies), but it's ugly.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
onekk
Veteran
Posts: 6205
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Addon Manager and pip based Addons for 1.0?

Post by onekk »

From a quick reading, and being on mobile for some days, it seems that distlib could have some API tominteract with PyPi that from what I know is the "repository" were pip packages are placed.

It is cited in the linked doc you have posted.

Probably you have seen this, but just in case...

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: Addon Manager and pip based Addons for 1.0?

Post by adrianinsaval »

Kinda off topic but I have a question, @chennes does any of the currently whitelisted pip packages require compilation?
Post Reply