Discussion: removing Ply from FreeCAD's source code

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!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Discussion: removing Ply from FreeCAD's source code

Post by vocx »

Ply (Python-lex-yacc) is a dependency of the OpenSCAD Workbench.

However, as of now, the entire Ply package is included inside the subdirectory of OpenSCAD.

Code: Select all

src/Mod/OpenSCAD/ply/
Apparently this was for historical reasons, because in the past, around 2013, Ply was not easily installable from Linux repositories.

Nowadays, Ply can be installed from apt, pip, and I guess other packagers.

Code: Select all

apt-cache policy python3-ply
python3-ply:
  Installed: 3.11-1
  Candidate: 3.11-1
  Version table:
 *** 3.11-1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu bionic/main i386 Packages
        100 /var/lib/dpkg/status
Therefore, there is no need to carry this library in the source of FreeCAD itself. Like other Python dependencies, it should be listed as a dependency on installation, so FreeCAD packages in every platform should be updated accordingly.

In pull request #2890, KeithSloan updates the package in FreeCAD's source, due to issue #4228. Obviously we don't want to manually update it every time there is a new version.

In pull request #2904 (#2953), Keith removes the package. So, after this is done, then all platforms Linux, Windows, Mac, should include Ply as a dependency on installation.

I guess this is already done for Debian/Ubuntu, because in this version I don't see the Ply directory inside the OpenSCAD subdirectory. I don't know how Windows or Mac handle this. Is Ply included in the conda packages?
Last edited by vocx on Fri Feb 14, 2020 6:32 pm, edited 1 time in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by looo »

vocx wrote: Thu Jan 16, 2020 5:09 am Is Ply included in the conda packages?
This one here?
https://anaconda.org/conda-forge/ply/files

We do not support openscad/openscad wb via conda-packages. So I don't see a reason to include a pure python package only to satisfy dependencies of a external installable tool (openscad).
So from my point it's fine to remove ply. Source copying is really not a good way of package-handling...
In the long run someone might come up with a PR to build openscad for conda-forge. This is the only way to improve the support of openscad for the appimage and the dmg. But the interest in this seems to be not very high, therefore better to avoid this work for now.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by vocx »

looo wrote: Thu Jan 16, 2020 5:38 am We do not support openscad/openscad wb via conda-packages. So I don't see a reason to include a pure python package only to satisfy dependencies of a external installable tool (openscad).
I don't understand what you mean here. OpenSCAD is obviously an external tool, but the OpenSCAD Workbench is part of FreeCAD, so its dependencies are also FreeCAD dependencies, just like Pivy is a dependency of FreeCAD through the Draft Workbench.

So, Ply is a dependency of FreeCAD and it should be installed when the user installs the FreeCAD stable or daily package in Debian/Ubuntu, and it should be in the *.7z for Windows, and in the AppImage.
...
In the long run someone might come up with a PR to build openscad for conda-forge. This is the only way to improve the support of openscad for the appimage and the dmg. But the interest in this seems to be not very high, therefore better to avoid this work for now.
Are you saying that you will not include Ply in the AppImage, nor Windows build?

I told Keith to remove the Ply package from FreeCAD's source because surely this can be included in the Windows and Mac packages, and AppImage. But if this is not the case, then Ply needs to remain in the FreeCAD source so that the OpenSCAD Workbench won't break.
Last edited by vocx on Thu Jan 16, 2020 7:59 am, edited 1 time in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by looo »

vocx wrote: Thu Jan 16, 2020 6:07 am So, Ply is a dependency of FreeCAD and it should be installed when the users installs the FreeCAD stable or daily package in Debian/Ubuntu, and it should be in the *.7z for Windows, and in the AppImage.
So you are saying that ply is a direct dependency of freecad? If this is the case you are right. On the other hand I guess ply is useless without an installed openscad?

But you are right, including the package for the appimage/dmg is not a big deal. I will do it for the next iteration.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by vocx »

