First time here? Check out the FAQ!

Ask Your Question
0

How to test package locally?

asked 14 years ago

TeamTeamUSA gravatar image

updated 14 years ago

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=

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 14 years ago

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.

Preview: (hide)
link

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 ( 14 years ago )

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

TeamTeamUSA gravatar imageTeamTeamUSA ( 14 years ago )

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: 14 years ago

Seen: 469 times

Last updated: Aug 23 '10