Ask Your Question
0

How to test package locally?

asked 2010-08-23 12:31:13 +0200

TeamTeamUSA gravatar image

updated 2011-04-28 19:14:20 +0200

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?

Thanks,

=ml=

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2010-08-23 14:38:48 +0200

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

Comments

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 http://www.sagemath.org/doc/developer/producing_spkgs.html.

TeamTeamUSA gravatar imageTeamTeamUSA ( 2010-08-23 15:28:36 +0200 )edit

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

TeamTeamUSA gravatar imageTeamTeamUSA ( 2010-08-24 19:50:25 +0200 )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

Stats

Asked: 2010-08-23 12:31:13 +0200

Seen: 326 times

Last updated: Aug 23 '10