Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-14 Thread Jeroen Demeyer

On 2016-02-01 10:40, 'Martin R. Albrecht' via sage-devel wrote:

In particular, I am *very* interested in turning Sage’s interrupt
handling into something that can be easily installed from PyPI.


This is now ready. The upstream package is hosted at 
https://github.com/sagemath/cysignals and the Sage ticket is 
http://trac.sagemath.org/ticket/20002


After the work which has been done, it would be very nice if somebody 
could review the Sage ticket #20002. Note that a review would mostly 
consist of checking the build and packaging. The "interrupt" part was 
just moved from Sage to an external package, so that doesn't need to be 
reviewed.


Jeroen.

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Volker Braun
The system-specific part could be a separate C library "libinterrupt" that 
the python package depends on. That is how many other Python packages 
depend on system-specific libraries...



On Tuesday, February 2, 2016 at 9:41:13 AM UTC+1, Jeroen Demeyer wrote:
>
> One more thing: I think that this "interrupt" project would really 
> benefit from autoconf. I know that Python + autoconf is not a common 
> combination, but there are some non-trivial system-specific things which 
> are best handled by autoconf. Moreover, I have always wanted to add 
> support for handling stack overflows using sigaltstack(), possibly also 
> using getcontext()/setcontext(), which might again require autoconf 
> checks. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jeroen Demeyer
One more thing: I think that this "interrupt" project would really 
benefit from autoconf. I know that Python + autoconf is not a common 
combination, but there are some non-trivial system-specific things which 
are best handled by autoconf. Moreover, I have always wanted to add 
support for handling stack overflows using sigaltstack(), possibly also 
using getcontext()/setcontext(), which might again require autoconf checks.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jeroen Demeyer

On 2016-02-02 09:51, Volker Braun wrote:

The system-specific part could be a separate C library "libinterrupt"
that the python package depends on. That is how many other Python
packages depend on system-specific libraries...


That just adds an extra step, I don't see why this is a good idea. I can 
just compile C code directly in the Cython extension, that's not the 
problem.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread 'Martin R. Albrecht' via sage-devel
I guess this ends my plan to just

  pip install -r requirements.txt

it. But it makes sense.

This is now http://trac.sagemath.org/ticket/20002

libcynterupt?

Cheers,
Martin

Volker Braun writes:
> The system-specific part could be a separate C library "libinterrupt" that 
> the python package depends on. That is how many other Python packages 
> depend on system-specific libraries...
>
>
>
> On Tuesday, February 2, 2016 at 9:41:13 AM UTC+1, Jeroen Demeyer wrote:
>>
>> One more thing: I think that this "interrupt" project would really 
>> benefit from autoconf. I know that Python + autoconf is not a common 
>> combination, but there are some non-trivial system-specific things which 
>> are best handled by autoconf. Moreover, I have always wanted to add 
>> support for handling stack overflows using sigaltstack(), possibly also 
>> using getcontext()/setcontext(), which might again require autoconf 
>> checks. 
>>


-- 

_pgp: https://keybase.io/martinralbrecht
_www: https://martinralbrecht.wordpress.com
_jab: martinralbre...@jabber.ccc.de
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jeroen Demeyer

On 2016-02-02 10:16, 'Martin R. Albrecht' via sage-devel wrote:

I guess this ends my plan to just

   pip install -r requirements.txt


I'm not sure it does. I have no idea what pip install $FOO actually 
does. If it just runs setup.py, we can still run ./configure from setup.py.



libcynterupt?

Bikeshedding time! For of all, I would certainly drop the "lib".

Then we should consider if we want to refer to "interrupt" or to 
"signal". Arguments for "signal" are that the interrupt/signal framework 
handles more signals than just SIGINT and that the macros are also 
called sig_on()/sig_off(). So what about "cysignals"?


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jean-Pierre Flori


On Tuesday, February 2, 2016 at 10:35:27 AM UTC+1, Jeroen Demeyer wrote:
>
> On 2016-02-02 10:16, 'Martin R. Albrecht' via sage-devel wrote: 
> > I guess this ends my plan to just 
> > 
> >pip install -r requirements.txt 
>
> I'm not sure it does. I have no idea what pip install $FOO actually 
> does. If it just runs setup.py, we can still run ./configure from 
> setup.py. 
>
> > libcynterupt? 
> Bikeshedding time! For of all, I would certainly drop the "lib". 
>
> Then we should consider if we want to refer to "interrupt" or to 
> "signal". Arguments for "signal" are that the interrupt/signal framework 
> handles more signals than just SIGINT and that the macros are also 
> called sig_on()/sig_off(). So what about "cysignals"? 
>
"cygnals"? 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jeroen Demeyer

