ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 08 Aug 2012 17:17:21 +0200Structuring and naming moduleshttps://ask.sagemath.org/question/9219/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:
<pre>
project/
__init__.py
project.py
bounds/
__init__.py
boundcomputer1.py
boundcomputer2.py
...
</pre>
If I start a Sage session and <code>attach project.py</code>, the code seems to work correctly.
If I do <code>sage -t project.py</code>, it complains about not being able to find the <code>bounds</code> module.
Also, how do I get the functions in <code>project.py</code> to show up under a <code>project</code> namespace, so that I can type <code>project.compute_invariant()</code>, where <code>compute_invariant()</code> is a function defined inside <code>project.py</code>?
I'm happy to take any advice on best practice for a project like this.Wed, 08 Aug 2012 17:17:21 +0200https://ask.sagemath.org/question/9219/structuring-and-naming-modules/