- 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.
- Java逍遙游記
- Mastering Ubuntu Server
- Mastering Python High Performance
- Mastering openFrameworks:Creative Coding Demystified
- Kotlin開發教程(全2冊)
- Access 2010中文版項目教程
- Django實戰:Python Web典型模塊與項目開發
- Python編程入門(第3版)
- Google Maps JavaScript API Cookbook
- JavaScript Unit Testing
- 青少年Python趣味編程
- 計算思維與Python編程
- ASP.NET jQuery Cookbook(Second Edition)
- Django 2.0 入門與實踐
- Visual Basic 開發從入門到精通