Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/bin/sage: Delegate handling of options of sage-the-distribution, specifying a subset that is supported by sagelib proper #29111

Closed
mkoeppe opened this issue Jan 30, 2020 · 146 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jan 30, 2020

The sage script has a number of options that only make sense for sage-the-distribution, but do not make sense in downstream packaging of sage. Consequently, downstream packagers may install simple custom versions of the script that only provide a subset of the options.

Examples:

We should specify the subset of sage command line options that must be supported in any deployment/packaging of sage. This is so that user packages can work reliably.

Examples:

  • sage -c SAGECOMMAND -- obviously
  • sage -python -c COMMAND
  • sage -t -- because it is used by user packages for testing sage sources
  • sage -sh ..... ?

In this ticket, we actually split src/bin/sage into sagelib functionality and sage-the-distribution functionality. src/bin/sage delegates unknown options to build/bin/sage-site.

Ideally, distributions should be able to use an unmodified src/bin/sage.

Context:

See also:

Depends on #29878
Depends on #29289
Depends on #29884

CC: @kiwifb @isuruf @dimpase @embray @saraedum @antonio-rojas @slel @EmmanuelCharpentier @orlitzky @kcrisman

Component: scripts

Author: Matthias Koeppe, John Palmieri

Branch: 3953671

Reviewer: Matthias Koeppe, John Palmieri, François Bissey

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

@mkoeppe mkoeppe added this to the sage-9.1 milestone Jan 30, 2020
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jan 30, 2020

comment:1

As I said on #29092, we should also move corresponding sage-the-distribution tests (such as those for sage -sqlite) mentioned in #29002) from src (which is for sagelib) to somewhere in build (which is for sage-the-distribution). Downstream packagers would ignore the sage-the-distribution tests.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 14, 2020

comment:3

pushing these forward to 9.2

@mkoeppe mkoeppe modified the milestones: sage-9.1, sage-9.2 Apr 14, 2020
@mkoeppe

This comment has been minimized.

@jhpalmieri
Copy link
Member

comment:6

I've asked this question before: if Sage is built with the system's Python, should we still keep sage --python ...? What is the difference between sage --python and sage --sqlite3 (and what about sage --gap, sage --singular, etc.)?

@jhpalmieri
Copy link
Member

comment:7

Here are some arguments that should always be allowed:

  • sage -t
  • sage -c
  • sage -h
  • sage -n, sage --notebook
  • sage --nodotsage
  • sage -v, sage --version

"Advanced" arguments:

  • sage --preparse
  • sage --min
  • sage -q
  • sage --dumpversion
  • sage --startuptime
  • sage --fixdoctests
  • sage --coverage
  • sage --coverageall
  • sage --grep, sage --search_src, sage --grepdoc, sage --search_doc
  • sage --rst2ipynb, sage --ipynb2rst

Maybe also sage --sh.

(I'm not saying is a complete list, but I would suggest these as a starting point.)

@jhpalmieri
Copy link
Member

comment:8

By the way, sage -twistd doesn't work: there is no twistd executable since Sage 9.1. Plus we are removing the twisted package in #29754. See #29878.

@kiwifb
Copy link
Member

kiwifb commented Jun 16, 2020

comment:9

Hum, this ticket reminds me that I need to clean the version in sage-on-gentoo

fbissey@moonloop ~ $ sage -advanced
SageMath version 9.2.beta1, Release Date: 2020-06-13

Running Sage:
  file.[sage|py|spyx] -- run given .sage, .py or .spyx file
  -advanced           -- print this advanced help message
  -c <cmd>            -- Evaluates cmd as sage code
  -h, -?              -- print short help message
  -min [...]          -- do not populate global namespace (must be first
                         option)
  -preparse <file.sage> -- preparse file.sage and produce corresponding file.sage.py
  -q                  -- quiet; start with no banner
  -gthread, -qthread, -q4thread, -wthread, -pylab
                      -- pass the option through to ipython
  -v, -version        -- display Sage version information
  -dumpversion        -- print Sage version

Running the notebook:
  --notebook=[...]    -- start the Sage notebook (valid options are
                         'default', 'sagenb', 'jupyter' and 'export').
                         Current default is 'export' sagenb to jupyter.
                         See the output of sage --notebook --help
                         for more details and examples of how to pass
                         optional arguments
  -inotebook [...]    -- start the *insecure* Sage notebook (deprecated)
  -n, -notebook [...] -- start the default Sage notebook (options are the
                         same as for the notebook command in Sage).  See the
                         output of sage -n -h for more details

Running external programs:
  -cleaner            -- run the Sage cleaner
  -cython [...]       -- run Cython with given arguments
  -ecl [...]          -- run Common Lisp
  -gap [...]          -- run Sage's Gap with given arguments
  -gdb                -- run Sage under the control of gdb
  -gp [...]           -- run Sage's PARI/GP calculator with given arguments
  -ipython [...]      -- run Sage's IPython using the default environment (not
                         Sage), passing additional options to IPython
  -ipython3 [...]     -- same as above, but using Python 3
  -jupyter [...]      -- run Sage's Jupyter with given arguments
  -kash [...]         -- run Sage's Kash with given arguments
                         (not installed currently, run sage -i kash)
  -lisp [...]         -- run Lisp interpreter included with Sage
  -M2 [...]           -- run Sage's Macaulay2 with given arguments
                         (not installed currently, run sage -i macaulay2)
  -maxima [...]       -- run Sage's Maxima with given arguments
  -mwrank [...]       -- run Sage's mwrank with given arguments
  -polymake [...]     -- run Sage's Polymake with given arguments
                         (not installed currently, run sage -i polymake)
  -python [...]       -- run the Python interpreter
  -python2 [...]      -- run the Python 2 interpreter
  -python3 [...]      -- run the Python 3 interpreter
  -R [...]            -- run Sage's R with given arguments
  -sh [...]           -- run $SHELL (/bin/bash) with Sage environment variables
  -singular [...]     -- run Sage's singular with given arguments
  -sqlite3 [...]      -- run Sage's sqlite3 with given arguments
  -twistd [...]       -- run Twisted server

