Ask Your Question
1

What is the standard pickle jar for and how do I update it

asked 2010-09-16 22:32:18 -0600

jsrn gravatar image

updated 2015-01-13 14:17:54 -0600

FrédéricC gravatar image

I started Trac #9907, which basically consists of a relocation of some general decorators into sage.misc.decorators. However, after applying the patch, the doctest for sage.structure.sage_object.unpickle_all fails. It seems to be because there is a standard pickle jar which still contains the information that the decorators are located in sage.plot.misc.

Is it correct that there is such a pickle jar? In that case, what for, and how do I get about updating it and fixing my patch?

Cheers, Johan

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
3

answered 2010-09-19 10:43:31 -0600

Mike Hansen gravatar image

The pickle jar contains old pickles of objects that we want to ensure work in the future. For example, if you made the changes at 9907 as the are, then possibly many pickles out in the wild would break. Instead of trying to update the pickle jar, the appropriate thing to do would be to add the following to sage/plot/misc.py

#For backward compatibility -- see #9907.
from sage.misc.decorators import options, suboptions, rename_keyword

That way, the old pickles will still work as they will still be able to find the decorators in sage.plot.misc.

edit flag offensive delete link more
1

answered 2010-09-17 01:39:49 -0600

niles gravatar image

updated 2010-09-17 05:30:16 -0600

Have you looked at the examples section of unpickle_all? I noticed the following there:

We unpickle the standard pickle jar. This doctest tests that all “standard pickles” unpickle. Every so often the standard pickle jar should be updated by running the doctest suite with the environment variable SAGE_PICKLE_JAR set, then copying the files from SAGE_ROOT/tmp/pickle_jar* into the standard pickle jar.

But I don't know much about pickling, so I don't know if this actually answers your question! Anyway, I hope it's helpful :)


EDIT: Judging by the docstring, I think the "standard pickle jar" is the contents of SAGE_DATA/extcode/pickle_jar/pickle_jar.tar.bz2:

sage: std = os.environ['SAGE_DATA'] + '/extcode/pickle_jar/pickle_jar.tar.bz2'
sage: std
'/Applications/sage/data/extcode/pickle_jar/pickle_jar.tar.bz2'

testing this:

$ cd $SAGE_ROOT/devel/sage
$ export SAGE_PICKLE_JAR="pickle"
$ sage -t sage/rings/power_series_ring*
sage -t  "devel/sage-main/sage/rings/power_series_ring.py"  
     [4.3 s]
sage -t  "devel/sage-main/sage/rings/power_series_ring_element.pyx"
     [3.3 s]

----------------------------------------------------------------------
All tests passed!
Total time for all tests: 7.7 seconds

$ ls ../../tmp/pickle_jar*
_class__sage_rings_power_series_ring_PowerSeriesRing_domain__.sobj
_class__sage_rings_power_series_ring_PowerSeriesRing_domain__.txt
_class__sage_rings_power_series_ring_PowerSeriesRing_over_field__.sobj
_class__sage_rings_power_series_ring_PowerSeriesRing_over_field__.txt
_type__sage_rings_power_series_poly_PowerSeries_poly__.sobj
_type__sage_rings_power_series_poly_PowerSeries_poly__.txt

And this looks a lot like the contents of pickle_jar.tar.bz2.

So I guess all you have to do is add whatever new things are generated by your code to the pickle jar file (or maybe replace existing things with the new things).

edit flag offensive delete link more

Comments

Thanks for the reference Niles, but yes, I have looked at that example, but I didn't really understand it; first off, I don't know where the standard pickle jar is :)

jsrn gravatar imagejsrn ( 2010-09-17 03:11:19 -0600 )edit

Ok, that would be great. So in an actual patch, I would also post a whole new piclee_jar.tar.bz2 file with the patch? Or I would leave a note with the patch for reviewers and the release manager that this picle_jar.tar.bz2 should be remade? Probably the latter...

jsrn gravatar imagejsrn ( 2010-09-17 09:51:27 -0600 )edit

I guess I don't know what you should put up with the patch . . . you're probably right, and reviewers can ask you to upload the file if they want. On the other hand, you have to make the file anyway to test your code, so you might as well upload it and make life a little easier for everyone :)

niles gravatar imageniles ( 2010-09-17 10:12:42 -0600 )edit

See my answer -- you don't want to make a new pickle jar unless you explicitly decide that you need to break old pickles. This should not be done lightly, especially when there is a trival fix.

Mike Hansen gravatar imageMike Hansen ( 2010-09-19 11:06:52 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2010-09-16 22:32:18 -0600

Seen: 569 times

Last updated: Sep 19 '10