将上游conda通道镜像到本地目录

conda-mirror的Python项目详细描述


康达镜

Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.Build StatusPyPI versioncodecov

将上游conda通道镜像到本地目录。

安装

conda-mirror在pypi和conda forge上可用。

安装时使用:

pip install conda-mirror

或:

conda install conda-mirror -c conda-forge

兼容性

conda-mirror故意是一个仅限py3的包

cli

用于conda-mirror.py

的cli接口
usage: conda-mirror [-h] [--upstream-channel UPSTREAM_CHANNEL]
                    [--target-directory TARGET_DIRECTORY]
                    [--temp-directory TEMP_DIRECTORY] [--platform PLATFORM]
                    [-v] [--config CONFIG] [--pdb] [--num-threads NUM_THREADS]
                    [--version] [--dry-run] [--no-validate-target]
                    [--minimum-free-space MINIMUM_FREE_SPACE]

CLI interface for conda-mirror.py

optional arguments:
  -h, --help            show this help message and exit
  --upstream-channel UPSTREAM_CHANNEL
                        The target channel to mirror. Can be a channel on
                        anaconda.org like "conda-forge" or a full qualified
                        channel like "https://repo.continuum.io/pkgs/free/"
  --target-directory TARGET_DIRECTORY
                        The place where packages should be mirrored to
  --temp-directory TEMP_DIRECTORY
                        Temporary download location for the packages. Defaults
                        to a randomly selected temporary directory. Note that
                        you might need to specify a different location if your
                        default temp directory has less available space than
                        your mirroring target
  --platform PLATFORM   The OS platform(s) to mirror. one of: {'linux-64',
                        'linux-32','osx-64', 'win-32', 'win-64'}
  -v, --verbose         logging defaults to error/exception only. Takes up to
                        three '-v' flags. '-v': warning. '-vv': info. '-vvv':
                        debug.
  --config CONFIG       Path to the yaml config file
  --pdb                 Enable PDB debugging on exception
  --num-threads NUM_THREADS
                        Num of threads for validation. 1: Serial mode. 0: All
                        available.
  --version             Print version and quit
  --dry-run             Show what will be downloaded and what will be removed.
                        Will not validate existing packages
  --no-validate-target  Skip validation of files already present in target-
                        directory
  --minimum-free-space MINIMUM_FREE_SPACE
                        Threshold for free diskspace. Given in megabytes.

示例用法

警告:调用此命令将拉~10gb并至少需要一小时

conda-mirror --upstream-channel conda-forge --target-directory local_mirror --platform linux-64

更多详细信息

黑名单/白名单配置

示例-conf.yaml:

blacklist:-license:"*agpl*"-license:None-license:""whitelist:-name:system

blacklist删除与 上游回购数据。

whitelistre包含黑名单中与 白名单条件。

黑名单和白名单都有字典列表。里面的钥匙 字典必须是repodata.json元数据中的值。价值观是 (Unix)要匹配的全局。点击此处获取上游的全部回购数据 “默认”频道: http://conda.anaconda.org/anaconda/linux-64/repodata.json

以下是repodata['packages']中某个条目的内容

{'botocore-1.4.10-py34_0.tar.bz2':{'arch':'x86_64','binstar':{'channel':'main','owner_id':'55fc8527d3234d09d4951c71','package_id':'56b88ea1be1cc95a362b218e'},'build':'py34_0','build_number':0,'date':'2016-04-11','depends':['docutils >=0.10','jmespath >=0.7.1,<1.0.0','python 3.4*','python-dateutil >=2.1,<3.0.0'],'license':'Apache','md5':'b35a5c1240ba672e0d9d1296141e383c','name':'botocore','platform':'linux','requires':[],'size':1831799,'version':'1.4.10'}}

有关更多信息,请参见conda_mirror:match函数中的实现详细信息 信息。

常用用法模式

镜像仅限一个特定包

如果您想将上面列出的botocore包与您的 配置,然后您可以使用以下配置来第一个黑名单 all包,然后只包括botocore包:

blacklist:-name:"*"whitelist:-name:botocoreversion:1.4.10build:py34_0
镜像除AGPL许可证以外的所有内容
blacklist:-license:"*agpl*"
仅镜像python 3包
blacklist:-name:"*"whitelist:-build:"*py3*"

测试

安装测试要求

注意:将从pip安装软件包

$ pip install -r test-requirements.txt
Requirement already satisfied: pytest in /home/edill/miniconda/lib/python3.5/site-packages (from -r test-requirements.txt (line 1))
Requirement already satisfied: coverage in /home/edill/miniconda/lib/python3.5/site-packages (from -r test-requirements.txt (line 2))
Requirement already satisfied: pytest-ordering in /home/edill/miniconda/lib/python3.5/site-packages (from -r test-requirements.txt (line 3))
Requirement already satisfied: py>=1.4.29 in /home/edill/miniconda/lib/python3.5/site-packages (from pytest->-r test-requirements.txt (line 1))

运行测试,使用coverage工具调用。

$ coverage run run_tests.py
sys.argv=['run_tests.py']
========================================= test session starts ==========================================
platform linux -- Python 3.5.3, pytest-3.0.6, py-1.4.31, pluggy-0.4.0 -- /home/edill/miniconda/bin/python
cachedir: .cache
rootdir: /home/edill/dev/maxpoint/github/conda-mirror, inifile:
plugins: xonsh-0.5.2, ordering-0.4
collected 4 items

test/test_conda_mirror.py::test_match PASSED
test/test_conda_mirror.py::test_cli[https://repo.continuum.io/pkgs/free-linux-64] PASSED
test/test_conda_mirror.py::test_cli[conda-forge-linux-64] PASSED
test/test_conda_mirror.py::test_handling_bad_package PASSED

======================================= 4 passed in 4.41 seconds =======================================

显示覆盖率统计信息

$ coverage report -m
Name                           Stmts   Miss  Cover   Missing
------------------------------------------------------------
conda_mirror/__init__.py           3      0   100%
conda_mirror/conda_mirror.py     236     20    92%   203-205, 209-210, 214, 240, 249-254, 262-264, 303, 366, 497, 542-543, 629
------------------------------------------------------------
TOTAL                            239     20    92%

其他

在一个新的贡献者提出请求并获得批准后,我们将联系 并邀请您成为项目的维护者。

释放

要释放您需要三件事

  1. 向Conda Mirror提交权限
  2. github令牌
  3. 要用于新标记的版本号

完成这三件事之后,运行release.sh脚本(在unix机器上)并 将要使用的标记和github令牌传递给它:

GITHUB_TOKEN=<github_token> ./release.sh <tag>

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

推荐PyPI第三方库


热门话题
java如何在数据库中插入行时自动发送电子邮件?   从进程输出读取的Java问题   java质疑StyledDocument和JTextPane之间的关系,以及接口的正确使用   java错误getPlayer(args[0]);   java如何使Spring引导在重新打包的WAR中包含清单文件?   Java中的除法与模   java使用2d数组和JfreeChart制作散点图   java扩展SonarQube FindBugs插件和自定义FindBugs插件   javaspring:hibernate+ehcache   具有不正确的equals和HashCode实现的java HashMap   java Jaspersoft报告网。旧金山。jasperreports。发动机例外:net。旧金山。jasperreports。发动机填满JRepressionEvalException:计算表达式时出错   java如果输入与其变量不匹配,如何添加错误   在java中使用简单数组[]实现队列   无法启动上下文路径/hsx上的java FAIL应用程序