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

Refactor the documentation into more dedicated tutorials #237

Merged
merged 28 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
280c844
Move the list of docs links to a separate page
leouieda May 9, 2021
0f0fea1
Include contact info from README in index
leouieda Jun 2, 2021
ba95715
Use a dedicated page for compatibility notes
leouieda Jun 2, 2021
822073d
Move and rename the beginner tutorial
leouieda Jun 2, 2021
8157cb5
Remove the testing section from the install
leouieda Jun 2, 2021
bb43890
Simplify the retrieve tutorial
leouieda Jun 2, 2021
b4465c7
Create a tutorial about using Pooch in a package
leouieda Jun 2, 2021
e784ae5
Tweaks to the retrieve tutorial title
leouieda Jun 2, 2021
a522a8c
Tutorial about sample data management
leouieda Jun 2, 2021
c31d4a4
Create a page about hashes
leouieda Jun 2, 2021
caec7af
Tutorial about setting environment variables
leouieda Jun 2, 2021
996b1ed
Tutorial about registry files
leouieda Jun 2, 2021
38b699f
Tutorial about multiple URLs
leouieda Jun 2, 2021
0a85865
Tutorial on download protocols
leouieda Jun 2, 2021
d7d913c
Put a warning about subdirectories in the registry
leouieda Jun 2, 2021
162d131
Tutorial on progress bars
leouieda Jun 2, 2021
b3db7a9
Include download retry in basic setup
leouieda Jun 2, 2021
bb54f70
Move tutorial on creating registry from remote
leouieda Jun 2, 2021
c613e81
Tutorial on logging
leouieda Jun 2, 2021
f95539b
Tutorial on authentication
leouieda Jun 2, 2021
409e739
Fix wrong link to retrieve
leouieda Jun 2, 2021
f8dbcad
Dedicated pages for auth, unpacking, and decompressing
leouieda Jun 2, 2021
0f5a66c
Add note about install commands running in a terminal
leouieda Jun 3, 2021
4259950
Clarify links and description of optional dependencies
leouieda Jun 3, 2021
d172958
Link to other pages from the retrieve tutorial
leouieda Jun 3, 2021
7bc5105
Better links to other sections
leouieda Jun 3, 2021
93be11c
Consistent naming of sections for processors
leouieda Jun 3, 2021
fafea08
Include citation reference in front page
leouieda Jun 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Part of the `Fatiando a Terra <https://www.fatiando.org>`__ project
:alt: Digital Object Identifier for the JOSS paper
:target: https://doi.org/10.21105/joss.01943

.. placeholder-for-doc-index
.. placeholder-doc-index-start


About
Expand Down Expand Up @@ -165,6 +165,9 @@ Contacting Us
ask questions and leave comments.


.. placeholder-doc-index-end


Citing Pooch
------------

Expand Down Expand Up @@ -226,31 +229,5 @@ License
-------

This is free software: you can redistribute it and/or modify it under the terms
of the **BSD 3-clause License**. A copy of this license is provided in
`LICENSE.txt <https://github.com/fatiando/pooch/blob/master/LICENSE.txt>`__.


Documentation for other versions
--------------------------------

* `Development <https://www.fatiando.org/pooch/dev>`__ (reflects the *master* branch on
Github)
* `Latest release <https://www.fatiando.org/pooch/latest>`__
* `v1.3.0 <https://www.fatiando.org/pooch/v1.3.0>`__
* `v1.2.0 <https://www.fatiando.org/pooch/v1.2.0>`__
* `v1.1.1 <https://www.fatiando.org/pooch/v1.1.1>`__
* `v1.1.0 <https://www.fatiando.org/pooch/v1.1.0>`__
* `v1.0.0 <https://www.fatiando.org/pooch/v1.0.0>`__
* `v0.7.1 <https://www.fatiando.org/pooch/v0.7.1>`__
* `v0.7.0 <https://www.fatiando.org/pooch/v0.7.0>`__
* `v0.6.0 <https://www.fatiando.org/pooch/v0.6.0>`__
* `v0.5.2 <https://www.fatiando.org/pooch/v0.5.2>`__
* `v0.5.1 <https://www.fatiando.org/pooch/v0.5.1>`__
* `v0.5.0 <https://www.fatiando.org/pooch/v0.5.0>`__
* `v0.4.0 <https://www.fatiando.org/pooch/v0.4.0>`__
* `v0.3.1 <https://www.fatiando.org/pooch/v0.3.1>`__
* `v0.3.0 <https://www.fatiando.org/pooch/v0.3.0>`__
* `v0.2.1 <https://www.fatiando.org/pooch/v0.2.1>`__
* `v0.2.0 <https://www.fatiando.org/pooch/v0.2.0>`__
* `v0.1.1 <https://www.fatiando.org/pooch/v0.1.1>`__
* `v0.1 <https://www.fatiando.org/pooch/v0.1>`__
of the `BSD 3-clause License <https://github.com/fatiando/pooch/blob/master/LICENSE.txt>`__.
A copy of this license is provided with distributions of the software.
170 changes: 0 additions & 170 deletions doc/advanced.rst

This file was deleted.

4 changes: 2 additions & 2 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _api:

API Reference
=============
List of functions and classes (API)
===================================

.. automodule:: pooch

Expand Down
82 changes: 82 additions & 0 deletions doc/authentication.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
.. _authentication:

Authentication
==============

HTTP authentication
-------------------

Use the :class:`~pooch.HTTPDownloader` class directly to provide login
credentials to HTTP servers that require basic authentication. For example:

.. code:: python

from pooch import HTTPDownloader


def fetch_protected_data():
"""
Fetch a file from a server that requires authentication
"""
# Let the downloader know the login credentials
download_auth = HTTPDownloader(auth=("my_username", "my_password"))
fname = GOODBOY.fetch("some-data.csv", downloader=download_auth)
data = pandas.read_csv(fname)
return data

It's probably not a good idea to hard-code credentials in your code. One way
around this is to ask users to set their own credentials through environment
variables. The download code could look something like so:

.. code:: python

import os


def fetch_protected_data():
"""
Fetch a file from a server that requires authentication
"""
# Get the credentials from the user's environment
username = os.environ.get("SOMESITE_USERNAME")
password = os.environ.get("SOMESITE_PASSWORD")
# Let the downloader know the login credentials
download_auth = HTTPDownloader(auth=(username, password))
fname = GOODBOY.fetch("some-data.csv", downloader=download_auth)
data = pandas.read_csv(fname)
return data


FTP/SFTP with authentication
----------------------------

Pooch also comes with the :class:`~pooch.FTPDownloader` and
:class:`~pooch.SFTPDownloader` downloaders that can be used
when files are distributed over FTP or SFTP (secure FTP).

.. note::

To download files over SFTP,
`paramiko <https://github.com/paramiko/paramiko>`__ needs to be installed.


Sometimes the FTP server doesn't support anonymous FTP and needs authentication
or uses a non-default port.
In these cases, pass in the downloader class explicitly (works with both FTP
and SFTP):

.. code:: python

import os


def fetch_c137():
"""
Load the C-137 sample data as a pandas.DataFrame (over FTP this time).
"""
username = os.environ.get("MYDATASERVER_USERNAME")
password = os.environ.get("MYDATASERVER_PASSWORD")
download_ftp = pooch.FTPDownloader(username=username, password=password)
fname = GOODBOY.fetch("c137.csv", downloader=download_ftp)
data = pandas.read_csv(fname)
return data
Loading