Skip to content

Commit f0a5467

Browse files
committed
Merge branch 'main' into fix-845-package-name-in-exception
2 parents 36d97da + e1479d7 commit f0a5467

59 files changed

Lines changed: 2490 additions & 664 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
if: ${{ !startsWith(github.ref, 'refs/tags') }}
1212

1313
steps:
14-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v6
1515
with:
1616
fetch-depth: 0
1717

@@ -32,7 +32,7 @@ jobs:
3232
if: ${{ !startsWith(github.ref, 'refs/tags') }}
3333

3434
steps:
35-
- uses: actions/checkout@v5
35+
- uses: actions/checkout@v6
3636
with:
3737
fetch-depth: 0
3838

@@ -53,7 +53,7 @@ jobs:
5353
if: ${{ !startsWith(github.ref, 'refs/tags') }}
5454

5555
steps:
56-
- uses: actions/checkout@v5
56+
- uses: actions/checkout@v6
5757
with:
5858
fetch-depth: 0
5959

@@ -74,7 +74,7 @@ jobs:
7474
runs-on: ubuntu-latest
7575
if: ${{ !startsWith(github.ref, 'refs/tags') }}
7676
steps:
77-
- uses: actions/checkout@v5
77+
- uses: actions/checkout@v6
7878
with:
7979
fetch-depth: 0
8080
- uses: articulate/actions-markdownlint@v1.1.0
@@ -90,7 +90,7 @@ jobs:
9090
if: ${{ !startsWith(github.ref, 'refs/tags') }}
9191

9292
steps:
93-
- uses: actions/checkout@v5
93+
- uses: actions/checkout@v6
9494
with:
9595
fetch-depth: 0
9696

@@ -111,11 +111,11 @@ jobs:
111111
if: ${{ !startsWith(github.ref, 'refs/tags') }}
112112

113113
steps:
114-
- uses: actions/checkout@v5
114+
- uses: actions/checkout@v6
115115
with:
116116
fetch-depth: 0
117117
- name: Super-Linter
118-
uses: super-linter/super-linter@v8.2.1 # x-release-please-version
118+
uses: super-linter/super-linter@v8.3.0 # x-release-please-version
119119
env:
120120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121121
# To reuse the same Super-linter configuration that you use in the

.github/workflows/python-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
id-token: write
2020

2121
steps:
22-
- uses: actions/checkout@v5
22+
- uses: actions/checkout@v6
2323
# with:
2424
# fetch-depth: 0
2525
- name: Set up Python

.github/workflows/test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
steps:
2626
- name: Get source
27-
uses: actions/checkout@v5
27+
uses: actions/checkout@v6
2828

2929
- name: Set up Python ${{ matrix.python-version }}
3030
uses: actions/setup-python@v6
@@ -119,7 +119,7 @@ jobs:
119119

120120
steps:
121121
- name: Get source
122-
uses: actions/checkout@v5
122+
uses: actions/checkout@v6
123123

124124
- name: Set up Python ${{ matrix.python-version }}
125125
uses: actions/setup-python@v6
@@ -171,7 +171,7 @@ jobs:
171171
- e2e
172172

173173
steps:
174-
- uses: actions/checkout@v5
174+
- uses: actions/checkout@v6
175175
with:
176176
fetch-depth: 0
177177

AGENTS.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,39 @@ for new contributors.
7676

7777
- **No trailing whitespace**: Ensure no extra spaces at the end of lines
7878
- **No whitespace on blank lines**: Empty lines should contain no spaces or tabs
79-
- **Include a blank line as EOF**: Every file should end with a newline character
79+
- **End files with a single newline**: Each file should end with a single newline character (`\n`). This is a widely adopted convention recommended by PEP 8, Python's style guide. Many Unix-style text editors and tools expect files to end with a newline character and may not handle files without one properly.
8080
- Follow the project's existing code style and indentation patterns
8181
- Use consistent line endings (LF for this project)
8282

83+
### Type Annotations
84+
85+
- **Always add type annotations to all functions**: All functions must include type annotations for parameters and return values
86+
- This applies to regular functions, test functions, class methods, and async functions
87+
- Existing code will be updated gradually; new code must be fully typed
88+
- Follow the existing pattern in the codebase for consistency
89+
- Examples:
90+
91+
```python
92+
def calculate_total(items: list[int]) -> int:
93+
"""Calculate sum of items."""
94+
return sum(items)
95+
96+
def test_my_feature() -> None:
97+
"""Test that my feature works correctly."""
98+
assert my_feature() == expected_result
99+
```
100+
101+
### Code Comments
102+
103+
- **Avoid unnecessary comments**: Write self-documenting code with clear variable names, function names, and structure
104+
- **Only add comments when absolutely necessary**: Comments should be reserved for must-have cases such as:
105+
- Explaining complex algorithms or non-obvious logic
106+
- Documenting "why" decisions were made (not "what" the code does)
107+
- Warning about edge cases or subtle bugs
108+
- Explaining workarounds for external library issues
109+
- **Do not add comments that simply restate what the code does**: The code itself should be clear enough
110+
- **Prefer docstrings over comments**: Use docstrings for functions, classes, and modules to document their purpose and usage
111+
83112
### Testing After Code Changes
84113

