Skip to content

Commit 592d9df

Browse files
committed
Updated the readme with build instructions
1 parent b8b5ba4 commit 592d9df

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,39 @@ This variant of a Python Flask API is code-first and using native Flask
1818

1919
## How to build this
2020

21-
In bash:
21+
Building a wheel boils down to this (in bash or Powershell):
2222

23-
```shell
24-
$ pip install -r build-requirements.txt # Manually install dependencies (see note in requirements.txt!)
23+
```bash
24+
$ pip install -r requirements.txt # Manually install dependencies (see note in requirements.txt!)
2525
$ export PYTHONPATH=`pwd` # In order to find the build-time ci module
2626
$ export MRMAT_VERSION=1.0.27 # Optional: To influence the version. Normally calculated and set by CI
2727
$ python -m build -n # Use -n in an interactive, virtual environment
2828
$ ls dist/
2929
mrmat_python_api_flask-1.0.27.dev0-py3-none-any.whl
3030
```
3131

32-
In PowerShell:
33-
3432
```powershell
3533
PS> pip install -r build-requirements.txt # Manually install dependencies (see note in requirements.txt!)
3634
PS> $Env:PYTHONPATH=(pwd) # In order to find the build-time ci module
3735
PS> $Env:MRMAT_VERSION = "1.0.27" # Optional: To influence the version. Normally calculated and set by CI
3836
PS> python -m build
3937
```
4038

39+
This project uses the [PEP517 build mechanism](https://www.python.org/dev/peps/pep-0517/), but with a twist so CI is in
40+
control over the generation of the micro version number. In our case, CI is GitHub Actions, which has the top-level
41+
environment variables `MAJOR` and `MINOR`. These two are intended to be infrequently updated manually if and when
42+
it is needed. The micro version is automatically set by the `GITHUB_RUN_NUMBER` which increases for every build
43+
we do. The `MRMAT_VERSION` environment variable is a concatenation of these three. If the build is via a PR onto
44+
main then this is the release version. Otherwise `.dev0` is appended to the version.
45+
46+
If you are building locally, then your version will **always** be `0.0.0.dev0` (unless you explicitly set the
47+
`MRMAT_VERSION` environment variable to something different).
48+
49+
It is necessary for setup.cfg to figure out whether and what `MRMAT_VERSION` is set to. Since this is no longer
50+
an executable in PEP517, we tell it to use the `ci` module for doing so. The `ci` module simply picks up `MRMAT_VERSION`
51+
from the environment, no more and the module is explicitly ignored from packaging. However, you must ensure that
52+
the top-level `ci` module is on the Python path as you build (hence the setup above).
53+
4154
## How to run this
4255

4356
You have the choice of running this

0 commit comments

Comments
 (0)