- 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.
- UI圖標創意設計
- UNIX編程藝術
- DevOps for Networking
- 青少年軟件編程基礎與實戰(圖形化編程三級)
- Django:Web Development with Python
- INSTANT Weka How-to
- Internet of Things with Intel Galileo
- Android玩家必備
- Spring技術內幕:深入解析Spring架構與設計原理(第2版)
- 人工智能算法(卷1):基礎算法
- ASP.NET Web API Security Essentials
- Learning Jakarta Struts 1.2: a concise and practical tutorial
- Python機器學習與量化投資
- Python全棧開發:基礎入門
- JavaEE架構與程序設計