跳转到主要内容

Hatchling插件,用于从requirements.txt读取项目依赖项

项目描述

Hatchling插件,用于从requirements.txt读取项目依赖项

测试

Linux Test Status Windows Test Status macOS Test Status Coverage

PyPI

PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel

Anaconda

Conda - Package Version Conda - Platform

活动

GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads

QA

CodeFactor Grade Flake8 Status mypy status

其他

Hatch project License GitHub top language Requirements Status

使用说明

在你的 pyproject.toml 中进行以下更改

  • hatch-requirements-txt 添加到 build-system.requires

  • "dependencies" 添加到 project.dynamic

  • 添加以下表格

[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]

生成的 pyproject.toml 应该看起来像

[build-system]
requires = ["hatchling", "hatch-requirements-txt"]
build-backend = "hatchling.build"

[project]
name = "my-project"
version = "1.0.0"
dynamic = ["dependencies"]

[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]

您还可以通过将 optional-dependencies 添加到 project.dynamic 并添加一个类似表格来定义可选依赖项组(也称为“功能”)

[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
crypto = ["requirements-crypto.txt"]
fastjson = ["requirements-fastjson.txt"]
cli = ["requirements-cli.txt"]

需求文件格式

hatch-requirements-txt 仅支持 pip 所支持的 requirements.txt 格式 的子集。以下是被支持的:

  • 需求指定,按照 PEP 508 规范。

  • 注释,以 # 开头。

  • --<option> 选项,可以单独一行,也可以在需求指定器之后。但请注意,这些选项本身是被忽略的。

以下在 requirements.txt 文件中不被支持:

  • 带有 -e 选项的可编辑安装命令,

  • 使用 -r-c 选项引用其他需求或约束文件。

  • 引用本地文件系统上的路径或 URL。

TL;DR 为了最佳兼容性,请确保您的 requirements.txt 文件中的所有行都是有效的 PEP 508 需求,或者以 # 开头的注释。

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分布

hatch_requirements_txt-0.4.1.tar.gz (6.5 kB 查看哈希值)

上传时间

构建分布

hatch_requirements_txt-0.4.1-py3-none-any.whl (7.8 kB 查看哈希值)

上传时间 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面