Opened 4 years ago

Closed 4 years ago

#22698 closed enhancement (fixed)

Deprecate sage --cython foo.spyx

Reported by: kcrisman Owned by:
Priority: major Milestone: sage-8.0
Component: scripts Keywords:
Cc: robertwb, jpflori Merged in:
Authors: Jeroen Demeyer Reviewers: Jean-Pierre Flori
Report Upstream: N/A Work issues:
Branch: 6984666 (Commits, GitHub, GitLab) Commit: 6984666c1ae2701c04b27c12121c12d1d3eeb31b
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

.spyx files are treated exactly the same as .pyx files in all of Sage, with one exception: sage --cython foo.spyx adds pre-processing 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 semi-deprecated anyway by upstream Cython.

Change History (19)

comment:1 Changed 4 years ago by jdemeyer

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 Sage-specific while it's not.

comment:2 follow-up: Changed 4 years ago by kcrisman

Wait, they don't have preparsing? Then ... why "s"pyx? WTH?

comment:3 in reply to: ↑ 2 Changed 4 years ago by jdemeyer

Replying to kcrisman:

Wait, they don't have preparsing?

No.

comment:4 Changed 4 years ago by kcrisman

  • 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 sage-devel 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 old-style Pyrex files but that was abandoned, I'm just guessing. Robert Bradshaw might know more.

comment:5 Changed 4 years ago by jdemeyer

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 Sage-specific 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 jdemeyer

Just reformulating my last comment, I can think of 3 ways to run Cython in a Sage environment:

  1. Within Sage, load("foo.spyx"): compiles and executes the file
  1. sage foo.spyx: compiles and executes the file
  1. 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 jdemeyer

  • Authors set to Jeroen Demeyer
  • 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 jdemeyer

  • Branch set to u/jdemeyer/deprecate_sage___cython_foo_spyx

comment:9 Changed 4 years ago by jdemeyer

  • Commit set to 6984666c1ae2701c04b27c12121c12d1d3eeb31b
  • Status changed from new to needs_review

New commits:

6984666Deprecate sage --cython foo.spyx

comment:10 Changed 4 years ago by jdemeyer

  • Description modified (diff)

comment:11 Changed 4 years ago by jpflori

  • Cc jpflori added

comment:12 Changed 4 years ago by jdemeyer

  • Description modified (diff)

comment:13 follow-up: Changed 4 years ago by vdelecroix

What about Sage specific %runfile and %attach?

comment:14 in reply to: ↑ 13 ; follow-up: Changed 4 years ago by jdemeyer

Replying to vdelecroix:

What about Sage specific %runfile and %attach?

What do you mean; what is your question?

comment:15 in reply to: ↑ 14 ; follow-up: Changed 4 years ago by vdelecroix

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 jdemeyer

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 4 years ago by jdemeyer

ping

comment:18 Changed 4 years ago by jpflori

  • Reviewers set to Jean-Pierre Flori
  • Status changed from needs_review to positive_review

Looks ok.

comment:19 Changed 4 years ago by vbraun

  • Branch changed from u/jdemeyer/deprecate_sage___cython_foo_spyx to 6984666c1ae2701c04b27c12121c12d1d3eeb31b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.