简体   繁体   English

如何将依赖项与requirements.txt分开?

[英]How can I separate out dependencies from requirements.txt?

I am maintaining a requirements.txt file for my Python project, including version numbers and hashes for each package. 我正在为我的Python项目维护一个requirements.txt文件,包括每个软件包的版本号和哈希值。 (This is so I can install with pip install --no-deps --require-hashes .) (因此,我可以使用pip install --no-deps --require-hashes 。)

Some packages in the list are my actual requirements (for example, Sphinx ) while others are just dependencies of those requirements (for example, everything else you get when you pip install Sphinx ). 列表中的某些软件包是我的实际需求(例如Sphinx ),而其他软件包仅仅是这些需求的依赖项(例如,通过pip install Sphinx时获得的所有其他内容)。

I want to maintain this list of requirements separately from those dependencies. 我想与这些依赖项分开维护此需求列表。 How can I do this? 我怎样才能做到这一点?

At the moment I have simply split my requirements into two files (see below, simplified for readability). 目前,我已将需求简单地分为两个文件(请参见下文,简化了可读性)。 But I am not sure how maintainable this will be (false retentions, handling dependency updates...). 但是我不确定这将是多么可维护(错误的保留,处理依赖项更新...)。

requirements.txt requirements.txt

# these are my actual requirements
-r dependencies.txt
Sphinx

dependencies.txt 依靠.txt

# these are the dependencies of my actual requirements
alabaster
Babel
certifi
chardet
docutils
idna
imagesize
Jinja2
MarkupSafe
Pygments
pytz
requests
six
snowballstemmer
sphinxcontrib-websupport
urllib3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何下载requirements.txt? - How can i download requirements.txt? 如何从Apache Airflow中的requirements.txt安装依赖 - How to install dependencies from requirements.txt in Apache Airflow 如何让 pip 忽略 requirements.txt 文件中单个依赖项的所有子依赖项? - How can I have pip ignore all of the sub dependencies of a single dependency in a requirements.txt file? [Dockerfile中的Python],如何找出“ Requirements.txt”文件中软件包的正确顺序? - [Python in Dockerfile], how can I find out what is the correct order of packages in the “Requirements.txt” file? 如何合并多个 python requirements.txt 文件? - How can I merge multiple python requirements.txt files? 如何在 Google colab 中创建 requirements.txt? - How can I create a requirements.txt in Google colab? requirements.txt 中的依赖关系描述 - Description of dependencies in requirements.txt 如何根据本地目录中的 requirements.txt 文件使用 pip 安装软件包? - How can I install packages using pip according to the requirements.txt file from a local directory? 如何从存储库中删除带有Django项目的virtualenv并添加requirements.txt文件? - How can I delete virtualenv with Django project from repository and add requirements.txt file? 如何从docker-compose安装requirements.txt? - How can I install requirements.txt from docker-compose?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM