Ask Your Question

How to test package locally?

asked 2010-08-23 05:31:13 -0500

TeamTeamUSA gravatar image

updated 2011-04-28 12:14:20 -0500

Kelvin Li gravatar image

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?



edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2010-08-23 07:38:48 -0500

Mike Hansen gravatar image

For 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 in the Sage Developer's Guide.

If you have a particular package in mind, then I could give you a more specific answer.

edit flag offensive delete link more


Thanks, 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

TeamTeamUSA gravatar imageTeamTeamUSA ( 2010-08-23 08:28:36 -0500 )edit

Placing the files in $SAGE_ROOT/local/lib/python/site-packages worked great! Thanks!

TeamTeamUSA gravatar imageTeamTeamUSA ( 2010-08-24 12:50:25 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2010-08-23 05:31:13 -0500

Seen: 147 times

Last updated: Aug 23 '10