That's the way FreeCAD currently already works, right? Nothing needs to be changed for this?looo wrote:@simonvanderveldt
It would be nice to have your suggested way to handle imports in the master. But I think there are two things that shouldn't be changed:
- import FreeCAD -> should import the shared library (we can work around by adding a dir called FreeCAD and there place a "from _FreeCAD import *")
This has a couple of issues. First of all, it actually is normal python convention to use lowercase for package and module names, see https://www.python.org/dev/peps/pep-000 ... dule-names.- use FreeCAD instead of freecad for namespace packages. I think this has historic reasons. Also there is no suggestion from python to use lower case. PySide and PyQt also use upper case...
Now whilst PEP-8 also states
note that it can be pretty annoying when you're proficient in a language and it's idioms and want to help/pickup a project and everything is non-standard.PEP-8 wrote:New modules and packages (including third party frameworks) should be written to these standards, but where an existing library has a different style, internal consistency is preferred.
But, more importantly, since FreeCAD is already a Python module this isn't possible. There can't be both a Python module and a Python package with the same name. So either the current FreeCAD Python module needs to be moved to a package like freecad.FreeCAD (or preferably freecad.freecad) or the FreeCAD module can stay as it is for now and a new package freecad.modules can be created to contain the new modules.
Moving the modules to a new package will also give a nice and clean separation between old modules and new ones.
I'll work on extending the PoC I had into something that actually works. I've started with the Arch workbench, had to pick one
Is that OK?