Hey Robin,
I believe I have got it working, you can check the main hyperlinks at
the bottom of this page:
http://xoomer.virgilio.it/infinity77/Phoenix/main.html
And maybe navigate through the "adv" sub-package from there.
Thanks Andrea, it's looking good. Is there a file or something I need to edit when I add new modules to the list to let the tools know they need to apply the same treatment for the new module? Or is it more involved than that?
One thing I believe we still haven't fully considered is what we are
going to do with wx.lib and its children... are we going to maintain a
single version and making it Python 2 and Python 3 compatible or are
we going to split it in two separate versions? Anyone care to share
some thoughts on this issue?
Actually I had started working on an email to ask for experiences or opinions about this myself. Here are the issues as I seem them, and some related ones too.
* First of all, this is probably obvious but just to be complete for this wx.lib discussion: I am not planning on trying to share wx.lib code for Classic and Phoenix. The API changes and such already mentioned will make this more effort than it is worth. Instead I'll do a svn copy (so the revision history is preserved) from the classic tree to the Phoenix source tree.
* Even if we stick with a minimum 2.x version of 2.7 (where the most compatibility aids have been added) there are still some things that can not be done when sharing the code because they will be syntax errors in one or the other flavor of Python. Since syntax is verified before the code in a module even starts executing then a syntax error will derail the import before we even have a chance to do anything about it. For example, using the u prefix on string constants (such as u"some text") is a syntax error in Python 3.2. So trying to keep both the python2- and the python3-compatible code in the same file will be tricky because in cases like that just doing conditionals is not enough.
* Duplicating and maintaining 2 sets of all the lib modules will be a major hassle too. It will take twice the work to fix a bug or add an enhancement, and there is the risk that if updating the copy is not done for some issue that the functionality could start to diverge.
FWIW, in my experience, this would be the most problematic of all approaches. Without doubt, one copy of the codebase will gain primacy, while the other will be at best ignored, and at worst, sometimes changes won't be ported over mistakenly. As a practical matter, this will steer users to the better-maintained codebase, which will in turn hinder adoption of the new thing, and that cycle will likely continue until we do something like cut the cord on the Python 2 code.
So what other options are there? Here are a couple I have thought of:
* Maintain the modules for Python2 but write the code such that the 2to3 tool (plus perhaps some extra scripts of our own) will produce code for Python3 without needing any help from a human, and then automatically run those tools as needed to produce the Python3 version of the code. This has some advantages in that there will still be only one master copy of the code that needs to be maintained, but some disadvantages as well in that the conversion tools need to be rock-solid and be trusted to not produce bugs of their own in the code they produce.
* My other idea is sort of a hybrid approach where those modules that can be implemented for both Python2 and Python3 without many hassles and/or many conditionals checking the Python version are implemented as a single module. Other modules will have 2 implementations, each with the Python version embedded in the file name somehow, for example foomodule-py2.py and foomodule-py3.py. Then an import hook can be written and used that will watch for imports inside the wx package and will check first for the file name with verisoning in the name and will load that one if it is present, and will fall back to the normally named module if not. There may be some cases where a bit of refactoring will allow us to keep most of the code in a single non-versioned file and just move a few things out to a helper module that has -py2 and -py3 versions. For example foomodule.py, _foo_helper-py2.py and _foo_helper-py3.py
Has anybody seen approaches like these or something else being used by other projects?
No, but I do have another idea. Use git and store the Python 3 changes on a git branch. So your Py 2 code is in your master branch, then you create a branch to hold all the Py 3 specific changes and switch to that when producing your Python 3 build.
This would allow you to keep one version of the code, and once the changes are done, if you do find that most of the changes are Py 2 compatible and that it would not be much work to make the code compatible with both Pythons, you have the option of merging the code into the master branch. That way, you can leave the final decision on what to do about splitting wx.lib to the moment when you have all the data you need to make the decision about what is best.
Having stored changes to wxWebKit that were 100K+ for months, and having almost all the merge conflicts being real ones that needed dealt with, I can say that it works pretty well, even over the long haul.
While on the subject I've been thinking that I would discontinue the use of the 3rdParty folder in SVN for a couple reasons:
* There is probably going to need to be a new location for them anyway because of the Classic --> Phoenix differences.
* The svn:externals properties are basically ignored when using some other tool like git or mercurial as a front-end for subversion, and that makes it a major hassle keeping the external items in the proper place in the source tree and also keeping them up to date and making commits for them.
I think I've mentioned this before but I'm also planning on not including the Editra and XRCed packages in the wx.tools package any longer, as the original idea of making them (and others) into reusable components never came to pass. They're better as standalone applications so I think it is best to organize the code that way. I expect that I'll still include a launcher for at least XRCed in the distribution installers though. (Editra already has a good website and installer distribution.)
I do think tying specific versions of Editra to specific wxPython releases doesn't work well, though. I think it should have its own releases and just be easily retrievable when doing wxPython downloads. i.e. there should be a wxPython-tools package or wxPython-IDE.
If we can do eggs or something, is it possible to have wxpython-runtime, wxpython-docs, wxpython-demo, wxpython-tools, and most importantly, wxpython-all?
Thanks,
Kevin
···
On May 29, 2012, at 5:03 PM, Robin Dunn wrote:
On 5/29/12 1:21 PM, Andrea Gavana wrote:
From my perspective, the whole idea of bundling Editra and XRCed was to give users some good out-of-the-box tools they can use to develop wxPython apps. The wxPython Demo does a lot to help users get started (the ones who download the package, anyway…), but new wxPython developers are always faced with a simple question of "what should I use to develop my app?" If they go to the mailing list for help, they then typically get at least 10 suggestions, of just about everything from Notepad to emacs. And I think from a getting started perspective, if Step 1 is "spend a couple days looking at a bunch of editors", whereas with another tool, it's "download the IDE and start hacking", I think a lot of people will be drawn to that other tool. Plus, I think it's a good advertisement that wxPython uses wxPython apps to develop wxPython apps.
If you have any thoughts, objections, or better ideas for any of the above please speak up and let us know.
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
To unsubscribe, send email to wxPython-dev+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-dev?hl=en