# Can I browse Cython Docs within the notebook()?

http://pypi.python.org/pypi/bintrees/...

So I notice this webpage that says that Cython has Red-Black Trees (or someone has used Cython to implement them), and I think "Great! How can I get started using them?!"

Of course, I not knowing whether this package is included in sage (or if it is how to get to it); I type "sage: cython?", and I am now unsure where to look. Are the Cython docs included in Sage? What about other packages? Is it standardized within the notebook somehow? Of the included packages, do they have optionally included sub-packages? Tips? Thanks! When I say "included", I mean "bundled" in the distribution.

edit retag close merge delete

If they aren't available from Cython, I would be interested to learn more about similar data structures' availability, wherever they may live within Sage. Thx

( 2010-08-29 00:30:35 +0100 )edit

Sort by » oldest newest most voted

From that webpage, someone has just used Cython to implement them -- they don't come with Cython. You can install that package in the same way as most packages on PyPI:

2. Extract the tarball.

3. Run

sage -python setup.py install

4. You'll be able to run import bintrees from within your Sage sessions now.

As for using the package, you'll have to look at that package's specific documentation.

The Cython documentation is not built / included in Sage, but you can find it at http://docs.cython.org/. For other packages, it varies. For example, you can find the Pari documentation under $SAGE_ROOT/local/share/pari/doc/. None of this package specific documentation is specifically made available from within the notebook. When you type in cython? from the notebook, you're getting the documentation a specific function called cython within Sage -- this is different than the documentation for Cython itself. I'm not sure what you mean about "optional included sub-packages". more ## Comments Clarification, regarding "sub-packages": My question was, does sage allow included libs to be further configured? For example (whether standard or not), could an included library pull in more libs than Sage might normally? Thank you for your non-notebook solution. I'm a new user. ( 2010-08-29 01:05:33 +0100 )edit In a source distribution of Sage, you also get the source of all standard packages in Sage. Standard packages reside under SAGE_ROOT/spkg/standard. You should be able to uncompress each spkg using tar and bunzip2, then hunt around an uncompressed spkg for the documentation of that upstream package. For example, here is a way to read the documentation of Cython: [mvngu@sage mvngu]$ ls
dot_sage  sage-4.5.3.alpha2
[mvngu@sage mvngu]$cd sage-4.5.3.alpha2/spkg/standard/ [mvngu@sage standard]$ tar -jxf cython-0.12.1.spkg
[mvngu@sage standard]$cd cython-0.12.1/src/Doc/ [mvngu@sage Doc]$ ls
extension_types.html  index.html  primes.c       special_methods.html


Once uncompressed, you could also read the source of the upstream package.

more

I got: $tar -jxf cython-0.12.1.spkg bzip2: (stdin) is not a bzip2 file. tar: Child returned status 2 tar: Exiting with failure status due to previous errors ( 2010-08-29 00:51:27 +0100 )edit In your version of Sage, try to determine whether or not it is a source or binary distribution. What do you get if you do these?$ file cython-0.12.1.spkg $du -sh cython-0.12.1.spkg In a source distribution, the size of the cython spkg should be few kilobytes. ( 2010-08-29 00:55:08 +0100 )edit$ file cython-0.12.1.spkg
cython-0.12.1.spkg: ASCII text
$du --bytes cython-0.12.1.spkg 107 cython-0.12.1.spkg ( 2010-08-29 01:01:11 +0100 )edit$ cat cython-0.12.1.spkg
Placeholder spkg file so this binary version of Sage knows this package version used when installing Sage.

( 2010-08-29 01:02:21 +0100 )edit

You can find Cython under the site-packages/ directory of the version of Python that is shipped with Sage. For example:

[mvngu@sage sage-4.5.3.alpha2]\$ ls local/lib/python/site-packages/Cython
CodeWriter.pyc  Distutils      Plex          StringIOTree.py   TestUtils.pyc
Compiler        Includes       Runtime       StringIOTree.pyc  Utils.py

more

Tucked in the recesses of the Sage documentation are the commands search_src, search_def, and search_doc. They take a string as argument and return all the files containing that string (well, one searches docstrings, one searches definitions, and the other searches all source code; you can probably guess which is which). So in addition to the other answers here, these commands can give you an idea of _which_ file to look at.

more