pooch管理python库的示例数据文件:它自动下载并存储在本地目录中,支持版本控制和损坏检查。

pooch的Python项目详细描述


Pooch

Documentation| Documentation (dev version)| Contact| Fatiando a Terra项目的一部分

Latest version on PyPILatest version on conda-forgeTravisCI build statusAzure Pipelines build statusTest coverage statusCompatible Python versions.Chat room on Gitter

python 2.7只支持到2019年秋季。

tl;dr

"""
Module mypackage/datasets.py
"""importpooch# Get the version string from your project. You have one of these, right?from.importversion# Create a new friend to manage your sample data storageGOODBOY=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 memorydeffetch_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/etcdata=...returndata

关于

您的python包是否包含示例数据集?你是不是带着密码发货? 他们变得太大了吗?

pooch将管理通过http从服务器下载示例数据文件并存储 它们位于本地目录中:

  • 仅当文件不在本地存储中时才下载该文件。
  • 检查SHA256哈希以确保文件未损坏或需要更新。
  • 如果哈希与注册表不同,pooch将下载 文件。
  • 如果哈希值仍然不匹配,pooch将发出异常警告 数据损坏。

使用pooch的项目

如果您正在使用pooch,请向我们发送一个pull请求,将您的项目添加到列表中。

联系我们

贡献

行为准则

请注意,此项目发布时 Contributor Code of Conduct。 通过参与这个项目,你同意遵守它的条款。

贡献准则

请阅读我们的 Contributing Guide 看看你能如何提供帮助和反馈。

冒名顶替综合症免责声明

我们需要您的帮助。不,真的。

你脑子里可能有个声音在告诉你 还没有准备好成为一个开源贡献者;你的技能还不够好 足以做出贡献。 你能提供什么?

我们向你保证你脑子里的声音是错的。

成为贡献者不仅仅意味着编写代码。 平等的重要贡献包括: 编写或校对文档,建议或实施测试,或 甚至对项目给出反馈(包括对 贡献过程)。 如果你以新的眼光来看这个项目,你可能会看到错误和 经验丰富的贡献者掩盖的假设。 如果您可以编写任何代码,那么您可以为开源贡献代码。 我们不断尝试新技能,犯错误,并从中学习 那些错误。 我们都是这样进步的,我们乐于帮助别人学习。

此免责声明改编自MetPy project

许可证

这是一个自由软件:你可以根据条款重新发布和/或修改它 bsd 3子句许可证的。本许可证副本见 LICENSE.txt

其他版本的文档

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Grails2.1.0/Java7在Windows8.1上从何处获取当前用户名?   JavaSpringJMSActiveMQ   java异常处理,捕获导致while循环停止   sql server 2008将日期时间解析为JAVA日期   java是第一个servlet,但无法打开它   如何在Java中使用XML bean创建典型的XML头?   java将iOs应用程序转换为Android   java将jsp页面内容读取到其他jsp页面中的html   客户端计算机中小型数据库应用程序的java实现   java同步和ServletContextListener   安卓 Java将所有转义字符替换为双转义   当我在布局单元中实现ScrollView时,java GridView的setOnItemLongClickListener不起作用(使用适配器)   禁用Java web服务端点Wsdl   java如何编写一个程序来反转用户输入的数字