pymad/pymad — pull request #19 by coldfix (2013-10-09 05:31:47+00:00)
Title: Extensible model loading using a more modular resource mechanism 

Hey,

I felt the need to have PyMad load models from more general sources, such as a custom python package. This is why I modified, once again, the model loading mechanism. This time the modification goes much deeper but also designed a lot better.
The new model loading works as follows:

- resources (files) are loaded via ResourceProvider objects. I have implemented ResourceProviders for couchdb, python package and normal filesystem resources.
- models are located using a ModelLocator object, that can lookup models accessible via a ResourceProvider. This mechanism might be merged with the existing cpymad.service module, but I am not fully sure about this. For now I have modified cpymad.service to use the ModelLocator.

Before this is ready to merge, there are still some open issues:

The couchdb code probably doesn't work yet, as I have no models in a couchdb to test with. On the other hand, from what I saw in the existing code, the couchdb wasn't functional before my modifications either. However, with the new resource mechanism, it should be easier to get it to work.

On my machine, except for test_lhc-b4 and test_survey all of the existing tests in the test/cpymadtest folder are failing with serious runtime errors (such as memory faults) within the Mad-X library. This was already the case on your last master version. One reason might be, that I have no AFS installed at the moment. I haven't checked if there is any version the tests succeed on my machine. Nevertheless, this means, that I cannot verify that the changes in this pull request do not break anything.

Do these tests also fail on your setup? If so, this might be an important issue to fix. If not, I could send you error traces, as I have currently no clue why these errors emerge.

By the way, I have also started a python3 compatibility branch, for which it might be especially important to have the tests fixed before merging (as python3 features incompatible behaviour regarding unicode and binary IO).

If something is unclear, I will be glad to explain it in further detail. In the course of the week, I will also modify some docstrings to be more sphinx-friendly.

Sincerely,

Thomas