Testing the Sage library:
  -startuptime [module] -- display how long each component of Sage takes to
                         start up; optionally specify a module to get more
                         details about that particular module
  -t [options] <--all|files|dir>
                      -- test examples in .py, .pyx, .sage, .tex or .rst files
                         selected options:
                           --long - include lines with the phrase 'long time'
                           --verbose - print debugging output during the test
                           --all - test all files
                           --sagenb - test all sagenb files
                           --optional - controls which optional tests are run
                           --initial - only show the first failure per block
                           --debug - drop into PDB after an unexpected error
                           --failed - only test files that failed last test
                           --warn-long [timeout] - warning if doctest is slow
                           --only-errors - only output failures, not successes
                           --gc=GC - control garbarge collection (ALWAYS:
                                     collect garbage before every test; NEVER:
                                     disable gc; DEFAULT: Python default)
                           --help - show all testing options
  -tp <N> [...]       -- like -t above, but tests in parallel using N threads
                         with 0 interpreted as a sensible default
  -testall [options]  -- test all source files, docs, and examples.  options
                         like -t

File conversion:
  -rst2ipynb [...]    -- Generates Jupyter notebook (.ipynb) from standalone
                         reStructuredText source.
                         (not installed currently, run sage -i rst2ipynb)
  -ipynb2rst [...]    -- Generates a reStructuredText source file from
                         a Jupyter notebook (.ipynb).

Valgrind memory debugging:
  -cachegrind         -- run Sage using Valgrind's cachegrind tool.  The log
                         files are named sage-cachegrind.PID can be found in
                         
  -callgrind          -- run Sage using Valgrind's callgrind tool.  The log
                         files are named sage-callgrind.PID can be found in
                         
  -massif             -- run Sage using Valgrind's massif tool.  The log
                         files are named sage-massif.PID can be found in
                         
  -memcheck           -- run Sage using Valgrind's memcheck tool.  The log
                         files are named sage-memcheck.PID can be found in
                         
  -omega              -- run Sage using Valgrind's omega tool.  The log
                         files are named sage-omega.PID can be found in
                         
  -valgrind           -- this is an alias for -memcheck

You can also use -- before a long option, e.g., 'sage --optional'.

I have to drop the py2/py3 stuff for just defaut python. I dropped -sh the day I dropped sage-env altogether, the main point of keeping sage -sh around was to check or use the environment set by sage-env.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

comment:10

Dropping sage -sh is a bad idea. User packages need this

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

comment:11

Replying to @jhpalmieri:

I've asked this question before: if Sage is built with the system's Python, should we still keep sage --python ...? What is the difference between sage --python and sage --sqlite3 (and what about sage --gap, sage --singular, etc.)?

sage -python means: run the python that sage runs in.
In distributions, this could just be plain Python.

Install scripts of user packages need this.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

Dependencies: #29878

@kiwifb
Copy link
Member

kiwifb commented Jun 16, 2020

comment:13

Replying to @mkoeppe:

Dropping sage -sh is a bad idea. User packages need this

Certainly, vanilla sage does need it. In sage-on-gentoo at best you would have a normal shell since I dropped sage-env altogether.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

comment:14

Replying to @kiwifb:

Replying to @mkoeppe:

Dropping sage -sh is a bad idea. User packages need this

Certainly, vanilla sage does need it. In sage-on-gentoo at best you would have a normal shell since I dropped sage-env altogether.

Yes, vanilla shell is fine. The point is that user packages need the interface.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

Changed dependencies from #29878 to #29878, #29289

@kiwifb
Copy link
Member

kiwifb commented Jun 16, 2020

