Re: [sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-15 Thread Nathann Cohen
Hello, > Why would you need that? If you have >sage: foo() # optional: bar >1 >sage: foo() # optional: no bar >2 > then "sage -t --optional=bar" would expect the output 1, and when you > run "sage -t" then it would expect the output 2. I only wanted to say that the interface of

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-15 Thread Simon King
Hi Nathann, On 2015-09-14, Nathann Cohen wrote: > No. You have to understand that the optional doctests are > "declarative". You can run "sage -t --optional=a_package" even if you > don't have "a_package" installed. Similarly, you are not forced to > mention all packages that are installed. > > F

Re: [sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Nathann Cohen
> Is it possible to make execution of a test depend on the *absence* of a > condition? Such as > > sage: MatrixSpace(GF(25,'x'),3).random_element() # optional: meataxe > > sage: MatrixSpace(GF(25,'x'),3).random_element() # optional: not meataxe > No. You have to understand that the opt

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Simon King
Hi Jeroen, On 2015-09-14, Jeroen Demeyer wrote: > On 2015-09-14 10:27, Simon King wrote: >> Thus, MatrixSpace(GF(25,'x'),3)(1) has a different output type > With "output type", do you literally mean > > sage: type(MatrixSpace(GF(25,'x'),3)(1)) > > or do you mean something else? The fact that the

Re: [sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Jeroen Demeyer
On 2015-09-14 10:27, Simon King wrote: Thus, MatrixSpace(GF(25,'x'),3)(1) has a different output type With "output type", do you literally mean sage: type(MatrixSpace(GF(25,'x'),3)(1)) or do you mean something else? The fact that the type() is different should not affect doctests that much.

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Volker Braun
On Monday, September 14, 2015 at 10:57:25 AM UTC+2, Simon King wrote: > > BTW, can one tell the doctester that all of a module's doctests are > "# optional: meataxe", or is it needed to do this separately for each > individual test? > For each test (otherwise it wouldn't be documented properly)

Re: [sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Nathann Cohen
> BTW, can one tell the doctester that all of a module's doctests are > "# optional: meataxe", or is it needed to do this separately for each > individual test? Never met any. And as I went over that part of the developer's manual, I do not think that it appears in there. Nathann -- You receive

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Simon King
Hi Nathann, On 2015-09-14, Nathann Cohen wrote: > Hmmm.. We have the same problem for LP solvers, and no good solution. We > have a way to 'force' the choice of the implementation manually Yes, that could work. In all doctests in sage.matrix.matrix_space where the optional implementation could

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Nathann Cohen
> > That gives rise to the next question: How can I modify the doctests such > that they pass regardless whether the optional package is installed or > not? I.e., can I make the expected result depend on an optional package? > Hmmm.. We have the same problem for LP solvers, and no good solutio

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-14 Thread Simon King
Hi! On 2015-09-12, Jeroen Demeyer wrote: > On 2015-09-12 23:36, Volker Braun wrote: >> See the usage of OptionalExtension in src/module_list.py I now have a module sage.matrix.matrix_modpn_dense that is available if the optional package "meataxe" is installed. I modified sage.matrix.matrix_space

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-12 Thread Simon King
Hi Volker, hi Jeroen, On 2015-09-12, Jeroen Demeyer wrote: > On 2015-09-12 23:36, Volker Braun wrote: >> See the usage of OptionalExtension in src/module_list.py > > To add to this answer: an OptionalExtension is *always* Cythonized, i.e. > Cython is run to generate a .c file. However, it is onl

Re: [sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-12 Thread Jeroen Demeyer
On 2015-09-12 23:36, Volker Braun wrote: See the usage of OptionalExtension in src/module_list.py To add to this answer: an OptionalExtension is *always* Cythonized, i.e. Cython is run to generate a .c file. However, it is only compiled if a condition is satisfied, which is usually a package

[sage-devel] Re: How to create a Cython wrapper for an optional C-library?

2015-09-12 Thread Volker Braun
See the usage of OptionalExtension in src/module_list.py On Saturday, September 12, 2015 at 9:48:34 PM UTC+2, Simon King wrote: > > Is it possible to have Cython files in src/sage/... that are only > compiled if a certain optional package is installed? That's not the same > as a dependency: A de