Opened 4 years ago
Closed 3 years ago
#22698 closed enhancement (fixed)
Deprecate sage cython foo.spyx
Reported by:  kcrisman  Owned by:  

Priority:  major  Milestone:  sage8.0 
Component:  scripts  Keywords:  
Cc:  robertwb, jpflori  Merged in:  
Authors:  Jeroen Demeyer  Reviewers:  JeanPierre Flori 
Report Upstream:  N/A  Work issues:  
Branch:  6984666 (Commits)  Commit:  6984666c1ae2701c04b27c12121c12d1d3eeb31b 
Dependencies:  Stopgaps: 
Description (last modified by )
.spyx
files are treated exactly the same as .pyx
files in all of Sage, with one exception: sage cython foo.spyx
adds preprocessing to .spyx
files. To be more compatible with other Sage commands (in particular, sage foo.spyx
and load("foo.spyx")
), we deprecate sage cython foo.spyx
.
There is another reason for this: sage cython foo.spyx
adds some include
statements like cdefs.pxi
. These .pxi
files should be deprecated in Sage. Moreover, .pxi
files in general are semideprecated anyway by upstream Cython.
Change History (19)
comment:1 Changed 4 years ago by
comment:2 followup: ↓ 3 Changed 4 years ago by
Wait, they don't have preparsing? Then ... why "s"pyx? WTH?
comment:3 in reply to: ↑ 2 Changed 4 years ago by
comment:4 Changed 4 years ago by
 Cc robertwb added
Then I guess a good way to document this would be to either deprecate them (this would have to be discussed on sagedevel though, maybe ask William too if he introduced them) or to make it really clear in lots of places where one might encounter them that there is zero difference with .pyx
. I'm still baffled by this ... Maybe when SageX
was originally founded the idea was that .pyx
would stay for oldstyle Pyrex files but that was abandoned, I'm just guessing. Robert Bradshaw might know more.
comment:5 Changed 4 years ago by
I was mostly right but not 100%: there is one difference between .spyx
and .pyx
files: when running a command like
$ sage cython somefile.spyx
Sage will add some .pxi
includes to the Cython sources and set some Sagespecific flags.
Within Sage itself, doing cython("somefile.spyx")
, there is no difference. When executing a Cython file by running sage somefile.spyx
, there is also no difference.
In my opinion, sage cython
should just run plain Cython. Related: #22805
comment:6 Changed 4 years ago by
Just reformulating my last comment, I can think of 3 ways to run Cython in a Sage environment:
 Within Sage,
load("foo.spyx")
: compiles and executes the file
sage foo.spyx
: compiles and executes the file
sage cython foo.spyx
: only runs Cython on the file
Only 3 makes a difference between .spyx
and .pyx
files. I suggest to deprecate this. More precisely, keep the current behaviour but deprecate sage cython foo.spyx
(but not sage cython foo.pyx
which just runs Cython).
comment:7 Changed 4 years ago by
 Component changed from documentation to scripts
 Description modified (diff)
 Summary changed from Improve spyx documentation to Deprecate sage cython foo.spyx
comment:8 Changed 4 years ago by
 Branch set to u/jdemeyer/deprecate_sage___cython_foo_spyx
comment:9 Changed 4 years ago by
 Commit set to 6984666c1ae2701c04b27c12121c12d1d3eeb31b
 Status changed from new to needs_review
New commits:
6984666  Deprecate sage cython foo.spyx

comment:10 Changed 4 years ago by
 Description modified (diff)
comment:11 Changed 4 years ago by
 Cc jpflori added
comment:12 Changed 4 years ago by
 Description modified (diff)
comment:13 followup: ↓ 14 Changed 4 years ago by
What about Sage specific %runfile
and %attach
?
comment:14 in reply to: ↑ 13 ; followup: ↓ 15 Changed 4 years ago by
Replying to vdelecroix:
What about Sage specific
%runfile
and%attach
?
What do you mean; what is your question?
comment:15 in reply to: ↑ 14 ; followup: ↓ 16 Changed 4 years ago by
Replying to jdemeyer:
Replying to vdelecroix:
What about Sage specific
%runfile
and%attach
?What do you mean; what is your question?
These are two other ways of running Cython code in Sage that were not mentioned.
comment:16 in reply to: ↑ 15 Changed 4 years ago by
Replying to vdelecroix:
These are two other ways of running Cython code in Sage that were not mentioned.
Right: %runfile
and %attach
are essentially just wrappers around load()
. So they also treat .spyx
files and .pyx
files the same.
comment:17 Changed 3 years ago by
ping
comment:18 Changed 3 years ago by
 Reviewers set to JeanPierre Flori
 Status changed from needs_review to positive_review
Looks ok.
comment:19 Changed 3 years ago by
 Branch changed from u/jdemeyer/deprecate_sage___cython_foo_spyx to 6984666c1ae2701c04b27c12121c12d1d3eeb31b
 Resolution set to fixed
 Status changed from positive_review to closed
For the record:
.spyx
files are exactly the same as.pyx
files. So we could even deprecate.spyx
files if it makes people think that it's something Sagespecific while it's not.