Open gbroques opened 11 months ago
Hi! This is the friendly automated conda-forge-linting service.
I just wanted to let you know that I linted all conda-recipes in your PR (recipe
) and found it was in an excellent condition.
have you tried using import freecad
in a conda env. This normally does the Path modifications.
have you tried using
import freecad
in a conda env. This normally does the Path modifications.
That works too, but requires every script to import freecad
before import FreeCAD
, import FreeCADGui
, etc.
I don't think that's ideal as this solution which doesn't require any special modifications to scripts like import freecad
or modifying sys.path
.
My idea was to switch over to things like from freecad import App
instead of import FreeCAD as App
. This change would resolve name-clashes (which can occur when you use freecad with other python modules) But this is a big change and maybe should happen after a FreeCAD 1.0 release (forcing this new way of importing freecad libraries).
My idea was to switch over to things like
from freecad import App
instead ofimport FreeCAD as App
. This change would resolve name-clashes (which can occur when you use freecad with other python modules) But this is a big change and maybe should happen after a FreeCAD 1.0 release (forcing this new way of importing freecad libraries).
I think that would cause confusion for developers since freecad
isn't available unless you use the conda environment.
Unless, you're talking about making freecad
available for all of FreeCAD regardless of the user's installation method?
I think Python packages and modules that depend on FreeCAD should run without modification in all environments regardless of installation method.
Normally it should work also with other installations (not only conda)
Maybe its good to set this to on as default.
Maybe its good to set this to on as default.
Interesting. Yes, maybe that's a sensible default.
I didn't realize this could be an option for everyone, regardless of whether they use conda.
I think it's a good idea to enable that as a default, and socialize the following imports:
from freecad import app as App
from freecad import gui as Gui
Then people wouldn't have any problems with Python not being able to find the freecad
module.
As an aside, with FreeCAD
, you can do the following imports:
from FreeCAD import Console, Placement, Vector # ✔️ works
It would be nice if we could also import these directly from freecad.app
like:
from freecad.app import Console, Placement, Vector # ❌ doesn't work currently
To work around that, we'd have to:
from freecad import app
Console = app.Console
# Placement = ...
hmm I guess it would be best to find a consensus about the future of freecad imports. Because in the end all python relevant modules should be installed into site-packages/freecad
(imho).
Actually I just refactored a workbench and I used from freecad import gui
, and this works, but I have no idea how. If you try this in a python console vs freecad python console you get different results:
from freecad import gui
FreeCADGui == gui
Motivation: Allows for executing python scripts which import FreeCAD modules when the conda environment containing
freecad
is activated.LIMITATIONS: Windows is not supported, but could be added easily if someone can test it.
See the following FreeCAD forum discussion for context: https://forum.freecad.org/viewtopic.php?p=493282#p493277
@looooo said this was a good idea and would try to integrate it a few years ago, but never did: https://forum.freecad.org/viewtopic.php?p=493282#p493688
The script should support all major shells: bash, zsh, and fish.
If someone could verify this works before merging, then that would be appreiciated!