85114
After making code changes, run the following tests within a Python virtual environment to ensure code quality:

docs/concepts/dependencies.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Understanding Dependency Types
2+
==============================
3+
4+
Fromager tracks 5 dependency types, grouped into build-time and runtime categories.
5+
6+
Requirement Types
7+
-----------------
8+
9+
**Build-Time** (must be built before parent):
10+
11+
- ``build-system`` — From ``pyproject.toml`` ``[build-system].requires`` with a fallback to a default provider (see PEP 517)
12+
- ``build-backend`` — Returned by Fromager hooks, which call PEP 517 hooks like ``get_requires_for_build_wheel`` by default
13+
- ``build-sdist`` — Returned by Fromager hooks, which call PEP 517 hooks by default
14+
15+
.. note::
16+
17+
Both backend and sdist requirements are built before a package can be built.
18+
19+
**Runtime** (processed after parent is built):
20+
21+
- ``toplevel`` — Packages specified via CLI or requirements file
22+
- ``install`` — Runtime dependencies extracted from built wheel (``install_requires``)
23+
24+
Key Behavior
25+
------------
26+
27+
**Build dependency fails** → Parent **cannot build**
28+
29+
**Install dependency fails** → Parent **may still build** (failure occurs at runtime)
30+
31+
Identifying in graph.json
32+
-------------------------
33+
34+
Each edge shows ``req_type``:
35+
36+
.. code-block:: json
37+
38+
{"req_type": "build-system", "req": "setuptools>=45"}
39+
{"req_type": "install", "req": "requests>=2.28"}
40+
41+
Use ``fromager graph to-dot --install-only`` to filter runtime-only dependencies.

docs/concepts/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Concepts
2+
========
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
7+
dependencies
8+

docs/conf.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1616

1717
project = "Fromager"
18-
copyright = "2024, Fromager Authors"
18+
copyright = "%Y, Fromager Authors"
1919
author = "Fromager Authors"
2020
release = metadata.version("fromager")
2121

@@ -30,14 +30,19 @@
3030
"sphinx.ext.intersphinx",
3131
]
3232

33+
# Enable MyST extensions to support reStructuredText directives in Markdown
34+
myst_enable_extensions = [
35+
"colon_fence",
36+
]
37+
3338
# Recognized suffixes
3439
source_suffix = {
3540
".rst": "restructuredtext",
3641
".md": "markdown",
3742
}
3843

3944
templates_path = ["_templates"]
40-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "example"]
45+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
4146

4247
language = "English"
4348

@@ -67,7 +72,7 @@
6772

6873

6974
class FromagerHookDocumenter(FunctionDocumenter):
70-
"""Documenter for 'autofromagehook' directive"""
75+
"""Documenter for 'autofromagerhook' directive"""
7176

7277
objtype = "fromagerhook"
7378

@@ -79,7 +84,7 @@ def format_name(self):
7984

8085

8186
class PyFromagerHook(PyFunction):
82-
""":py:fromagehook"""
87+
""":py:fromagerhook"""
8388

8489
def handle_signature(self, sig: str, signode: desc_signature) -> tuple[str, str]:
8590
# hack to remove module prefix from output

docs/customization.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,17 @@ bootstrap requirements, such as:
154154
my-package @ git+https://github.com/example/repo.git@v1.2.3
155155
```
156156

157-
For example requirements with git URLs, see:
157+
Example requirements file with Git URLs:
158158

159-
.. literalinclude:: example/requirements-git-example.txt
160-
:caption: requirements-git-example.txt
159+
```{literalinclude} example/requirements-git-example.txt
160+
:caption: requirements-git-example.txt
161+
```
161162

162-
For a complete package configuration example, see:
163+
A complete package configuration example:
163164

164-
.. literalinclude:: example/git-submodules-example.yaml
165-
:caption: git-submodules-example.yaml
165+
```{literalinclude} example/git-submodules-example.yaml
166+
:caption: git-submodules-example.yaml
167+
```
166168

167169
### Build directory
168170

docs/example/skip-constraints-example.md

Lines changed: 0 additions & 58 deletions
This file was deleted.

docs/hooks.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,17 @@ Source hooks
240240

241241
The return value is the ``Path`` to the newly created source distribution.
242242

243+
Source helper functions
244+
~~~~~~~~~~~~~~~~~~~~~~~
245+
246+
The following helper functions are available in the ``fromager.sources`` module
247+
for use in custom source hooks:
248+
249+
.. autofunction:: fromager.sources.ensure_pkg_info
250+
251+
.. autofunction:: fromager.sources.pep517_build_sdist
252+
253+
.. autofunction:: fromager.sources.unpack_source
243254

244255
Wheel hooks
245256
-----------

0 commit comments

Comments
 (0)