官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 景东| 宜君县| 永州市| 绥芬河市| 牡丹江市| 富川| 渭南市| 崇左市| 东方市| 义马市| 河津市| 石景山区| 科尔| 陆丰市| 瓦房店市| 松江区| 蓝田县| 鱼台县| 卢湾区| 台湾省| 团风县| 沾益县| 武清区| 乌海市| 阿荣旗| 内黄县| 自治县| 湟中县| 长阳| 九龙坡区| 石泉县| 宜宾市| 平罗县| 石嘴山市| 兴安盟| 宜兴市| 正蓝旗| 突泉县| 徐州市| 宣化县| 晋中市|