Skip to content

Commit 8206a77

Browse files
authored
Merge pull request #653 from LalatenduMohanty/build_docs
Adding documentation around building the project
2 parents 4fa10a0 + 1f45467 commit 8206a77

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

docs/develop.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,65 @@ 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+
50+
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.
51+
52+
### Quick build
53+
54+
To build the project (both source distribution and wheel), use:
55+
56+
```bash
57+
hatch build
58+
```
59+
60+
This will create both `.tar.gz` (source distribution) and `.whl` (wheel) files in the `dist/` directory.
61+
62+
You can build specific formats by using `hatch build -t wheel` or `hatch build -t sdist`.
63+
64+
Alternatively, you can use the standard `build` module (which is included in the `[project.optional-dependencies.build]` section):
65+
66+
```bash
67+
# Install build dependencies first
68+
pip install build twine
69+
70+
# Build the project
71+
python -m build
72+
```
73+
74+
### Package validation
75+
76+
To validate the built packages, you can use the package linting script:
77+
78+
```bash
79+
hatch run lint:pkglint
80+
```
81+
82+
This command will:
83+
84+
1. Build the project using `python -m build`
85+
2. Check the built packages with `twine check dist/*.tar.gz dist/*.whl`
86+
3. Validate Python version consistency between `pyproject.toml` and GitHub Actions workflows
87+
88+
The validation will fail if:
89+
90+
- The package metadata is malformed
91+
- Required files are missing from the distribution
92+
- Python version requirements are inconsistent across configuration files
93+
3394
### Building documentation

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,10 @@ 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+
206204
[tool.hatch.envs.test.scripts]
207205
test = "python -m coverage run -m pytest --log-level DEBUG -vv {args:tests}"
208206
coverage-report = ["coverage combine", "coverage report --format=markdown"]

0 commit comments

Comments
 (0)