looo wrote: Thu Jan 16, 2020 7:28 am So you are saying that ply is a direct dependency of freecad? If this is the case you are right. On the other hand I guess ply is useless without an installed openscad?
Ply is a dependency of OpenSCAD Workbench. If you consider OpenSCAD Workbench being FreeCAD, then yes, it's a direct dependency of FreeCAD.

If Ply is not installed, OpenSCAD Workbench will not work, whether OpenSCAD executable is installed or not. Although the rest of FreeCAD should work normally, as far as I know.
But you are right, including the package for the appimage/dmg is not a big deal. I will do it for the next iteration.
Okay, so this is what I think is best.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by looo »

vocx wrote: Thu Jan 16, 2020 7:56 am Ply is a dependency of OpenSCAD Workbench. If you consider OpenSCAD Workbench being FreeCAD, then yes, it's a direct dependency of FreeCAD.
I guess every dependency of an internal workbench is a direct dependency of freecad.

The dependency list is growing:
https://github.com/looooo/freecad-feeds ... 234e8f0ec2
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by vocx »

looo wrote: Thu Jan 16, 2020 9:16 am I guess every dependency of an internal workbench is a direct dependency of freecad.
...
That's my idea as well.

The dependency list isn't growing, it was already as big. It's just now more organized.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by sgrogan »

vocx wrote: Thu Jan 16, 2020 3:59 pm The dependency list isn't growing, it was already as big. It's just now more organized.
I little of both maybe. Anyway if we don't need to maintain 3rd party code in FreeCAD that is good.
As far as I can tell, ply is only used here: importCSG.py#L45 for .csg file support. I also see in the Mesh and Points WB's .ply files are supported, but it doesn't seem to depend on this library. I could of course be wrong.
It looks to me that it would only be a runtime dependency, although Kurt has it as a Build-Depends here: ppa/daily

I'll add the lib to the win dev builds and the libpack (that Travis uses) in case there are tests that check .csg file support. I will try to do this over the weekend.

I think we should make an announcement in the install/compile or packaging sub-forum for those packaging for non Debian/Ubuntu distros. Maybe I should also add this to the releases page for 0.19_pre? Not sure because it should be transparent there?
"fight the good fight"
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Discussion: removing Ply from FreeCAD's source code

Post by kkremitzki »

+1 to including something like "removed bundled copy of ply, aka python lex-yacc." in 0.19 changelog.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Discussion: removing Ply from FreeCAD's source code

Post by vocx »

sgrogan wrote: Thu Jan 16, 2020 10:22 pm ... I also see in the Mesh and Points WB's .ply files are supported, but it doesn't seem to depend on this library. I could of course be wrong.
It seems that Mesh (and maybe Points) utilizes the OpenSCAD indirectly, so Ply may be an indirect depedency.

https://github.com/FreeCAD/FreeCAD/blob ... py#L36-L45

Code: Select all

class OpenSCADWorkbench ( Workbench ):
    "OpenSCAD workbench object"
    def __init__(self):
        self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/OpenSCAD/Resources/icons/OpenSCADWorkbench.svg"
        self.__class__.MenuText = "OpenSCAD"
        self.__class__.ToolTip = (
            "OpenSCAD is an application for creating solid 3D CAD.\n"
            "FreeCAD utizes OpenSCAD's capability as a script-only based modeller that uses its own description language\n"
            "Note: the Mesh workbench heavily uses the boolean operations of this workbench because they are quite robust"
        )
...
I'll add the lib to the win dev builds and the libpack (that Travis uses) in case there are tests that check .csg file support. I will try to do this over the weekend.

I think we should make an announcement in the install/compile or packaging sub-forum for those packaging for non Debian/Ubuntu distros. Maybe I should also add this to the releases page for 0.19_pre? Not sure because it should be transparent there?
Sounds good to me. Thank you both.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply