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.Tue, 24 Aug 2010 19:50:25 +0200How to test package locally?https://ask.sagemath.org/question/7615/how-to-test-package-locally/Aside from building a package using the developer.pdf instructions and then installing it using the package commands, is there a more direct way to use a custom package locally?
Re-phrased, where do the *.py files in the spkg's src directory end up after being installed, and how can I import them without building a spkg?
Thanks,
=ml=Mon, 23 Aug 2010 12:31:13 +0200https://ask.sagemath.org/question/7615/how-to-test-package-locally/Answer by Mike Hansen for <p>Aside from building a package using the developer.pdf instructions and then installing it using the package commands, is there a more direct way to use a custom package locally?
Re-phrased, where do the *.py files in the spkg's src directory end up after being installed, and how can I import them without building a spkg?</p>
<p>Thanks,</p>
<p>=ml=</p>
https://ask.sagemath.org/question/7615/how-to-test-package-locally/?answer=11520#post-id-11520For SPKGs like `networkx-1.0.1.spkg`, which installs a bunch of Python modules, the end up being stored in either `$SAGE_ROOT/local/lib/python` or `$SAGE_ROOT/local/lib/python/site-packages`. This is the "normal" place for Python modules to live, and it is one of the places that Python looks for modules when you try to import them. ( Do `import sys; print sys.path` to see all of the places where Python looks. ) If you change these files, then the changes will be active the next time you load the module. If you've already loaded it and don't want to restart Sage, then you have to use the `reload` command -- see `reload?`.
For modifying .py files in the Sage library, you should edit the files in `$SAGE_ROOT/devel/sage/`. This is covered in the section [Modifying Sage Source Code][1] in the [Sage Developer's Guide][2].
If you have a particular package in mind, then I could give you a more specific answer.
[1]: http://www.sagemath.org/doc/developer/walk_through.html#modifying-sage-source-code
[2]: http://www.sagemath.org/doc/developer/index.htmlMon, 23 Aug 2010 14:38:48 +0200https://ask.sagemath.org/question/7615/how-to-test-package-locally/?answer=11520#post-id-11520Comment by TeamTeamUSA for <p>For SPKGs like <code>networkx-1.0.1.spkg</code>, which installs a bunch of Python modules, the end up being stored in either <code>$SAGE_ROOT/local/lib/python</code> or <code>$SAGE_ROOT/local/lib/python/site-packages</code>. This is the "normal" place for Python modules to live, and it is one of the places that Python looks for modules when you try to import them. ( Do <code>import sys; print sys.path</code> to see all of the places where Python looks. ) If you change these files, then the changes will be active the next time you load the module. If you've already loaded it and don't want to restart Sage, then you have to use the <code>reload</code> command -- see <code>reload?</code>.</p>
<p>For modifying .py files in the Sage library, you should edit the files in <code>$SAGE_ROOT/devel/sage/</code>. This is covered in the section <a href="http://www.sagemath.org/doc/developer/walk_through.html#modifying-sage-source-code">Modifying Sage Source Code</a> in the <a href="http://www.sagemath.org/doc/developer/index.html">Sage Developer's Guide</a>.</p>
<p>If you have a particular package in mind, then I could give you a more specific answer.</p>
https://ask.sagemath.org/question/7615/how-to-test-package-locally/?comment=22894#post-id-22894Placing the files in <code>$SAGE_ROOT/local/lib/python/site-packages</code> worked great!
Thanks!Tue, 24 Aug 2010 19:50:25 +0200https://ask.sagemath.org/question/7615/how-to-test-package-locally/?comment=22894#post-id-22894Comment by TeamTeamUSA for <p>For SPKGs like <code>networkx-1.0.1.spkg</code>, which installs a bunch of Python modules, the end up being stored in either <code>$SAGE_ROOT/local/lib/python</code> or <code>$SAGE_ROOT/local/lib/python/site-packages</code>. This is the "normal" place for Python modules to live, and it is one of the places that Python looks for modules when you try to import them. ( Do <code>import sys; print sys.path</code> to see all of the places where Python looks. ) If you change these files, then the changes will be active the next time you load the module. If you've already loaded it and don't want to restart Sage, then you have to use the <code>reload</code> command -- see <code>reload?</code>.</p>
<p>For modifying .py files in the Sage library, you should edit the files in <code>$SAGE_ROOT/devel/sage/</code>. This is covered in the section <a href="http://www.sagemath.org/doc/developer/walk_through.html#modifying-sage-source-code">Modifying Sage Source Code</a> in the <a href="http://www.sagemath.org/doc/developer/index.html">Sage Developer's Guide</a>.</p>
<p>If you have a particular package in mind, then I could give you a more specific answer.</p>
https://ask.sagemath.org/question/7615/how-to-test-package-locally/?comment=22923#post-id-22923Thanks, I'll try this.
I asked about this because I'm developing a package and wanted to know if there was a way to test it without creating the spkg file. A entry explaining how to test a package in development might be a nice addition to http://www.sagemath.org/doc/developer/producing_spkgs.html.Mon, 23 Aug 2010 15:28:36 +0200https://ask.sagemath.org/question/7615/how-to-test-package-locally/?comment=22923#post-id-22923