sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

remove (or clean up) SAGE_ROOT/examples #7494

Closed williamstein closed 12 years ago

williamstein commented 14 years ago

Did you know there is a directory SAGE_ROOT/examples? Do you care? Because if nobody seriously cares, I'm going to delete it from future versions of Sage, since it is still a mess, and the last nontrivial commit was 1.5 years ago (!):

changeset:   158:d18dad210d3b
user:        Mike Hansen <mhansen@gmail.com>
date:        Mon Apr 14 03:08:48 2008 -0700
summary:     Extract sagetex.py and sagetex.sty

I can put the same directory online somewhere, and move the fortran file that is used in one doctest out. I'm just really curious if anybody knows about this directory and cares.

Apply:

  1. attachment: trac_7494.patch to the Sage library repo
  2. attachment: trac_7494-ref.patch to the Sage library repo
  3. attachment: trac_7494-scripts.patch to the scripts repo
  4. attachment: trac_7494-root-repo.patch to the Sage root repository

Release Manager:

Delete $SAGE_ROOT/examples/ as part of this ticket.

(This should happen automatically, i.e., the directory should vanish, when sdisting.)

CC: @wdjoyner

Component: misc

Keywords: sd32

Author: William Stein, John Palmieri

Reviewer: Karl-Dieter Crisman, Rob Beezer, Leif Leonhardy

Merged: sage-4.7.2.alpha4

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

williamstein commented 14 years ago
comment:1

298 would be invalidated by doing this ticket.

kcrisman commented 14 years ago
comment:2

I was wondering about that directory too a few months ago. So we don't do anything with it currently? Here are comments.

I think it would be worth linking at least a few of the top-level ones to the wiki, and perhaps put in one of the documentation places, as some of the examples files there are definitely useful for templates.

I bet some of the programming (Pyrex/SageX/Cython) examples might be useful too.

I am cc:ing wdj to see if he thinks all his examples/routines from calculus are now in the main Sage library.

The linalg folder is definitely pointless, as permanents are now in the main library.

The worksheets folder seems pretty pointless in its current state.

The tests directory has some things that should be added as random doctests for those things, though.

The modsym directory stuff likely is already tested in that area, given how important it is to Sage!

The latex_embed is obviously superfluous at this point.

Fortran was has already discussed above.

Finance is really pointless.

The Groebner basis thing seems intriguing - perhaps should be incorporated in doctests for that elsewhere?

Is the Ajax thing now very very superfluous, given how much we use it? It's not (that) old.

The GSL folder is quite large compared to the rest and perhaps has some examples which should be combined into one big file which is doctested, if those sorts of tests aren't. It would seem valuable not to lose this many doctests -does it currently pass?

kcrisman commented 14 years ago
comment:3

I am cc:ing wdj to see if he thinks all his examples/routines from calculus are now in the main Sage library.

See #7936 for this - we can delete this one, at least.

kini commented 13 years ago
comment:4

The last nontrivial commit was 1.5 years before this ticket was created, but now it's been 1.5 years since this ticket was created! Can we get rid of this directory yet?

kcrisman commented 13 years ago
comment:5

I have asked about this a lot. In order to give this, it would be really nice to move a few of the examples to other places - wiki, wherever.

Anyway, we shouldn't just completely delete in case there are useful tests. But I totally agree on the overall strategy.

williamstein commented 13 years ago
comment:6

Delete it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I wrote almost everything in there, and it should just go.

I give "delete the examples directory" a positive review. To merge this ticket, do

cd SAGE_ROOT
rm -rf examples
williamstein commented 13 years ago
comment:8

For future reference, I've put that directory here:

http://wstein.org/old_sage_examples/
williamstein commented 13 years ago
comment:9

I just realized that there is one thing that has to be done. Observe:

