get_sample_data and transitioning to git

John Hunter <jdh2358@...149...> writes:

Has it been decided where the master repository would be hosted? The
current code seems to handle at least github just fine if you just
replace the base URL in cbook.py:

We've been planning on using github. I'm surprised the existing code
works -- have you tested to see whether the cacheing w/ revision
number works under github, ie it only pulls down new data when the
revision number changes?

Yes. The code is essentially a simple HTTP client, and it works right on
account of the logic at the server. The server sets an ETag header when
it sends a file, and on further requests replies with 304 Not Modified
if the client knows the current ETag value, or with 200 OK if the value
is stale.

For example, running the date_index_formatter.py example with
verbose=debug and an empty cache directory:

ViewVCCachedServer: files listed in cache.pck: set()
ViewVCCachedServer: files in cache directory: set()
ViewVCCachedServer: retrieving http://github.com/jkseppan/mpl-sample-data/raw/master/aapl.csv
ViewVCCachedServer: received response 200: OK
loading /Users/jks/.matplotlib/sample_data/aapl.csv

Next run:

ViewVCCachedServer: files listed in cache.pck: set(['/Users/jks/.matplotlib/sample_data/aapl.csv'])
ViewVCCachedServer: files in cache directory: set(['/Users/jks/.matplotlib/sample_data/cache.pck', '/Users/jks/.matplotlib/sample_data/aapl.csv'])
ViewVCCachedServer: retrieving http://github.com/jkseppan/mpl-sample-data/raw/master/aapl.csv
ViewVCCachedServer: received response 304: Not Modified
ViewVCCachedServer: reading data file from cache file "/Users/jks/.matplotlib/sample_data/aapl.csv"
loading /Users/jks/.matplotlib/sample_data/aapl.csv

Then, after committing a new version in the repository:

ViewVCCachedServer: files listed in cache.pck: set(['/Users/jks/.matplotlib/sample_data/aapl.csv'])
ViewVCCachedServer: files in cache directory: set(['/Users/jks/.matplotlib/sample_data/cache.pck', '/Users/jks/.matplotlib/sample_data/aapl.csv'])
ViewVCCachedServer: retrieving http://github.com/jkseppan/mpl-sample-data/raw/master/aapl.csv
ViewVCCachedServer: received response 200: OK
loading /Users/jks/.matplotlib/sample_data/aapl.csv

···

--
Jouni K. Seppänen