sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.48k stars 488 forks source link

Update Cython entry in Developer's Guide #5470

Closed 3421e925-4b79-48cc-ba65-9123d4ab1b38 closed 15 years ago

3421e925-4b79-48cc-ba65-9123d4ab1b38 commented 15 years ago

The current description for adding a new Cython module is outdated:

http://www.sagemath.org/doc/prog/node29.html

3. Create a .pyx file in the Sage library and add a listing for it to the variable
ext_modules in the file SAGE_ROOT/devel/sage/setup.py. For example, the file 
SAGE_ROOT/devel/sage/sage/graphs/chrompoly.pyx has lines

    Extension('sage.graphs.chrompoly',
              ['sage/graphs/chrompoly.pyx']
              ), \

in setup.py. Also, the module - in this example sage.graphs.chrompoly - needs to be 
added to the packages list in setup.py . Then type sage -b to build Sage with the new 
code.

Here is a fix. However, it looks like SAGE_ROOT/devel/sage/doc/en/developer/coding_in_other.rst isn't under any version control. Therefore, I'll just post a replacement docstring here. Hopefully, someone can help me include it in the appropriate file.

#. Create a .pyx file and add it to the Sage library.

   #. First, add a listing for the Cython extension to the variable
      ``ext_modules`` in the file
      ``SAGE_ROOT/devel/sage/module_list.py``. See the
      ``distutils.extension.Extension`` class for more information on creating
      a new Cython extension.

   #. Then, add the module name to the ``packages`` list in the file
      ``SAGE_ROOT/devel/sage/setup.py``.

   #. Run ``sage -b`` to rebuild Sage with the new code.

   For example, the file ``SAGE_ROOT/devel/sage/sage/graphs/chrompoly.pyx``
   has the lines

::

    Extension('sage.graphs.chompoly',
              sources = ['sage/graphs/chrompoly.pyx']),

   in ``module_list.py``. In addition, ``sage.graphs`` is included in the
   packages list under the Distutils section of ``setup.py``.

CC: @cswiercz

Component: documentation

Issue created by migration from https://trac.sagemath.org/ticket/5470

3421e925-4b79-48cc-ba65-9123d4ab1b38 commented 15 years ago

Description changed:

--- 
+++ 
@@ -16,4 +16,32 @@
 code.

-This documentation needs to account for the separate module_list.py file. +Here is a fix. However, it looks like SAGE_ROOT/devel/sage/doc/en/developer/coding_in_other.rst isn't under any version control. Therefore, I'll just post a replacement docstring here. Hopefully, someone can help me include it in the appropriate file. + +``` +#. Create a .pyx file and add it to the Sage library. + +

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 15 years ago
comment:2

Yes, it is under version control:

mabshoff@sage:/scratch/mabshoff/sage-3.4.rc2/devel/sage$ hg log doc/en/developer/coding_in_other.rst
changeset:   11689:d83194742483
user:        Mike Hansen <mhansen@gmail.com>
date:        Tue Feb 24 09:13:12 2009 -0800
summary:     Added the documentation to the main repository.

Cheers,

Michael

3421e925-4b79-48cc-ba65-9123d4ab1b38 commented 15 years ago

Attachment: sage-5470.patch.gz

3421e925-4b79-48cc-ba65-9123d4ab1b38 commented 15 years ago
comment:3

D'oh! I must have been looking at another screen or something.

The patch is attached an is ready for review.

robertwb commented 15 years ago
comment:4

Mostly looks good. The only complaint I have is about step (2)

   #. Then, add the module name to the ``packages`` list in the file
      ``SAGE_ROOT/devel/sage/setup.py``.

one only does this if one is making an new package (directory).

3421e925-4b79-48cc-ba65-9123d4ab1b38 commented 15 years ago
comment:5

Attachment: sage-5470-part2.patch.gz

Apply in the following order:

sage-5470.patch

sage-5470-part2.patch

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 15 years ago
comment:7

Merged both patches in Sage 3.4.1.rc0.

Cheers,

Michael

fchapoton commented 9 years ago

Description changed:

--- 
+++ 
@@ -43,5 +43,5 @@
               sources = ['sage/graphs/chrompoly.pyx']),

    in ``module_list.py``. In addition, ``sage.graphs`` is included in the
-   packages list under the Distutils section of    ``setup.py``.
+   packages list under the Distutils section of ``setup.py``.