[cctbxbb] cctbx.python unnecessarily unfriendly

James Stroud xtald00d at gmail.com
Wed Jan 8 16:00:20 PST 2014


On Jan 8, 2014, at 2:18 PM, Nathaniel Echols <nechols at lbl.gov> wrote:
> 1) The old behavior is, in our opinion, fundamentally broken (and Python 3 completely discards it).  (We didn't realize how many other packages were accidentally dependent on it until much later.)

You won’t get any argument from me here.


> 2) Many of the development choices involving CCTBX are made based on the requirements of Phenix.  Unfortunately, whereas Ralf was very militant about enforcing certain development rules for CCTBX code (as we continue to be), it has been nearly impossible to get the other Phenix developers to follow the same (or any!) rules.  ("Cat herding" doesn't even begin to describe it.)  Adding -Qnew was the easiest way to ensure that all of the code in Phenix had similar behavior with respect to division.

> I agree that this creates problems for third-party packages.  It would certainly be safer and more intuitive if we could avoid it altogether; I will discuss this with the other developers.  Since it is somewhat non-trivial at the moment to fix the rest of Phenix to have the desired behavior, and I'm trying to revise a paper among other things, I'm deferring this until some point when I have time and free brain cells (possibly until our next Phenix meeting in mid-March).  For now, I've modified libtbx/env_config.py so you can do this:
> 
> /usr/bin/python /path/to/libtbx/configure.py --old_division cctbx
> 
> which will give you cleaner dispatchers.  I'm pretty sure the rest of CCTBX should still behave sensibly, since we're pretty militant about including the __future__ statement in these files.  Is that sufficiently usable for the short term?

That works fine for a developer, but it doesn’t help much with users, who shouldn’t be expected to create a custom build of CCTBX.

Attached is a tar file (fixit.tar) of three python scripts that should solve this problem easily:

fix-division
============
For all .py files in the present directory, it will add the “from future” to any files that need it, recursively. The new line will go after any “#!” line or module level docstrings and before any other line. Variable whitespace is handled gracefully. This allows any document generators to recognize the module-level docstrings.

undo
====
If testing after fix-division fails, just run the undo. I predict that this script will be unnecessary.

cleanup
=======
Once testing after fix-division succeeds, run cleanup to get rid of the backup files.


James


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixit.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20140108/72bd9f53/attachment-0001.tar>


More information about the cctbxbb mailing list