pip-tools icon indicating copy to clipboard operation
pip-tools copied to clipboard

Get all build dependencies recusively?

Open HiPhish opened this issue 7 months ago • 0 comments

What's the problem this feature will solve?

Hello. I want to be able to build all packages locally from source. To this end I need to download all runtime- and build time dependencies recursively. I thought that pip-tools would be able to compile a complete list of all dependencies, or at least several lists which complement each other.

Describe the solution you'd like

Here is a minimal example pyproject.toml:

[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
requires-python = ">=3.9"
name = "foobar"
version = '0.0.1'
dependencies = ['django', 'twisted']

It depends on Django and Twisted. Twisted depends on Constantly, which depends on Versioneer at build time (versioneer[toml]==0.29 in build-system.requires). My understanding is that the following command should give me all build dependencies:

pip-compile --only-build-deps --all-build-deps pyproject.toml 

However, the output is missing Versioneer:

#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
#    pip-compile --all-build-deps --only-build-deps pyproject.toml
#
packaging==23.2
    # via setuptools-scm
setuptools-scm==8.0.4
    # via foobar (pyproject.toml::build-system.requires)
typing-extensions==4.8.0
    # via setuptools-scm
wheel==0.41.3
    # via
    #   foobar (pyproject.toml::build-system.backend::editable)
    #   foobar (pyproject.toml::build-system.backend::wheel)

# The following packages are considered to be unsafe in a requirements file:
# setuptools

Maybe I am misunderstanding the purpose of --all-build-deps, or maybe there is something off with constantly?

Alternative Solutions

The only alternative I can think of is manually downloading all runtime- and build time dependencies, opening the tarballs, looking for a pyproject.toml in each one, looking for a build-system.requires entry and downloading those, then repeating the process until no new packages get downloaded.

HiPhish avatar Nov 23 '23 17:11 HiPhish