comment:16

Now, I understand what you mean. User scripts may start with sage -sh and what not. I completely forgot about that when I removed it - even though that was one of the reason I was keeping it around. I will re-instate it as a vanilla shell or no-op for compatibility.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

comment:17

Great!

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

comment:19

Here's a beginning of what I have in mind.


New commits:

b200d70trac 29878: remove "sage --twistd" command-line argument
e0b6112build/bin/sage-spkg, src/bin/sage: Remove support for installing old-style SPKGs
20b2a93Merge branch 't/29289/remove_support_for_installing_old_style_spkgs__deprecated_in_sage_6_9' into t/29111/specify_a_subset_of_sage_command_line_options_that_are_supported_by_sagelib___rather_than_sage_the_distribution
152e581src/bin/sage: Delegate options that pertain to SAGE_ROOT or sage-the-distribution to the new script build/bin/sage-site

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

Commit: 152e581

@jhpalmieri
Copy link
Member

comment:20

Okay, I'm fine with keeping sage --python. What about sage --singular et al.? Should src/bin/sage be constructed by ./configure, adding arguments when the corresponding packages are going to be installed by Sage? Or is that too complicated?

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Specify a subset of sage command line options that are supported by sagelib - rather than sage-the-distribution src/bin/sage: Delegate handling of options of sage-the-distribution, specifying a subset that is supported by sagelib proper Jun 16, 2020
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

comment:22

Replying to @jhpalmieri:

Okay, I'm fine with keeping sage --python. What about sage --singular et al.?

I think those should be moved to sage-site as well. (Also the printing of these in the help text...)

Should src/bin/sage be constructed by ./configure, adding arguments when the corresponding packages are going to be installed by Sage? Or is that too complicated?

I think that's too complicated

@orlitzky
Copy link
Contributor

comment:23

sage --grep, sage --search_src, sage --grepdoc, sage --search_doc

At the risk of starting another holy war, we shouldn't expect these to work on a distribution because we shouldn't expect the source files to be available after installation. My current sage.git checkout contains 71MiB of *.py files that are entirely redundant after the optimized .opt-2.pyc files are generated. Someone is eventually going to realize that they shouldn't be installed after this gets more popular.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 16, 2020

comment:24

We could just conditionalize these ones based on whether SAGE_SRC is set or not by sage-env...

@jhpalmieri
Copy link
Member

comment:109

Good idea. From http://fricas.sourceforge.net/history.html, it looks like FriCAS is a fork of Axiom, but I just installed it, and it doesn't install axiom (at least not in SAGE_ROOT/local/bin, nor is axiom listed in its package manifest). It installs fricas and efricas, so we could eventually add those, but it's not like anyone's been clamoring for them.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 22, 2020

comment:110

Then let's just drop sage --axiom. Good catch!

@dimpase
Copy link
Member

dimpase commented Jun 22, 2020

comment:111

is axiom package an old-style one?

It's probably very outdated. also, my impression is that fricas fork is the most active of all the forks of the original axiom forks.
The others are http://www.axiom-developer.org/ (axiom) and http://www.open-axiom.org/links.html (OpenAxiom)

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 22, 2020

comment:112

That's right, there is no new-style axiom package.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 22, 2020

Changed commit from 4a3d36e to 3a0193c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 22, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

3a0193csrc/bin/sage: Remove handling of 'sage -axiom'

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 22, 2020

comment:114

Done. Needs review

@jhpalmieri
Copy link
Member

comment:115

I'm happy with everything. Who else would like to weigh in?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 23, 2020

Changed reviewer from Matthias Koeppe, John Palmieri, ... to Matthias Koeppe, John Palmieri, François Bissey

@kiwifb
Copy link
Member

kiwifb commented Jun 23, 2020

comment:117

Sorry, I was busy and forgot about it. We have reached an agreement with what goes in and what's next. I think we have bashed it enough and it is ready to go.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 23, 2020

comment:118

Thanks!

@jhpalmieri
Copy link
Member

comment:119

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 23, 2020

comment:120

Follow-ups:

@vbraun
Copy link
Member

vbraun commented Jul 8, 2020

comment:121

Merge confilct

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 8, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

c8bab39Merge tag '9.2.beta4' into t/29111/specify_a_subset_of_sage_command_line_options_that_are_supported_by_sagelib___rather_than_sage_the_distribution

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 8, 2020

Changed commit from 3a0193c to c8bab39

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 8, 2020

Changed commit from c8bab39 to 3953671

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 8, 2020

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

3953671Merge tag '9.2.beta4' into t/29111/specify_a_subset_of_sage_command_line_options_that_are_supported_by_sagelib___rather_than_sage_the_distribution

@vbraun
Copy link
Member

vbraun commented Jul 10, 2020

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 25, 2022

Changed commit from 3953671 to none

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Apr 25, 2022

comment:126

Follow-up in #33753

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants