@@ -53,7 +53,7 @@ package name with the suffix `.yaml`, e.g. `torch.yaml` or
5353### Example config
5454
5555``` shell
56- $ fromager --settings-dir=overrides/settings ...
56+ fromager --settings-dir=overrides/settings ...
5757```
5858
5959``` yaml
@@ -110,7 +110,7 @@ If the `pre_built` field is set for a variant, then fromager pulls and resolves
110110wheels specified in the field from local wheels server spun up by fromager
111111followed by upstream package servers instead of rebuilding the package from source.
112112If an alternate package index is provided in the settings then that is the only
113- index used.
113+ index used.
114114
115115When downloading a prebuilt wheel by hand, make sure that the wheel is
116116placed in the `<path to wheels-repo directory>/prebuilt` directory so that it is
@@ -229,296 +229,7 @@ requires = ["setuptools>=68.0.0", "torch", "triton"]
229229
230230# # Override plugins
231231
232- For more complex customization requirements, create an override plugin.
233-
234- Plugins are registered using [entry
235- points](https://packaging.python.org/en/latest/specifications/entry-points/)
236- so they can be discovered and loaded at runtime. In `pyproject.toml`,
237- configure the entry point in the
238- ` project.entry-points."fromager.project_overrides"` namespace to
239- link the [canonical distribution name](#canonical-distribution-names)
240- to an importable module.
241-
242- ` ` ` toml
243- [project.entry-points."fromager.project_overrides"]
244- flit_core = "package_plugins.flit_core"
245- pyarrow = "package_plugins.pyarrow"
246- torch = "package_plugins.torch"
247- triton = "package_plugins.triton"
248- ` ` `
249-
250- The plugins are treated as providing overriding implementations of
251- functions with default implementations, so it is only necessary to
252- implement the functions needed to make it possible to build the
253- package.
254-
255- # ## download_source
256-
257- The `download_source()` function is responsible for downloading the
258- source from a URL.
259-
260- The arguments are the `WorkContext`, the `Requirement` being
261- evaluated, version of the package being downloaded, the URL
262- from which the source can be downloaded as returned by `resolve_source`,
263- and the output directory in which the source should be downloaded.
264-
265- The return value should be a `pathlib.Path` file path to the downloaded source.
266-
267- ` ` ` python
268- def download_source(ctx, req, version, download_url):
269- ...
270- return path_to_source
271- ` ` `
272-
273- # ## resolve_source
274-
275- The `resolve_source()` function is responsible for resolving a
276- requirement and acquiring the source for that version of a
277- package. The default is to use pypi.org to resolve the requirement.
278-
279- The arguments are the `WorkContext`, the `Requirement` being
280- evaluated, and the URL to the sdist index.
281-
282- The return value is `Tuple[str, Version]` where the first member is
283- the url from which the source can be downloaded and the second member
284- is the version of the resolved package.
285-
286- ` ` ` python
287- def resolve_source(ctx, req, sdist_server_url):
288- ...
289- return (url, version)
290- ` ` `
291-
292- # ## get_resolver_provider
293-
294- (pypi.org)=
295- The `get_resolver_provider()` function allows an override to change
296- the way requirement specifications are converted to fixed
297- versions. The default implementation looks for published versions on a
298- Python package index. Most overrides do not need to implement this
299- hook unless they are building versions of packages not released to
300- [https://pypi.org](pypi.org).
301-
302- For examples, refer to `fromager.resolver.PyPIProvider` and
303- ` fromager.resolver.GitHubTagProvider` .
304-
305- The arguments are the `WorkContext`, the `Requirement` being
306- evaluated, a boolean indicating whether source distributions should be
307- included, a boolean indicating whether built wheels should be
308- included, and the URL for the sdist server.
309-
310- The return value must be an instance of a class that implements the
311- ` resolvelib.providers.AbstractProvider` API.
312-
313- The expectation is that it acts as an engine for any sort of package resolution
314- whether it is for wheels or sources. The provider can
315- therefore use any value as the "URL" that will help it decide what to
316- download. For example, the `GitHubTagProvider` returns the actual tag
317- name in case that is different from the version number encoded within
318- that tag name.
319-
320- ` ` ` python
321- def get_resolver_provider(ctx, req, include_sdists, include_wheels, sdist_server_url):
322- ...
323- ` ` `
324-
325- The `GenericProvider` is a convenient base class, or can be instantiated
326- directly if given a `version_source` callable that returns an iterator of
327- version values as `str` or `Version` objects.
328-
329- ` ` ` python
330- from fromager import resolver
331-
332- VERSION_MAP = {'1.0': 'first-release', '2.0': 'second-release'}
333-
334- def _version_source(
335- identifier: str,
336- requirements: resolver.RequirementsMap,
337- incompatibilities: resolver.CandidatesMap,
338- ) -> typing.Iterable[Version]:
339- return VERSION_MAP.keys()
340-
341-
342- def get_resolver_provider(ctx, req, include_sdists, include_wheels, sdist_server_url):
343- return resolver.GenericProvider(version_source=_version_source, constraints=ctx.constraints)
344- ` ` `
345-
346- # ## prepare_source
347-
348- The `prepare_source()` function is responsible for setting up a tree
349- of source files in a format that is ready to be built. The default
350- implementation unpacks the source archive and applies patches.
351-
352- The arguments are the `WorkContext`, the `Requirement` being
353- evaluated, the `Path` to the source archive, and the version.
354-
355- The return value should be the `Path` to the root of the source tree,
356- ideally inside the `ctx.work_dir` directory.
357-
358- ` ` ` python
359- def prepare_source(ctx, req, source_filename, version):
360- ...
361- return output_dir_name
362- ` ` `
363-
364- # ## expected_source_archive_name
365-
366- The `expected_source_archive_name()` function is used to re-discover a
367- source archive downloaded by a previous step, especially if the
368- filename does not match the standard naming scheme for an sdist.
369-
370- The arguments are the `Requirement` being evaluated and the version to
371- look for.
372-
373- The return value should be a string with the base filename (no paths)
374- for the archive.
375-
376- ` ` ` python
377- def expected_source_archive_name(req, dist_version):
378- return f'apache-arrow-{dist_version}.tar.gz'
379- ` ` `
380-
381- # ## expected_source_directory_name
382-
383- The `expected_source_directory_name()` function is used to re-discover
384- the location of a source tree prepared by a previous step, especially
385- if the name does not match the standard naming scheme for an sdist.
386-
387- The arguments are the `Requirement` being evaluated and the version to
388- look for.
389-
390- The return value should be a string with the name of the source root
391- directory relative to the `ctx.work_dir` where it was prepared.
392-
393- ` ` ` python
394- def expected_source_directory_name(req, dist_version):
395- return f'apache-arrow-{dist_version}/arrow-apache-arrow-{dist_version}'
396- ` ` `
397-
398- # ## get_build_system_dependencies
399-
400- The `get_build_system_dependencies()` function should return the PEP
401- 517 build dependencies for a package.
402-
403- The arguments are the `WorkContext`, the `Requirement` being
404- evaluated, and the `Path` to the root of the source tree.
405-
406- The return value is an iterable of requirement specification strings
407- for build system dependencies for the package. The caller is
408- responsible for evaluating the requirements with the current build
409- environment settings to determine if they are actually needed.
410-
411- ` ` ` python
412- # pyarrow.py
413- def get_build_system_dependencies(ctx, req, sdist_root_dir):
414- # The _actual_ directory with our requirements is different than
415- # the source root directory detected for the build because the
416- # source tree doesn't just include the python package.
417- return dependencies.default_get_build_system_dependencies(
418- ctx, req,
419- sdist_root_dir / 'python',
420- )
421- ` ` `
422-
423- # ## get_build_backend_dependencies
424-
425- The `get_build_backend_dependencies()` function should return the PEP
426- 517 build dependencies for a package.
427-
428- The arguments are the `WorkContext`, the `Requirement` being
429- evaluated, and the `Path` to the root of the source tree.
430-
431- The return value is an iterable of requirement specification strings
432- for build backend dependencies for the package. The caller is
433- responsible for evaluating the requirements with the current build
434- environment settings to determine if they are actually needed.
435-
436- ` ` ` python
437- # pyarrow.py
438- def get_build_backend_dependencies(ctx, req, sdist_root_dir):
439- # The _actual_ directory with our requirements is different than
440- # the source root directory detected for the build because the
441- # source tree doesn't just include the python package.
442- return dependencies.default_get_build_backend_dependencies(
443- ctx, req,
444- sdist_root_dir / 'python',
445- )
446- ` ` `
447-
448- # ## get_build_sdist_dependencies
449-
450- The `get_build_sdist_dependencies()` function should return the PEP 517
451- dependencies for building the source distribution for a package.
452-
453- The return value is an iterable of requirement specification strings
454- for build backend dependencies for the package. The caller is
455- responsible for evaluating the requirements with the current build
456- environment settings to determine if they are actually needed.
457-
458- ` ` ` python
459- # pyarrow.py
460- def get_build_sdist_dependencies(ctx, req, sdist_root_dir):
461- # The _actual_ directory with our requirements is different than
462- # the source root directory detected for the build because the
463- # source tree doesn't just include the python package.
464- return dependencies.default_get_build_sdist_dependencies(
465- ctx, req,
466- sdist_root_dir / 'python',
467- )
468- ` ` `
469-
470- # ## build_sdist
471-
472- The `build_sdist()` function is responsible for creating a new source
473- distribution from the prepared source tree and placing it in `ctx.sdists_build`.
474-
475- The arguments are the `WorkContext`, the `Requirement` being evaluated, and the
476- ` Path` to the root of the source tree.
477-
478- The return value is the `Path` to the newly created source distribution.
479-
480- ` ` ` python
481- # pyarrow.py
482- def build_sdist(ctx, req, sdist_root_dir):
483- return sources.build_sdist(
484- ctx, req,
485- sdist_root_dir / 'python',
486- )
487- ` ` `
488-
489- # ## build_wheel
490-
491- The `build_wheel()` function is responsible for creating a wheel from
492- the prepared source tree and placing it in `ctx.wheels_build`.. The
493- default implementation invokes `pip wheel` in a temporary directory
494- and passes the path to the source tree as argument.
495-
496- The arguments are the `WorkContext`, the `Path` to a virtualenv
497- prepared with the build dependencies, a `dict` with extra environment
498- variables to pass to the build, the `Requirement` being evaluated, and
499- the `Path` to the root of the source tree.
500-
501- The return value is ignored.
502-
503- ` ` ` python
504- def build_wheel(ctx, build_env, extra_environ, req, sdist_root_dir):
505- ...
506- ` ` `
507-
508- # ## add_extra_metadata_to_wheels
509-
510- The `add_extra_metadata_to_wheels()` function is responsible to return any
511- data the user would like to include in the wheels that fromager builds. This
512- data will be added to the `fromager-build-settings` file under the `.dist-info`
513- directory of the wheels. This file already contains the settings used to build
514- that package.
515-
516- The arguments available are `WorkContext`, `Requirement` being evaluated, the resolved
517- ` Version` of that requirement, a `dict` with extra environment variables, a `Path` to
518- the root directory of the source distribution and a `Path` to the `.dist-info` directory
519- of the wheel.
520-
521- The return value must be a `dict`, otherwise it will be ignored.
232+ Override plugins are documented in [the reference guide](hooks.rst).
522233
523234# # Canonical distribution names
524235
0 commit comments