Skip to content

Commit 398d948

Browse files
authored
Merge pull request #772 from dhellmann/build-wheel-server
feat: add --build-wheel-server-url option
2 parents ecdc251 + 3ddb38c commit 398d948

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

docs/how-tos/build-web-server.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Using an External Build Web Server
2+
==================================
3+
4+
By default, fromager runs its own internal web server to provide
5+
wheels as build requirements for packages that it builds. It maintains
6+
the content for the server by building or downloading wheels as it
7+
bootstraps or builds packages.
8+
9+
For very large sets of dependencies, the internal web server may not
10+
perform well and will either result in errors in the logs, or
11+
potentially failed builds. In these cases it is straightforward to
12+
tell fromager that another web server is hosting the content that it
13+
is managing, and that it does not need to run an internal server by
14+
using the ``--build-wheel-server-url`` option.
15+
16+
.. code-block:: console
17+
18+
$ fromager --build-wheel-server-url http://localhost:8080/simple/ bootstrap my-package

src/fromager/__main__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
type=clickext.ClickPath(),
8080
help="location to manage wheel repository",
8181
)
82+
@click.option(
83+
"--build-wheel-server-url",
84+
help="An optional URL for external web server for building wheels, to replace the built-in server. Must be configured to serve the path specified for --wheels-repo.",
85+
)
8286
@click.option(
8387
"-t",
8488
"--work-dir",
@@ -149,6 +153,7 @@ def main(
149153
error_log_file: pathlib.Path,
150154
sdists_repo: pathlib.Path,
151155
wheels_repo: pathlib.Path,
156+
build_wheel_server_url: str,
152157
work_dir: pathlib.Path,
153158
patches_dir: pathlib.Path,
154159
settings_file: pathlib.Path,
@@ -215,6 +220,10 @@ def main(
215220
logger.info(f"maximum concurrent jobs: {jobs}")
216221
logger.info(f"constraints file: {constraints_file}")
217222
logger.info(f"network isolation: {network_isolation}")
223+
if build_wheel_server_url:
224+
logger.info(f"external build wheel server: {build_wheel_server_url}")
225+
else:
226+
logger.info("using internal build wheel server")
218227
overrides.log_overrides()
219228
hooks.log_hooks()
220229

@@ -233,6 +242,7 @@ def main(
233242
patches_dir=patches_dir,
234243
sdists_repo=sdists_repo,
235244
wheels_repo=wheels_repo,
245+
wheel_server_url=build_wheel_server_url,
236246
work_dir=work_dir,
237247
cleanup=cleanup,
238248
variant=variant,

src/fromager/context.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def __init__(
4545
network_isolation: bool = False,
4646
max_jobs: int | None = None,
4747
settings_dir: pathlib.Path | None = None,
48+
wheel_server_url: str = "",
4849
):
4950
if active_settings is None:
5051
active_settings = packagesettings.Settings(
@@ -73,7 +74,7 @@ def __init__(
7374
self.work_dir = pathlib.Path(work_dir).resolve()
7475
self.graph_file = self.work_dir / "graph.json"
7576
self.uv_cache = self.work_dir / "uv-cache"
76-
self.wheel_server_url = ""
77+
self.wheel_server_url = wheel_server_url
7778
self.logs_dir = self.work_dir / "logs"
7879
self.cleanup = cleanup
7980
# separate value so bootstrap-parallel can keep build envs

0 commit comments

Comments
 (0)