Addon Manager Developer Mode

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!
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Addon Manager Developer Mode

Post by chennes »

I've just pushed a large changeset to the Addon Manager, adding a beta version of a new "Developer Mode", designed to help developers package up their addons for distribution. As a first task, it assists with creating a correct package.xml metadata file.

To activate the mode, check the box in Preferences:
Screen Shot 2022-09-09 at 12.58.42 PM.png
Screen Shot 2022-09-09 at 12.58.42 PM.png (191.19 KiB) Viewed 3127 times
That will enable a new button in the Addon Manager:
Screen Shot 2022-09-09 at 12.59.06 PM.png
Screen Shot 2022-09-09 at 12.59.06 PM.png (36.08 KiB) Viewed 3127 times
Which will activate a whole sequence of dialogs, centered around this one:
Screen Shot 2022-09-09 at 12.59.50 PM.png
Screen Shot 2022-09-09 at 12.59.50 PM.png (177.92 KiB) Viewed 3127 times
This is still very much a work in progress, so I welcome your feedback, bug reports, and feature suggestions.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Addon Manager Developer Mode

Post by Kunda1 »

Amazing work @chennes !
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
HakanSeven12
Veteran
Posts: 1481
Joined: Wed Feb 06, 2019 10:30 pm

Re: Addon Manager Developer Mode

Post by HakanSeven12 »

Nice
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Addon Manager Developer Mode

Post by Kunda1 »

'Addon Manager Developer Mode' is now available in the latest Snap 'edge' for those wanting to test @chennes's feature.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
obelisk79
Veteran
Posts: 1063
Joined: Thu Sep 24, 2020 9:01 pm

Re: Addon Manager Developer Mode

Post by obelisk79 »

This seems really good, well done chennes!
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Addon Manager Developer Mode

Post by chennes »

I should also note that I tweaked the actual metadata standard while I was working on this, most notably adding the "optional" and "type" attributes to dependencies. These changes are backwards-compatible (previous versions of FreeCAD will just ignore them) and they are of course optional.

I'm planning on making another change as part of my longer-term plan to ensure that users stuck on older versions of FreeCAD don't accidentally get updated to a version of an Addon that is no longer compatible with that version, but I'd like to get some feedback on what that looks like before I implement it. I am thinking of something along the lines of:

Code: Select all

<release version_lt="0.20">abcd1234</freecad> <!-- Older versions of FC always get this specific hash, no updates -->
<release version_eq="0.20">FC0_19_Branch</freecad> <!-- v0.20 has its own maintenance branch -->
<release version_gt="0.20">main</freecad> <!-- Anything after 0.20 should use the branch called "main" -->
The syntax here is exactly the same as the dependency attributes, except that the "version" referred to uses FreeCAD's version, and the tag contents are a git reference of some kind (hash, tag, or branch). I don't really like the "release" nomenclature, but I haven't thought of anything better, so please feel free to make a suggestion.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Addon Manager Developer Mode

Post by onekk »

chennes wrote: Thu Sep 15, 2022 7:18 pm Developer Tools is brand new, I added it at the beginning of this week.
Now with:

Code: Select all

OS: Artix Linux (openbox)
Word size of FreeCAD: 64-bit
Version: 0.21.30398 (Git)
Build type: Release
Branch: master
Hash: b3dfdc568a92810449bf47bc73b6784d65dfa206
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: Italian/Italy (it_IT)
Installed mods: 
  * Curves.backup1662281788.2751102 0.4.1
  * fcgear.backup1662281841.5151978 1.0.0
  * Assembly4.backup1663652740.0704694
  * test_wb
  * fcgear 1.0.0
  * Assembly4 0.12.4
  * Curves 0.5.8
  * Help.backup1662281850.737508 1.0.3
  * Help 1.0.3
