Ah, I understand. You'd want to import FreeCAD from the global namespace in freecad/__init__.py. That would indeed work. Even though it's a bit unorthodox it would be a good migration strategy because then it's not necessary to move everything into the freecad namespace immediately but you can already start to make use of it.looo wrote:I don't think we have to do this. For the modules we have to prefix the shared objects anyway. So these can stay where they are. Maybe we will do this for FreeCAD - shared library aswell, but for the moment I would just stay with the current structure. My suggestion would look something like this:That's what I meant as well. The current FreeCAD module (.so file) would need to be moved into a package to make it work.
Code: Select all
└── lib └── freecad (in sys.path) └── bin └── FreeCAD └── FreeCADCmd └── lib (in sys.path, we still allow direct import of FreeCAD) └── FreeCAD.so └── FreeCADGui.so └── _PartDesign.so.so └── Mod └── OldModuleStillSupported └── ... └── freecad (this is the entry for namespace packages) └── __init__.py (import FreeCAD as App, import FreeCADGui as Gui) └── Arch └── Init.py └── InitGui.py └── __init__.py └── ... └── PartDesign └── __init__.py (from _PartDesign import *) └── ... └── ...
Yeah, you'd need a modules sub-package, so you know where to find your modules. Otherwise you'd have to do something ugly like keep a list of sub-packages that aren't modules and exclude them when initializing the moduleslooo wrote:Do we really need to import from freecad.modules?
As I had not too much time to experiment with namespace-packages: would it be possible to use them with this structure?