Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ places use the normalized, *canonical name*.
```python
import re


def canonicalize_name(name: str) -> NormalizedName:
return re.sub(r"[-_.]+", "-", name).lower()


def override_name(name: str | NormalizedName) -> str:
return canonicalize_name(name).replace("-", "_")
```
Expand Down Expand Up @@ -456,9 +458,7 @@ def prebuilt_wheel(
dist_version: str,
wheel_filename: pathlib.Path,
):
logger.info(
f"{req.name}: running prebuilt wheel hook for {wheel_filename}"
)
logger.info(f"{req.name}: running prebuilt wheel hook for {wheel_filename}")
```

### post_bootstrap
Expand Down Expand Up @@ -515,14 +515,14 @@ mycommand = "mypackage.module:mycommand"
import click
from fromager import context


@click.command()
@click.argument("example")
@click.pass_obj
def mycommand(
wkctx: context.WorkContext,
example: str,
) -> None:
...
) -> None: ...
```

## See Also
Expand Down
3 changes: 3 additions & 0 deletions docs/http-retry.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ To register authentication for additional hosts:
```python
from fromager.request_session import session_auth


def _resolve_my_auth(scheme: str, hostname: str) -> dict[str, str]:
return {"Authorization": "Bearer my-token"}


session_auth.add("https://my-registry.test", _resolve_my_auth)
```

Expand All @@ -103,6 +105,7 @@ For functions that might fail due to transient errors:
```python
from fromager.http_retry import retry_on_exception, RETRYABLE_EXCEPTIONS


@retry_on_exception(
exceptions=RETRYABLE_EXCEPTIONS,
max_attempts=3,
Expand Down
9 changes: 7 additions & 2 deletions docs/proposals/new-resolver-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,24 @@ from fromager import context, resolver
from packaging.version import Version
def matcher_factory_pat(ctx: context.WorkContext) -> re.Pattern | resolver.MatchFunction:
def matcher_factory_pat(
ctx: context.WorkContext,
) -> re.Pattern | resolver.MatchFunction:
# tag must match 'v1.2+midstream.1.cpu' and results in Version("1.2+midstream.1")
variant = re.escape(ctx.variant)
pat = rf"^v(.*\+midstream\.\d+)\.{variant}$"
return re.compile(pat)
def matcher_factory_func(ctx: context.WorkContext) -> re.Pattern | resolver.MatchFunction:
def matcher_factory_func(
ctx: context.WorkContext,
) -> re.Pattern | resolver.MatchFunction:
def pep440_matcher(identifier: str, item: str) -> Version | None:
try:
return Version(item)
except ValueError:
return None
return pep440_matcher
```

Expand Down
3 changes: 1 addition & 2 deletions docs/proposals/wheel-build-tag-hook.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def build_tag_hook(
req: Requirement,
version: Version,
wheel_tags: frozenset[Tag],
) -> typing.Sequence[str]:
...
) -> typing.Sequence[str]: ...
```

The hook returns `typing.Sequence[str]`, a sequence of suffix segments
Expand Down
2 changes: 1 addition & 1 deletion src/fromager/packagesettings/_pbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, settings: Settings, ps: PackageSettings) -> None:
self._variant_changelog = settings.variant_changelog()
self._max_jobs: int | None = settings.max_jobs
self._ps = ps
self._plugin_module: types.ModuleType | None | typing.Literal[False] = False
self._plugin_module: types.ModuleType | typing.Literal[False] | None = False
self._patches: PatchMap | None = None
self._annotations: Annotations | None = None

Expand Down
Loading