Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Pooch

A friend to fetch your sample data files.

Documentation | Contact | Part of the Fatiando a Terra project

Latest version on PyPI TravisCI build status AppVeyor build status Test coverage status Compatible Python versions. Chat room on Gitter

TL;DR

"""
Module mypackage/datasets.py
"""
import pooch

# Get the version string from your project. You have one of these, right?
from . import version


# Create a new friend to manage your sample data storage
GOODBOY = pooch.create(
    # Folder where the data will be stored. For a sensible default, use the default
    # cache folder for your OS.
    path=pooch.os_cache("mypackage"),
    # Base URL of the remote data store. Will call .format on this string to insert
    # the version (see below).
    base_url="https://github.com/myproject/mypackage/raw/{version}/data/",
    # Pooches are versioned so that you can use multiple versions of a package
    # simultaneously. Use PEP440 compliant version number. The version will be
    # appended to the path.
    version=version,
    # If a version as a "+XX.XXXXX" suffix, we'll assume that this is a dev version
    # and replace the version with this string.
    version_dev="master",
    # An environment variable that overwrites the path.
    env="MYPACKAGE_DATA_DIR",
    # The cache file registry. A dictionary with all files managed by this pooch.
    # Keys are the file names (relative to *base_url*) and values are their
    # respective SHA256 hashes. Files will be downloaded automatically when needed
    # (see fetch_gravity_data).
    registry={"gravity-data.csv": "89y10phsdwhs09whljwc09whcowsdhcwodcy0dcuhw"}
)
# You can also load the registry from a file. Each line contains a file name and
# it's sha256 hash separated by a space. This makes it easier to manage large
# numbers of data files. The registry file should be in the same directory as this
# module.
GOODBOY.load_registry("registry.txt")


# Define functions that your users can call to get back some sample data in memory
def fetch_gravity_data():
    """
    Load some sample gravity data to use in your docs.
    """
    # Fetch the path to a file in the local storae. If it's not there, we'll
    # download it.
    fname = GOODBOY.fetch("gravity-data.csv")
    # Load it with numpy/pandas/etc
    data = ...
    return data

About

Does your Python package include sample datasets? Are you shipping them with the code? Are they getting too big?

Pooch will manage downloading your sample data files over HTTP from a server and storing them in a local directory:

  • Download a file only if it’s not in the local storage.

  • Check the SHA256 hash to make sure the file is not corrupted or needs updating.

  • If the hash is different from the registry, Pooch will download a new version of the file.

  • If the hash still doesn’t match, Pooch will raise an exception warning of possible data corruption.

Contacting Us

Contributing

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Contributing Guidelines

Please read our Contributing Guide to see how you can help and give feedback.

Imposter syndrome disclaimer

We want your help. No, really.

There may be a little voice inside your head that is telling you that you’re not ready to be an open source contributor; that your skills aren’t nearly good enough to contribute. What could you possibly offer?

We assure you that the little voice in your head is wrong.

Being a contributor doesn’t just mean writing code. Equality important contributions include: writing or proof-reading documentation, suggesting or implementing tests, or even giving feedback about the project (including giving feedback about the contribution process). If you’re coming to the project with fresh eyes, you might see the errors and assumptions that seasoned contributors have glossed over. If you can write any code at all, you can contribute code to open source. We are constantly trying out new skills, making mistakes, and learning from those mistakes. That’s how we all improve and we are happy to help others learn.

This disclaimer was adapted from the MetPy project.

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.

Metadata

Release files for pooch 0.1a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pooch 0.1a3
File Size Uploaded Provenance Actions
pooch-0.1a3.tar.gz 35.9 kB Without provenance Details for pooch-0.1a3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pooch 0.1a3
File Interpreter ABI Platform Actions
pooch-0.1a3-py3-none-any.whl Python 3 none any Details for pooch-0.1a3-py3-none-any.whl

Total release size: 50.6 kB

Release files / pooch-0.1a3.tar.gz

Download URL pooch-0.1a3.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
24462cb476b256ef305bdf8112011b8c62cfb5183963257dbd633210cec7c043
BLAKE2b-256 checksum
How to use checksums
1bdc71fde2d271d2e74ce469fe142a9667aac1371037706e1d7bd86e81d013a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

Release files / pooch-0.1a3-py3-none-any.whl

Download URL pooch-0.1a3-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1b7166a28e4c80393ffeb5ef1b297d07be7a46d61a98300e35e1eacbb9941e7
BLAKE2b-256 checksum
How to use checksums
7186f0fd55c2e2799f09dd15c54b141d3109b3ca8aa24c0f79b516f59b26f727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

Security for pooch 0.1a3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page