未提供项目描述
项目描述
pip-split-requirements
根据正则表达式模式规则拆分pip需求文件。
目录
安装
pipx install pip-split-requirements
快速开始
假设以下requirements.txt
--find-links wheelhouse
pkga
git+https://github.com/some/project
pkgb
运行
pip-split-requirements -g slow:git requirements.txt
将创建requirementsgroup-slow.txt
--find-links wheelhouse
git+https://github.com/some/project
和requirementsgroup-other.txt
--find-links wheelhouse
pkga
pkgb
CLI使用
Usage: pip-split-requirements [OPTIONS] REQUIREMENTS_FILE...
Split a pip requirements file into multiple files according to patterns.
Patterns are regular expressions against which requirement lines are
searched to determine if they belong to a group. Group specs are evaluated
in order, and the first match determines in which group the line goes.
Comment lines are ignored.
Option lines are emitted in all groups.
Arguments:
REQUIREMENTS_FILE... The requirements files to split. If not specified,
they are read from pyproject.toml.
Options:
-g, --group-spec TEXT Group specifications in form name:pattern.
-p, --prefix TEXT Each requirements group file will be named
{prefix}-{group_name}.txt. The prefix can
contain path separators, to generate files
into a chosen directory. [default:
requirementsgroup]
--default-group / --no-default-group
Automatically append a group named 'other',
matching all lines not matched by other
groups. [default: default-group]
--remove-empty / --no-remove-empty
Remove empty requirements group files.
[default: no-remove-empty]
-r, --project-root DIRECTORY The project root directory. The generated
requirements files will be relative to this
directory. Default options and arguments are
read from pyproject.toml in this directory.
[default: .]
--install-completion [bash|zsh|fish|powershell|pwsh]
Install completion for the specified shell.
--show-completion [bash|zsh|fish|powershell|pwsh]
Show completion for the specified shell, to
copy it or customize the installation.
--help Show this message and exit.
在pyproject.toml中的配置
pip-split-requirements
可以使用pyproject.toml
配置。以下值从tool.pip-split_requirements
部分读取
- group_specs: 字符串列表
- prefix: 字符串
- default_group: 布尔值
- remove_empty: 布尔值
- requirements_files: 字符串列表
命令行选项和参数的优先级高于pyproject.toml
值。
以下示例配置将requirements.txt
和requirements-test.txt
拆分为名为vcs
的组,其中包含包含单词git+https
或git+ssh
的需求,以及另一个包含所有其他内容的组,作为build/reqgroup-*.txt
。
[tool.pip-split-requirements]
prefix = "build/reqgroup"
group_specs = ["vcs:git.(https|ssh)"]
requirements_files = ["requirements.txt", "requirements-test.txt"]
作为pre-commit钩子使用
以下.pre-commit-config.yaml
部分的配置将运行pip-split-requirements
。此pre-commit钩子在pyproject.toml
、.pre-commit-config.yaml
或任何匹配模式.*requirement.*\.txt
的文件更改时运行。
- repo: https://github.com/sbidoul/pip-split-requirements
rev: v0.7.0
hooks:
- id: pip-split-requirements
许可证
pip-split-requirements
根据MIT许可证分发。
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源代码发行版
pip_split_requirements-0.7.0.tar.gz (9.2 kB 查看哈希值)
构建发行版
关闭
pip_split_requirements-0.7.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | c3b2cfbbf4f918f03bd042d01863a7bd9b661b2a7c2a52cdccfbb9b32546ed6b |
|
MD5 | 1679ba644d9f12ba7686c928c95fa8fd |
|
BLAKE2b-256 | a782edb25dbab8c688533def9a636db3939d1f3f143747d5e8100b426d46ff7f |
关闭
pip_split_requirements-0.7.0-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | ddcea386300a7adafe09cf302cdb083fa3bb4648db8b66cad266d7c7c20cf7aa |
|
MD5 | 3fae8655e389132648ed29f5937093dd |
|
BLAKE2b-256 | f438c3099b88df50a277e1644f117d540f59f3a17d01d98eb8bcf31358e87b97 |