Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Structuring and naming modules

I'm starting a new research project, and I'm confused about the best way to organize everything.

I'll need to write a few functions that compute invariants on Graphs, but the trick is that each function needs to call lots of smaller functions that compute bounds for the invariant, and then choose the min/max of these bounds and return it. I'd like the smaller functions to be "plug and play," so that other people on the project can come up with new bounds computers, drop them in the folder, and have them automatically used.

Currently, my file structure looks like this:

project/
    __init__.py
    project.py
    bounds/
        __init__.py
       boundcomputer1.py
       boundcomputer2.py
       ...

If I start a Sage session and attach project.py, the code seems to work correctly.

If I do sage -t project.py, it complains about not being able to find the bounds module.

Also, how do I get the functions in project.py to show up under a project namespace, so that I can type project.compute_invariant(), where compute_invariant() is a function defined inside project.py?

I'm happy to take any advice on best practice for a project like this.