Skip to content

Commit 740cb64

Browse files
Adding documentation around building the project
Fixes #652 Modified the pyproject.toml removing the matrix from the default environment as the matrix belongs on specific environments (like test) where multi-version behavior is actually needed, not on the default environment which should be simple and predictable. Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
1 parent 0a83748 commit 740cb64

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

docs/develop.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,63 @@ writing to INFO level to show what is starting and stopping, respectively.
3030
Detailed messages should be logged to DEBUG level so they will not appear on the
3131
console by default.
3232

33+
## Building the project
34+
35+
The project uses [Hatch](https://hatch.pypa.io/) as its build system with [hatchling](https://hatch.pypa.io/latest/plugins/builder/wheel/) as the build backend. The build configuration is defined in `pyproject.toml`.
36+
37+
### Development installation
38+
39+
For development, you can install the project in editable mode:
40+
41+
```bash
42+
# You can spawn a shell within an environment by using the hatch shell command.
43+
# It installs the project in editable/development mode.
44+
hatch shell
45+
46+
# Check if fromager is installed and available in the path
47+
which fromager
48+
```
49+
Note: When a package is installed in editable/development mode, you can make changes to its source code directly. These changes are immediately reflected in your Python environment without needing to reinstall the package.
50+
51+
### Quick build
52+
53+
To build the project (both source distribution and wheel), use:
54+
55+
```bash
56+
hatch build
57+
```
58+
59+
This will create both `.tar.gz` (source distribution) and `.whl` (wheel) files in the `dist/` directory.
60+
61+
You can build specific formats by using `hatch build -t wheel` or `hatch build -t sdist`.
62+
63+
Alternatively, you can use the standard `build` module (which is included in the `[project.optional-dependencies.build]` section):
64+
65+
```bash
66+
# Install build dependencies first
67+
pip install build twine
68+
69+
# Build the project
70+
python -m build
71+
```
72+
73+
### Package validation
74+
75+
To validate the built packages, you can use the package linting script:
76+
77+
```bash
78+
hatch run lint:pkglint
79+
```
80+
81+
This command will:
82+
1. Build the project using `python -m build`
83+
2. Check the built packages with `twine check dist/*.tar.gz dist/*.whl`
84+
3. Validate Python version consistency between `pyproject.toml` and GitHub Actions workflows
85+
86+
The validation will fail if:
87+
- The package metadata is malformed
88+
- Required files are missing from the distribution
89+
- Python version requirements are inconsistent across configuration files
90+
91+
3392
### Building documentation

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ reportAttributeAccessIssue = false # adding our own private property on click c
197197
# No specific python version here, so it uses the active Python by default.
198198
dependencies = []
199199

200-
[[tool.hatch.envs.default.matrix]]
201-
python = ["3.11", "3.12", "3.13"]
202-
203200
[tool.hatch.envs.test]
204201
features = ["test"]
205202
# {args:tests} allows passing arguments to specify which tests to run
203+
[[tool.hatch.envs.test.matrix]]
204+
python = ["3.11", "3.12", "3.13"]
205+
206206
[tool.hatch.envs.test.scripts]
207207
test = "python -m coverage run -m pytest --log-level DEBUG -vv {args:tests}"
208208
coverage-report = ["coverage combine", "coverage report --format=markdown"]

0 commit comments

Comments
 (0)