wstein@ubuntu:~/d/sage$ sage -grep "examples"|grep SAGE_ROOT
finance/stock.py:            sage: finance.Stock('aapl').load_from_file(SAGE_ROOT + '/examples/finance/AAPL-minutely.csv')[:5]
finance/stock.py:            sage: finance.Stock('goog').load_from_file(SAGE_ROOT + '/examples/finance/AAPL-minutely.csv')[:5]
finance/stock.py:            sage: finance.Stock('aapl').load_from_file(SAGE_ROOT + "/examples/finance/AAPL-minutely.csv")
misc/hg.py:hg_examples = HG('%s/data/examples'%SAGE_ROOT,
misc/inline_fortran.py:            sage: s = open(os.environ['SAGE_ROOT'] + '/examples/fortran/FIB1.F').read()
wstein@ubuntu:~/d/sage$ 

So the stuff in examples that are used in doctests need to be moved to the SAGE_ROOT/data/ directory. Thus one needs to attach a patch that does this to this ticket, and that patch will need to be reviewed.

williamstein commented 13 years ago

Attachment: trac_7494.patch.gz

williamstein commented 13 years ago
comment:10

The patch trac_7494.patch should change the core sage library so it doesn't depend on anything in the SAGE_ROOT/examples directory for testing. It also does not put anything in the SAGE_ROOT/data directory, since that is not needed.

kcrisman commented 13 years ago
comment:12

So the Groebner, gsl, etc. tests aren't really useful? Ok by me.

Nice - thanks for looking at this "officially". Since there is a Sage Days going on and today is my first day of classes, I think someone will beat me to the review, but thanks for looking at this a bit more carefully. In some sense, you are the only person who can check it, since you're one of the few who really knows why these things were in in the first place :)

kcrisman commented 13 years ago

Author: William Stein

williamstein commented 13 years ago

Changed keywords from none to sd32

1d7ec08f-60ae-4512-91a6-8324c06eab9f commented 13 years ago

Description changed:

--- 
+++ 
@@ -8,4 +8,10 @@

I can put the same directory online somewhere, and move the fortran file that is used in one doctest out. I'm just really curious if anybody knows about this directory and cares.

+Apply: +1. attachment: trac_7494.patch

+Release Manager + +Delete $SAGE_ROOT/examples as part of this ticket. +

1d7ec08f-60ae-4512-91a6-8324c06eab9f commented 13 years ago

Reviewer: Karl-Dieter Crisman, Rob Beezer

1d7ec08f-60ae-4512-91a6-8324c06eab9f commented 13 years ago
comment:14

Trash it. There's too much old misleading stuff about as is.

I renamed the examples directory, applied the patch, ran tests and got no failures.

I guess we need to alert the release manager somehow to actually delete the directory in the next distribution? I'll put a note above, edit as necessary.

jhpalmieri commented 13 years ago

Changed author from William Stein to William Stein, John Palmieri

jhpalmieri commented 13 years ago

Description changed:

--- 
+++ 
@@ -9,7 +9,8 @@
 I can put the same directory online somewhere, and move the fortran file that is used in one doctest out.  I'm just really curious if anybody knows about this directory and cares. 

 **Apply**:
-1.  [attachment: trac_7494.patch](https://github.com/sagemath/sage-prod/files/10646849/trac_7494.patch.gz)
+1.  [attachment: trac_7494.patch](https://github.com/sagemath/sage-prod/files/10646849/trac_7494.patch.gz) to the Sage repo
+2.  [attachment: trac_7494-scripts.patch](https://github.com/sagemath/sage-prod/files/10646850/trac_7494-scripts.patch.gz) to the scripts repo

 **Release Manager**
jhpalmieri commented 13 years ago
comment:15

This also needs a patch to the scripts repo, since sage-make_devel_packages tries to create a new examples spkg and fails with a nonzero exit status if it can't do that. I'm attaching a patch.

jhpalmieri commented 13 years ago

scripts repo

williamstein commented 12 years ago
comment:17

Attachment: trac_7494-scripts.patch.gz

I'm good with jhpalmieri's cleanup of my patch.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 12 years ago
comment:18

The root repository certainly also has to get patched:

$ grep -win examples spkg/install spkg/standard/deps 
spkg/install:184:EXAMPLES=`$newest examples`
spkg/install:185:export EXAMPLES
spkg/standard/deps:48:     $(INST)/$(EXAMPLES) \
spkg/standard/deps:398:$(INST)/$(EXAMPLES): $(BASE) $(INST)/$(PATCH)
spkg/standard/deps:399: $(INSTALL) "$(SAGE_SPKG) $(EXAMPLES) 2>&1" "tee -a $(SAGE_LOGS)/$(EXAMPLES).log"
83660e46-0051-498b-a8c1-f7a7bd232b5a commented 12 years ago

Description changed:

--- 
+++ 
@@ -9,10 +9,13 @@
 I can put the same directory online somewhere, and move the fortran file that is used in one doctest out.  I'm just really curious if anybody knows about this directory and cares. 

 **Apply**:
-1.  [attachment: trac_7494.patch](https://github.com/sagemath/sage-prod/files/10646849/trac_7494.patch.gz) to the Sage repo
-2.  [attachment: trac_7494-scripts.patch](https://github.com/sagemath/sage-prod/files/10646850/trac_7494-scripts.patch.gz) to the scripts repo
+1. [attachment: trac_7494.patch](https://github.com/sagemath/sage-prod/files/10646849/trac_7494.patch.gz) to the Sage library repo
+2. [attachment: trac_7494-scripts.patch](https://github.com/sagemath/sage-prod/files/10646850/trac_7494-scripts.patch.gz) to the **scripts** repo
+3. <Add a patch> to the **Sage root** repository

-**Release Manager**
+**Release Manager:**

-Delete `$SAGE_ROOT/examples` as part of this ticket.
+Delete `$SAGE_ROOT/examples/` as part of this ticket. 

+(This should happen automatically, i.e., the directory should vanish, when `sdist`ing.)
+
83660e46-0051-498b-a8c1-f7a7bd232b5a commented 12 years ago

Work Issues: Add a patch for the root repo.

jhpalmieri commented 12 years ago

Description changed:

--- 
+++ 
@@ -11,7 +11,7 @@
 **Apply**:
 1. [attachment: trac_7494.patch](https://github.com/sagemath/sage-prod/files/10646849/trac_7494.patch.gz) to the Sage library repo
 2. [attachment: trac_7494-scripts.patch](https://github.com/sagemath/sage-prod/files/10646850/trac_7494-scripts.patch.gz) to the **scripts** repo
-3. <Add a patch> to the **Sage root** repository
+3. [attachment: trac_7494-root-repo.patch](https://github.com/sagemath/sage-prod/files/10646851/trac_7494-root-repo.patch.gz) to the **Sage root** repository

 **Release Manager:**
jhpalmieri commented 12 years ago

Changed work issues from Add a patch for the root repo. to none

jhpalmieri commented 12 years ago
comment:19

I think this searches through all of the relevant files:

$ grep -win examples `hg manifest`

I'm attaching a patch for this. In addition to the two files you found, it also patches libdist_filelist, which looks like it is completely out of date, but it doesn't hurt to patch it anyway.

jhpalmieri commented 12 years ago

root repo

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 12 years ago

Changed reviewer from Karl-Dieter Crisman, Rob Beezer to Karl-Dieter Crisman, Rob Beezer, Leif Leonhardy

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 12 years ago
comment:20

Attachment: trac_7494-root-repo.patch.gz

Ok, I've sdisted with a version with the patches applied, built the new Sage distribution from scratch, and all (long) tests pass.

As expected, I got rid of the examples/ directory and the spkg in the new distro. (Note that also the examples spkg in spkg/standard/ of the original distribution got deleted; not sure whether this is intentional. In contrast, the examples/ directory there remained.)

Upgrading from a path without an examples spkg shouldTM IMHO also work; haven't tried that [yet].

Don't know yet whether Jeroen's merger is "prepared" for such an operation, and since Sage 4.7.2.alpha3 is almost out, I don't think I'll attempt to merge this ticket into this release. There'll certainly be an alpha4, or we could try with the next release candidate.

Unfortunately we don't win much regarding the size; the current examples spkg is just 2.0 MB, 3.9 MB uncompressed on my disk (i.e., the size of the examples/ directory), and just 2.6 MB in "real" bytes.

jdemeyer commented 12 years ago
comment:21

Problems while building the documentation:

dochtml.log:/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.2.alpha4/local/lib/python2.6/site-packages/sage/finance/stock.py:docstring of sage.finance.stock.OHLC:3: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
dochtml.log:/mnt/usb1/scratch/jdemeyer/merger/sage-4.7.2.alpha4/local/lib/python2.6/site-packages/sage/finance/stock.py:docstring of sage.finance.stock.OHLC:8: (ERROR/3) Unexpected indentation.
jhpalmieri commented 12 years ago
comment:22

I believe this referee patch should fix the documentation problem.

jhpalmieri commented 12 years ago

Description changed:

--- 
+++ 
@@ -10,8 +10,9 @@

 **Apply**:
 1. [attachment: trac_7494.patch](https://github.com/sagemath/sage-prod/files/10646849/trac_7494.patch.gz) to the Sage library repo
-2. [attachment: trac_7494-scripts.patch](https://github.com/sagemath/sage-prod/files/10646850/trac_7494-scripts.patch.gz) to the **scripts** repo
-3. [attachment: trac_7494-root-repo.patch](https://github.com/sagemath/sage-prod/files/10646851/trac_7494-root-repo.patch.gz) to the **Sage root** repository
+2. [attachment: trac_7494-ref.patch](https://github.com/sagemath/sage-prod/files/10646852/trac_7494-ref.patch.gz) to the Sage library repo
+3. [attachment: trac_7494-scripts.patch](https://github.com/sagemath/sage-prod/files/10646850/trac_7494-scripts.patch.gz) to the **scripts** repo
+4. [attachment: trac_7494-root-repo.patch](https://github.com/sagemath/sage-prod/files/10646851/trac_7494-root-repo.patch.gz) to the **Sage root** repository

 **Release Manager:**
jhpalmieri commented 12 years ago

Attachment: trac_7494-ref.patch.gz

Sage library: fix docbuilding problem

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 12 years ago
comment:23

Replying to @jhpalmieri:

I believe this referee patch should fix the documentation problem.

Belief is not a technical category.

Nice patch by the way.

jdemeyer commented 12 years ago

Merged: sage-4.7.2.alpha4

jhpalmieri commented 12 years ago
comment:25

See #11907 for a followup.