It seems that developer tools are usable (and I've used them to validate a package) and save it:

but I've noted that the format is "not compliant" with the examples:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<package format="1">

  <name>OpenSCAD alternate importer</name>

  <description>An alternate OpenSCAD importer - with some experimental features</description>

  <version>1.0.0</version>

  <maintainer email="keith@sloan-home.co.uk">Keith Sloan</maintainer>

  <license file="LICENSE">GPL-2</license>

  <url branch="master" type="repository">https://github.com/KeithSloan/OpenSCAD_Alt_Import</url>

  <url type="readme">https://github.com/KeithSloan/OpenSCAD_Alt_Import/blob/master/README.md</url>

  <url type="documentation">https://github.com/KeithSloan/OpenSCAD_Alt_Import/wiki</url>

  <icon>freecad/OpenSCAD_Alt_Import/Resources/icons/OpenSCAD_Alternate.png</icon>

  <date>2022-08-18</date>

  <content>
    <workbench>
      <freecadmin>0.20.0</freecadmin>
      <tag>openscad</tag>
      <tag>scripting</tag>
      <tag>programming</tag>
      <icon>freecad/OpenSCAD_Alt_Import/Resources/icons/OpenSCAD_Alternate.png</icon>
      <classname>OpenSCAD_Alt_Import</classname>
      <subdirectory>./</subdirectory>
    </workbench>
  </content>

</package>

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<package format="1" xmlns="https://wiki.freecad.org/Package_Metadata">
  <name>Legacy Workbench</name> <!-- What the Addon Manager displays to users -->
  <description>Text that the Addon Manager shows for the Addon. Any length, but remember that Addon Manager's compact view only shows the first sentence or so.</description>
  <version>1.0.1</version> <!-- Semantic versioning (1.2.3-beta) or CalVer-based, (2022.01.07), don't omit or non-git installations won't see your updates -->
  <date>2022-01-07</date> <!-- Date of the last update to the version number -->
  <maintainer email="your_address@null.com">Your Name</maintainer>
  <license file="LICENSE">LGPL-2.1</license> <!-- Make sure you actually have this file in your Addon repo if the license requires it -->
  <url type="repository" branch="main">https://github.com/chennes/FreeCAD-Package</url> <!-- Don't forget to update the branch name here -->
  <url type="readme">https://github.com/chennes/FreeCAD-Package/blob/main/README.md</url> <!-- Link to the HTML-rendered README page -->
  <icon>Resources/icons/PackageIcon.svg</icon> <!-- If you include your icon here, you don't have to submit it to the main FreeCAD repo -->

  <content>
    <workbench>
      <classname>MyLegacyWorkbench</classname> <!-- Must match class name in InitGui.py -->
      <subdirectory>./</subdirectory>
    </workbench>
  </content>

</package>


notably the

Code: Select all

<package format="1">
and in the workbench stanza some elements have a different order.

I have uploaded the "processed package.xml" to the site, to see if it is working correctly.

It seems that however the <name> used is taken from .gitmodules and not from the package.xml as it shown the "Alternate OpenSCAD...." instead of "OpenSCAD alternate importer" present in the package.xml.

EDIT:

As a side note I have this warning:

Code: Select all

Worker process check_for_python_package_updates_worker is taking a long time to stop...
And it blocks the exit from the session, that I start from a terminal using a script, forcing me to close the "terminal window" but FreeCAD window is closing correctly. If you need futher informations feel free to ask.


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: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Addon Manager Developer Mode

Post by chennes »

A few points:
  1. The order of the elements does not matter, and the XML writer is allowed to write them however it wants. So the formatting and order is basically out of my control, and doesn't affect anything.
  2. The XML is missing the required namespace element, so I do have to address that.
  3. The displayed name sounds like it's wrong, so I'll look into that.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
onekk
Veteran
Posts: 6149
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Addon Manager Developer Mode

Post by onekk »

chennes wrote: Tue Sep 20, 2022 4:16 pm ...
Thanks for your work, and for you patience.

XML order is more a cosmetic thing, as usual a little note in the documentation will be useful IMHO, as probably other user will complain of "changed order".

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: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Addon Manager Developer Mode

Post by chennes »

chennes wrote: Tue Sep 20, 2022 4:16 pm
  1. The XML is missing the required namespace element, so I do have to address that.
Fixed by git commit 49e37dd61.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply