I’ve got mgear_dist cloned now, but do you need to build every time you make a change?
What is your development environment?
I’ve got mgear_dist cloned now, but do you need to build every time you make a change?
What is your development environment?
We are using Scons with Excons extension: https://github.com/gatgui/excons
The info is here: https://github.com/mgear-dev/mgear_dist/blob/master/BUILD.md
it is really easy
Sorry, I may not have been very clear.
I was wondering what your development workflow is? Do you for example make some changes to the python code and rebuild?
I appreciate that you would have to rebuild when working on the plugins, but if most of the time its just python code you wouldn’t need to rebuild.
Scons with Excons extension, not only rebuild the compiled C++ plugins, but also copy/deploy the .py files in the final distribution structure.
every time a change is made in a python file/files you deploy on a temporal “release folder”. but only modify files are copied.
Also, Excons have different targets, I.e: only python files or C++ or all. So the deploy can be very granular
Check the documentation, when you know the basics. it is really easy and flexible to use
Also, don’t forget to check the sConstruct configuration file
Probably this file is the most useful to learn how it works
So when you are developing, is this the workflow?
more like this:
I’m currently exploring a development environment for mGear, and was wondering about the mgear
python module in each repository like https://github.com/mgear-dev/shifter/tree/master/scripts/mgear.
Why are the repositories in a submodule called mgear
?
to keep the folder structure consistent. This helps in some situation for debugging since everything is split in several repositories
if you check the init.py will see this
# imports
from pkgutil import extend_path
# extend mGear python package by adding the current module
__path__ = extend_path(__path__, __name__)
in the future with python 3.x this will be not needed
Ahh, ok.
I was wondering why is Qt.py
downloaded on build, and not just copied into https://github.com/mgear-dev/mgear_dist/tree/master/framework/scripts/mgear/vendor?
Looks like it’ll just download the latest Qt.py
, which could potentially break the build.
If I setup an environment where I point PYTHONPATH
to the different repositories like https://github.com/mgear-dev/animbits/tree/master/scripts and https://github.com/mgear-dev/crank/tree/master/scripts, then Python will only pick up the first module found.
Hello @Toke_Stuart_Jepsen
Let me intervene on giving some fast clarifications. We have setup mgear python/repositories in order to have everything as separated as possible in order to have a more flexible development env but at the same time everything gets under the same python module on the releasing system.
You can actually append to your python path each individual script folder for each repository and this will work all together because we are using python pkgutil extend_path which makes all matching modules to exist under the same namespace.
What can you do with this? You can either create a dev env in which you are always pointing Maya’s Python path to the released version generated by scons. Or you can actually add into your python path each part of the actually framework repos script folder. On the second option you will need to setup the plugings path yourself as on the first option mGear gets released as a Maya Module but nothing prevents you to manually setup Maya’s python path, plugin path, script path on your own env of maya executable.
Hope this helps a little bit
Ok, I think I’ve found where my issue was.
I have been using https://github.com/mgear-dev as a starting point for its https://github.com/mgear-dev/mgear_dist/blob/master/framework/scripts/userSetup.py (which isn’t anywhere else than there?), so its easier to manage contribution back to the community.
You can have https://github.com/mgear-dev/mgear_dist/blob/master/framework/scripts as a starting path in PYTHONPATH
followed by the rest of the repositories’ scripts
directories, or the https://github.com/mgear-dev/mgear_dist/blob/master/framework/scripts at the end of PYTHONPATH
.
Start of PYTHONPATH
This results in this error:
// Error: ImportError: file C:\Users\admin\Desktop\mgear-environment\bin\mgear_dist\framework\scripts\userSetup.py line 15: No module named shifter.menu //
Because the mgear module in mgear_dist (https://github.com/mgear-dev/mgear_dist/tree/master/framework/scripts/mgear), gets discovered first and no other mgear module is imported. Can see this when looking at:
print mgear.__path__
['C:\\Users\\admin\\Desktop\\mgear-environment\\bin\\mgear_dist\\framework\\scripts\\mgear']
Solution is to add pkgutil expand_path to this module (https://github.com/mgear-dev/mgear_dist/blob/master/framework/scripts/mgear/init.py). This seems to solve the issue throughout.
Ending of PYTHONPATH
This results in this error:
// Error: AttributeError: file C:\Users\admin\Desktop\mgear-environment\bin\mgear_dist\framework\scripts\userSetup.py line 12: 'module' object has no attribute 'install' //
Seems like the method/attributes in https://github.com/mgear-dev/mgear_dist/blob/master/framework/scripts/mgear/init.py does not get evaluated.
I don’t know what the solution is to this.
@Toke_Stuart_Jepsen can you please share with me your full mgear PYTHONPATH env variable so that I can try to reproduce this?
Thanks
set PYTHONPATH=C:\Users\admin\Desktop\mgear-environment\bin\mgear_dist\framework\scripts;C:\Users\admin\Desktop\mgear-environment\bin\animbits\scripts;C:\Users\admin\Desktop\mgear-environment\bin\crank\scripts;C:\Users\admin\Desktop\mgear-environment\bin\flex\scripts;C:\Users\admin\Desktop\mgear-environment\bin\mgear_core\scripts;C:\Users\admin\Desktop\mgear-environment\bin\rigbits\scripts;C:\Users\admin\Desktop\mgear-environment\bin\shifter\scripts;C:\Users\admin\Desktop\mgear-environment\bin\shifter_classic_components\scripts;C:\Users\admin\Desktop\mgear-environment\bin\simpleRig\scripts;C:\Users\admin\Desktop\mgear-environment\bin\synoptic\scripts
What is the workflow for making PRs?
Do we merge back to the develop
branches or master
?
Good question. Right now Master is good. Since we are evaluating/thinking a better workflow with Develop branch.
I had a lot of merge conflicts in the last release with all the difference repos
If you have experience with this, any advice is welcome
Could you elaborate on this?
Was it when you updated the submodules in mgear_dist?
I was not doing the things right . It was my fault
So I was wondering if there is a better way to manage the structure/repos/branchs
I’ve mostly only had experience with multiple repos from the Pyblish and Avalon project, but we haven’t really got a good way of distributing the whole framework.
We do have a release on each repository with every merge so people can be sure they are using the same version without needing to know the git commit hash.
We have done some experiments with Docker; https://github.com/getavalon/docker, https://github.com/getavalon/docker/pull/53
Dunno if this is any helpful.
Hey Miguel
Circling in from 2023 regarding excons. I am not a Python developer so all of this is new to me. I can do google search about python but that is about it. I do want to get the latest changes by building from source rather than wait for an official release though. So Python installed, along with pip and scons. However excons is not. There is no indication on how to install it either from the official repo or in google.
If I try pip install excons I get
ERROR: Could not find a version that satisfies the requirement excons (from versions: none) ERROR: No matching distribution found for excons
So any help with installing excons on windows?