On 2016-02-02 11:04, Jean-Pierre Flori wrote:

"cygnals"?

Sounds too much like Cygwin.

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jeroen Demeyer

On 2016-02-02 11:16, Volker Braun wrote:

* makes it easier for distros, e.g. passing custom arguments to ./configure
Why is it easier to pass custom arguments to ./configure if there are 2 
packages instead of 1 package?



* easier and faster venv installations if you don't have to recompile
the c-level stuff every time
I don't get what do you mean. Would you install the library outside the 
venv and the Python package inside the venv? And besides, it's a small 
package, the compilation time does not matter much.


Adding a library as separate package really looks like a solution in 
search of problem.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jeroen Demeyer

On 2016-02-02 11:33, 'Martin R. Albrecht' via sage-devel wrote:

Hi Jeroen,

my concern is mainly of convention: I don’t think people expect pip to
install shared libraries.


I am not convinced that this "cysignals" package should contain a shared 
library. In Sage, it's a Python module(*), not a shared library. I know 
that Volker argues for a shared library, but I think that's just 
needlessly complicating matters.


(*) To be more precise, it's a Python module with some Cython files 
(.pxd and .pxi) and C headers (.h). It will be an interesting exercise 
to figure out how to install this properly :-)


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread 'Martin R. Albrecht' via sage-devel
Jean-Pierre Flori writes:
> "cygnals"? 

+1

-- 

_pgp: https://keybase.io/martinralbrecht
_www: https://martinralbrecht.wordpress.com
_jab: martinralbre...@jabber.ccc.de
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Volker Braun
On Tuesday, February 2, 2016 at 9:59:11 AM UTC+1, Jeroen Demeyer wrote:
>
> That just adds an extra step, I don't see why this is a good idea.


* makes it easier for distros, e.g. passing custom arguments to ./configure
* easier and faster venv installations if you don't have to recompile the 
c-level stuff every time 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread 'Martin R. Albrecht' via sage-devel
Hi Jeroen,

my concern is mainly of convention: I don’t think people expect pip to
install shared libraries. Also, virtual environments tend not to set
LD_LIBRARY_PATH but many people use pip with virtualenvs.

Cheers,
Martin

Jeroen Demeyer writes:
> On 2016-02-02 10:16, 'Martin R. Albrecht' via sage-devel wrote:
>> I guess this ends my plan to just
>>
>>pip install -r requirements.txt
>
> I'm not sure it does. I have no idea what pip install $FOO actually 
> does. If it just runs setup.py, we can still run ./configure from setup.py.
>
>> libcynterupt?
> Bikeshedding time! For of all, I would certainly drop the "lib".
>
> Then we should consider if we want to refer to "interrupt" or to 
> "signal". Arguments for "signal" are that the interrupt/signal framework 
> handles more signals than just SIGINT and that the macros are also 
> called sig_on()/sig_off(). So what about "cysignals"?


-- 

_pgp: https://keybase.io/martinralbrecht
_www: https://martinralbrecht.wordpress.com
_jab: martinralbre...@jabber.ccc.de
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Volker Braun
On Tuesday, February 2, 2016 at 11:44:44 AM UTC+1, Jeroen Demeyer wrote:
>
> > * makes it easier for distros, e.g. passing custom arguments to 
> ./configure 
> Why is it easier to pass custom arguments to ./configure if there are 2 
> packages instead of 1 package? 
>

Because only one of them has a ./configure, the other only has setup.py.

Its just a version of separation of concerns. Abstract the system-specifics 
into a c shared library and use that api from python. One might want to use 
it without Cython, e.g. plain CPython or boost::python

Compilation is fast as there isn't that much code, but running configure 
checking for all kinds of signal handler quirks may be less so.

Anyways just a thought.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-02 Thread Jeroen Demeyer

On 2016-02-02 12:00, Volker Braun wrote:

One might want to use it without Cython, e.g. plain CPython or boost::python


Well, the Cython and C parts are quite intertwined, so I do not intend 
to support anything but Cython.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] interrupt.pyx on PyPi?

