python包用户的常见任务(例如复制示例、获取数据等)

pyct的Python项目详细描述


Pyct

一个实用程序包,包括:

  1. pyct.cmd:使其他命令可用 包装。(目前没有成熟的插件系统,只是一个尝试 导入/在其他包中除外。)相同的命令是 可从python中获得。可以将新子命令添加到 如果模块具有现有的,则存在现有的基于ARGARSE的命令 命令,如果模块没有 现有命令。目前,有用于复制的命令 示例和获取数据。请参见

  2. pyct.build:提供各种命令来帮助打包 建筑,主要是为了方便项目维护人员。

pyct.cmd

使用pyct.cmd所需的依赖项安装pyct:pip install pyct[cmd]conda install -c pyviz pyct

如何在项目中使用的示例: https://github.com/ioam/geoviews/blob/master/geoviews/__main__.py

添加后,用户可以复制包的示例并下载 使用examples命令需要的数据:

$ datashader examples --help
usage: datashader examples [-h] [--path PATH] [-v] [--force] [--use-test-data]

optional arguments:
  -h, --help       show this help message and exit
  --path PATH      location to place examples and data
  -v, --verbose
  --force          if PATH already exists, force overwrite existing examples
                   if older than source examples. ALSO force any existing data
                   files to be replaced
  --use-test-data  Use data's test files, if any, instead of fetching full
                   data. If test file not in '.data_stubs', fall back to
                   fetching full data.

要复制示例,例如datashader,但不下载数据, 有一个copy-examples命令:

usage: datashader copy-examples [-h] [--path PATH] [-v] [--force]

optional arguments:
  -h, --help     show this help message and exit
  --path PATH    where to copy examples
  -v, --verbose
  --force        if PATH already exists, force overwrite existing files if
                 older than source files

要仅下载数据,请使用fetch-data命令:

usage: datashader fetch-data [-h] [--path PATH] [--datasets DATASETS] [-v]
                        [--force] [--use-test-data]

optional arguments:
  -h, --help           show this help message and exit
  --path PATH          where to put data
  --datasets DATASETS  *name* of datasets file; must exist either in path
                       specified by --path or in package/examples/
  -v, --verbose
  --force              Force any existing data files to be replaced
  --use-test-data      Use data's test files, if any, instead of fetching full
                       data. If test file not in '.data_stubs', fall back to
                       fetching full data.

可以指定不同的“数据集”文件:

$ cat earthsim-examples/test.yml
---

data:

  - url: http://s3.amazonaws.com/datashader-data/Chesapeake_and_Delaware_Bays.zip
    title: 'Depth data for the Chesapeake and Delaware Bay region of the USA'
    files:
      - Chesapeake_and_Delaware_Bays.3dm

$ earthsim fetch-data --path earthsim-examples --datasets-filename test.yml
Downloading data defined in /tmp/earthsim-examples/test.yml to /tmp/earthsim-examples/data
Skipping Depth data for the Chesapeake and Delaware Bay region of the USA

通过使用--use-test-data标志,可以使用较小的文件而不是较大的文件 在examples/data/.data_stubs

$ tree examples/data -a
examples/data
├── .data_stubs
│   └── nyc_taxi_wide.parq
└── diamonds.csv

$ cat examples/dataset.yml
data:

  - url: http://s3.amazonaws.com/datashader-data/nyc_taxi_wide.parq
    title: 'NYC Taxi Data'
    files:
      - nyc_taxi_wide.parq

  - url: http://s3.amazonaws.com/datashader-data/maccdc2012_graph.zip
    title: 'National CyberWatch Mid-Atlantic Collegiate Cyber Defense Competition'
    files:
      - maccdc2012_nodes.parq
      - maccdc2012_edges.parq
      - maccdc2012_full_nodes.parq
      - maccdc2012_full_edges.parq

$ pyviz fetch-data --path=examples --use-test-data
Fetching data defined in /tmp/pyviz/examples/datasets.yml and placing in /tmp/pyviz/examples/data
Copying test data file '/tmp/pyviz/examples/data/.data_stubs/nyc_taxi_wide.parq' to '/tmp/pyviz/examples/data/nyc_taxi_wide.parq'
No test file found for: /tmp/pyviz/examples/data/.data_stubs/maccdc2012_nodes.parq. Using regular file instead
Downloading National CyberWatch Mid-Atlantic Collegiate Cyber Defense Competition 1 of 1
[################################] 59/59 - 00:00:00

要清除任何伪装成真实数据的潜在测试文件,请使用clean-data

usage: pyviz clean-data [-h] [--path PATH]

optional arguments:
  -h, --help   show this help message and exit
  --path PATH  where to clean data

pyct.build

当前提供了一种将示例与项目打包的方法,方法是 每当 setup.py已运行。这种工作方式在不久的将来可能会改变 未来,但这是我们迈向未来的第一步 统一/简化一些PYVIZ项目的维护。

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

推荐PyPI第三方库


热门话题
java的目标是从我的项目中删除不起作用的文件   java对for循环的理解   java我完成了在作业要求的位置查找字符的部分,但是如何从我找到的字符串中删除字符呢?   基于帧时的java动画   java请求无效。缺少XGoogUploadCommand标头   java如何在viewsource模式下使用openStream?   grpc grpc_ARG_KEEPALIVE_PERMIT_而不调用java服务器?   java如何通过Junit测试Web服务调用   如何在java中获取鼠标中键?   使用junit在spring测试中加载属性文件   Java中用于类的类修饰符   java多色文本图像   sql无法调试Java中的“连接到数据库失败”异常   java如何指定hibernate连接映射?   java Android工具栏不显示   java仿射转换不同的图形对象   使用终端的java问题   Java在tomcat上查找127.0.0.1失败