- Secret Recipes of the Python Ninja
- Cody Jackson
- 216字
- 2021-06-25 22:14:41
Using local patches and constraint files
The benefit of open-source software is the ability to view and modify source code. If you are working on a project and create a local version of a PyPI module, such as customizing for a project or creating a patch, requirements.txt can be used to override the normal download of the file.
Constraints files are a modification of requirements files that simply indicate what version of a library is installed, but they don't actually control the installation of files.
One example of using a constraints file is when using a local patched version of a PyPI module, for example, ReqFile. Some software packages downloaded from PyPI rely on ReqFile, but other packages don't. Rather than writing a requirements file for every single package from PyPI that depends on ReqFile, a constraints file can be created as a master record and implemented across all Python projects. Any package being installed that requires ReqFile will see the constraints file and install from the local repository, rather than from PyPI.
In this manner, a single file can be used by every developer and it no longer matters what a PyPI package depends on; the correct version will either be pulled down from PyPI, or the local version will be used as needed.
- 程序員面試筆試寶典(第3版)
- Spring 5.0 Microservices(Second Edition)
- Learning Flask Framework
- Unity Virtual Reality Projects
- Ray分布式機器學習:利用Ray進行大模型的數據處理、訓練、推理和部署
- bbPress Complete
- Visual FoxPro程序設計習題集及實驗指導(第四版)
- 智能手機APP UI設計與應用任務教程
- HTML5權威指南
- .NET 4.5 Parallel Extensions Cookbook
- Java語言程序設計實用教程(第2版)
- AngularJS UI Development
- C語言從入門到精通(視頻實戰版)
- Python程序設計教程
- Android開發權威指南(第二版)