2016-02-01 Thread 'Martin R. Albrecht' via sage-devel
Hi all,

In a thread over at [sage-support] William wrote:
> I've suggested numerous times that we should massively refactor the
> sage library to be a bunch of smaller Python libraries, develop them
> say on github (?), use Pypi and pip. If people would realize how
> important it is that we revamp how Sage development is done in a much
> less monolithic way, and better using existing tools, then I would be
> happy and enjoy watching as people do the revamp (e.g., like happened
> with switching from Mercurial to Git, which I didn't do much on, but
> definitely supported).

I don’t mean to restart a general strategy/development discussion here,
but perhaps turning Sage into a bunch of smaller Python libraries is
something which can be accomplished step-by-step.

In particular, I am *very* interested in turning Sage’s interrupt
handling into something that can be easily installed from PyPI. For
those who don’t know what Sage’s interrupt handling does: it allows that
you can press Ctrl-C to interrupt long running C code and that crashes
in a library do not necessarily crash your Python shell. It is a
difference between night and day to interface with external C/C++ code
>From Python without and with it.

Having this code available outside of Sage enables, for example, to turn
some of our C/C++ library interfaces into stand-alone libraries[^1], like
I’ve done with our fplll interface at

  https://github.com/malb/fpylll

Sage’s interrupt handling lives at

  https://github.com/sagemath/sage/tree/master/src/sage/ext/interrupt

I think the technical challenges are manageable. I’m using a copy of it
separately in

  https://github.com/malb/fpylll/tree/master/src/fpylll/interrupt

without issues. Making this code independent would mean one big patch
to the library, though, where we replace all

  include 'sage/ext/interrupt.pxi'

with an appropriate new line depending on where we’d install the file.

My question is: am I overlooking some technical challenge or another
reason why making this code independent could be a problem?

I’m happy to put some work into this, in case you’re wondering.

Cheers,
Martin

[^1]: Okay, there’s also the small issue of how to do type conversion
Sage ←→ library in a nice modular yet fast way, but one step at a time.

-- 

_pgp: https://keybase.io/martinralbrecht
_www: https://martinralbrecht.wordpress.com
_jab: martinralbre...@jabber.ccc.de
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-01 Thread Jeroen Demeyer

On 2016-02-01 10:40, 'Martin R. Albrecht' via sage-devel wrote:

In particular, I am *very* interested in turning Sage’s interrupt
handling into something that can be easily installed from PyPI. For
those who don’t know what Sage’s interrupt handling does: it allows that
you can press Ctrl-C to interrupt long running C code and that crashes
in a library do not necessarily crash your Python shell.


First of all, do you assume that the code you want to interrupt is 
Cython? Or do you want something which could work more generally?


I guess it could be separated from Sage. It might be a good project for 
some Sage Days workshop.


One non-trivial thing is that the Sage interrupt framework also refers 
directly to PARI. So this would need to be abstracted.


And of course it will only work on POSIX systems.


Jeroen.

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] interrupt.pyx on PyPi?

2016-02-01 Thread 'Martin R. Albrecht' via sage-devel
Hi Jeroen,

Jeroen Demeyer writes:
> On 2016-02-01 10:40, 'Martin R. Albrecht' via sage-devel wrote:
>> In particular, I am *very* interested in turning Sage’s interrupt
>> handling into something that can be easily installed from PyPI. For
>> those who don’t know what Sage’s interrupt handling does: it allows that
>> you can press Ctrl-C to interrupt long running C code and that crashes
>> in a library do not necessarily crash your Python shell.
>
> First of all, do you assume that the code you want to interrupt is 
> Cython? Or do you want something which could work more generally?

Cython-only is enough for me.

> I guess it could be separated from Sage. It might be a good project for 
> some Sage Days workshop.

+1, I don’t think I’ll attend any anytime soon. Let’s see if I can find
some time to work on this in the mean time. I’ll wait a bit more if
there are objects here and then open a ticket, where we can move
technical discussions.

> One non-trivial thing is that the Sage interrupt framework also refers 
> directly to PARI. So this would need to be abstracted.

Ah, I forgot about removing that one for my hack. Good point.

> And of course it will only work on POSIX systems.

I guess we could provide some noop for non-POSIX systems?

Cheers,
Martin



-- 

_pgp: https://keybase.io/martinralbrecht
_www: https://martinralbrecht.wordpress.com
_jab: martinralbre...@jabber.ccc.de
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature