Skip to content

Commit 687483d

Browse files
authored
Merge pull request #58 from mxstack/docs/uv-workflow-and-python-310
Document UV-only workflow and fix Python 3.10 minimum
2 parents 5b93ada + 4954e0b commit 687483d

File tree

6 files changed

+126
-43
lines changed

6 files changed

+126
-43
lines changed

docs/source/getting-started.md

Lines changed: 97 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,94 @@
22

33
## How to bootstrap a project with mxmake
44

5-
Requirements:
5+
### Essential Requirements
66

7-
- [`make`](https://www.gnu.org/software/make/) has to be installed.
8-
This is usually done by your system's package manager - as `sudo apt install make` on Debian-/Ubuntu-based systems.
9-
- `Python 3` has to be installed with the `venv` module.
10-
Some system Python installations need extra action here - as `sudo apt install python-venv` on Debian-/Ubuntu-based systems.
7+
All installation methods require:
8+
- [`make`](https://www.gnu.org/software/make/) command-line tool
9+
- Ubuntu/Debian: `sudo apt install make`
10+
- macOS: `xcode-select --install`
11+
- Windows: [See installation guide](https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058#make)
1112

12-
Create a project folder and enter it:
13+
### Choose Your Installation Method
1314

15+
mxmake supports two installation approaches:
16+
17+
#### Option 1: UV-only (Modern, Recommended)
18+
19+
**Requirements**: Only [UV](https://docs.astral.sh/uv/) - **NO Python installation needed!**
20+
21+
UV automatically downloads Python when creating virtual environments, making it the simplest option for new projects.
22+
23+
**Install UV**:
24+
```shell
25+
# Official installer (Linux/macOS)
26+
curl -LsSf https://astral.sh/uv/install.sh | sh
27+
28+
# Or via pip (if you already have Python)
29+
pip install uv
30+
```
31+
32+
**Bootstrap your project**:
1433
```shell
15-
mkdir myproject
16-
cd myproject
34+
mkdir myproject && cd myproject
35+
36+
# Run mxmake init (UV downloads Python automatically)
37+
uvx mxmake init
38+
39+
# Answer prompts interactively or use --preseeds for automation
40+
# Select topics and configure settings
41+
42+
# Run make install (UV creates venv with downloaded Python)
43+
make install
1744
```
1845

19-
You can either install *mxmake* globally or in a virtual environment.
46+
**Key advantages**:
47+
- No Python pre-installation required
48+
- UV downloads the exact Python version you specify
49+
- Faster package installation
50+
- Ideal for CI/CD environments
2051

21-
For global installation do a `pip install mxmake`, otherwise create a virtual environment, activate it, and install it like so:
52+
```{note}
53+
When using UV, set `PYTHON_PACKAGE_INSTALLER=uv` and `UV_PYTHON=3.14` (or your preferred version) in the Makefile settings section. UV will automatically download and use that Python version.
54+
```
55+
56+
#### Option 2: Traditional pip-based
2257

58+
**Requirements**: Python 3.10+ with venv module
59+
- Ubuntu/Debian: `sudo apt install python3 python3-venv`
60+
- macOS: Python 3.10+ from [python.org](https://www.python.org/downloads/)
61+
- Windows: Python 3.10+ from [python.org](https://www.python.org/downloads/windows/)
62+
63+
**Install mxmake**:
2364
```shell
65+
mkdir myproject && cd myproject
66+
67+
# Option A: Global installation
68+
pip install mxmake
69+
70+
# Option B: In a virtual environment
2471
python3 -m venv venv
25-
. venv/bin/activate
72+
. venv/bin/activate # On Windows: venv\Scripts\activate
2673
pip install mxmake
2774
```
2875

29-
Now create an initial `Makefile` with *mxmake*:
30-
76+
**Bootstrap your project**:
3177
```shell
3278
mxmake init
79+
80+
# Answer prompts interactively
81+
# This creates mx.ini and Makefile
82+
83+
make install
3384
```
3485

35-
This is an interactive session and some questions are to be answered.
36-
If in doubt select the `core` topic and then just hit {kbd}`Return` until done.
86+
### After Initialization
3787

38-
This creates an empty `mx.ini` (only if it does not exist already) and a `Makefile`.
88+
Both methods create:
89+
- `Makefile` - Generated by mxmake with your selected topics/domains
90+
- `mx.ini` - Configuration for mxdev (if you selected that option)
3991

40-
To update an existing Makefile without beeing prompted interactive, run `mxmake update`.
92+
To update an existing Makefile without interactive prompts, run `mxmake update`.
4193

4294
## How to change the settings
4395

@@ -65,19 +117,39 @@ They will be lost on next `mxmake init` respective `mxmake update` run.
65117

66118
### Python Package Installer
67119

68-
By default, mxmake uses `pip` as the package installer. You can switch to [UV](https://docs.astral.sh/uv/) by setting `PYTHON_PACKAGE_INSTALLER=uv` in the settings section.
120+
mxmake supports two package installers:
69121

70-
When using UV, mxmake automatically detects if UV is installed globally or installs it locally in the virtual environment.
122+
**UV (Recommended)**: Modern, fast package installer that can automatically download Python.
123+
- Set `PYTHON_PACKAGE_INSTALLER=uv` in the Makefile
124+
- UV is auto-detected if installed globally, or installed locally in the venv
125+
- **Specify `UV_PYTHON` explicitly** (e.g., `3.14`) to control which Python version UV downloads
71126

72-
```{note}
73-
When using UV, you should explicitly set `UV_PYTHON` to specify which Python version UV should use. While `UV_PYTHON` currently defaults to `PRIMARY_PYTHON` for backward compatibility, this default may change in future versions. Set `UV_PYTHON` explicitly to avoid surprises.
74-
```
127+
**pip (Default)**: Traditional package installer, requires Python pre-installed.
128+
- Works with any Python 3.10+ installation
129+
- Uses the Python specified in `PRIMARY_PYTHON` setting
75130

76-
Example:
131+
Example UV configuration:
77132
```makefile
78-
PRIMARY_PYTHON?=python3
79133
PYTHON_PACKAGE_INSTALLER?=uv
80-
UV_PYTHON?=3.14
134+
UV_PYTHON?=3.14 # UV downloads Python 3.14 automatically
135+
```
136+
137+
Example pip configuration:
138+
```makefile
139+
PRIMARY_PYTHON?=python3.12
140+
PYTHON_PACKAGE_INSTALLER?=pip # Default
141+
```
142+
143+
```{important}
144+
When using UV, **always set `UV_PYTHON` explicitly**. While it currently defaults to `PRIMARY_PYTHON` for backward compatibility, relying on this default is not recommended and may change in future versions.
145+
```
146+
147+
```{note}
148+
With UV + `UV_PYTHON` explicitly set:
149+
- `PRIMARY_PYTHON` is **not needed** (only used as UV_PYTHON default)
150+
- `PYTHON_MIN_VERSION` is **not needed** (validation skipped with global UV)
151+
152+
These settings are **only required** for pip-based workflows.
81153
```
82154

83155
## How to use on the Windows operating system

docs/source/migration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ topics:
4949
5050
## Version 1.0a6
5151
52-
### Dropped: Python 3.8 support
52+
### Dropped: Python 3.8 and 3.9 support
5353
54-
**Breaking Change**: Minimum Python version changed from 3.7/3.8 to 3.9.
54+
**Breaking Change**: Minimum Python version changed from 3.8 to 3.10.
5555
5656
**Migration**:
57-
- Ensure your project uses Python 3.9 or later
57+
- Ensure your project uses Python 3.10 or later
5858
- Update `PYTHON_MIN_VERSION` setting if needed:
5959
```makefile
60-
PYTHON_MIN_VERSION?=3.9
60+
PYTHON_MIN_VERSION?=3.10
6161
```
6262
6363
## Version 1.0a4

docs/source/preseeds.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ topics:
1515
core:
1616
# include domain mxenv
1717
mxenv:
18-
# set PYTHON_MIN_VERSION, PYTHON_PACKAGE_INSTALLER and UV_PYTHON
19-
PYTHON_MIN_VERSION: 3.14
18+
# Minimal UV configuration - UV downloads Python automatically!
2019
PYTHON_PACKAGE_INSTALLER: uv
2120
UV_PYTHON: "3.14"
2221
qa:
@@ -48,13 +47,26 @@ When using UV, you should explicitly set `UV_PYTHON` to specify which Python ver
4847
The `UV_PYTHON` setting accepts version specs like `3.13`, `3.14`, or `[email protected]`:
4948

5049
```yaml
50+
# Minimal UV configuration (recommended)
5151
topics:
5252
core:
5353
mxenv:
54-
PYTHON_MIN_VERSION: "3.14"
55-
PRIMARY_PYTHON: python3
5654
PYTHON_PACKAGE_INSTALLER: uv
57-
UV_PYTHON: "3.14" # Explicitly specify Python version for UV
55+
UV_PYTHON: "3.14" # UV downloads this Python version
56+
```
57+
58+
**Note**: When using UV with `UV_PYTHON` explicitly set:
59+
- `PYTHON_MIN_VERSION` is **not needed** (validation skipped with global UV)
60+
- `PRIMARY_PYTHON` is **not needed** (only used if UV_PYTHON is not set)
61+
62+
For traditional pip-based workflows, you would set:
63+
```yaml
64+
# Traditional pip configuration (requires Python pre-installed)
65+
topics:
66+
core:
67+
mxenv:
68+
PRIMARY_PYTHON: python3.12
69+
PYTHON_PACKAGE_INSTALLER: pip # default
5870
```
5971

6072
## Examples
@@ -77,14 +89,13 @@ Enter the `hello-world-` directory and create a file `preseed.yaml`:
7789
topics:
7890
core:
7991
mxenv:
80-
PYTHON_MIN_VERSION: "3.14"
8192
PYTHON_PACKAGE_INSTALLER: uv
82-
UV_PYTHON: "3.14"
93+
UV_PYTHON: "3.14" # UV downloads Python 3.14
8394
sources:
8495
qa:
85-
ruff
86-
mypy
87-
test
96+
ruff:
97+
mypy:
98+
test:
8899
89100
mx-ini: true
90101
```

src/mxmake/tests/expected/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ EXTRA_PATH?=
4444
PRIMARY_PYTHON?=python3
4545

4646
# Minimum required Python version.
47-
# Default: 3.9
48-
PYTHON_MIN_VERSION?=3.9
47+
# Default: 3.10
48+
PYTHON_MIN_VERSION?=3.10
4949

5050
# Install packages using the given package installer method.
5151
# Supported are `pip` and `uv`. When `uv` is selected, a global installation

src/mxmake/tests/test_templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def test_Makefile(self, tempdir):
562562
"core.base.INCLUDE_MAKEFILE": "include.mk",
563563
"core.base.EXTRA_PATH": "",
564564
"core.mxenv.PRIMARY_PYTHON": "python3",
565-
"core.mxenv.PYTHON_MIN_VERSION": "3.9",
565+
"core.mxenv.PYTHON_MIN_VERSION": "3.10",
566566
"core.mxenv.PYTHON_PACKAGE_INSTALLER": "pip",
567567
"core.mxenv.UV_PYTHON": "$(PRIMARY_PYTHON)",
568568
"core.mxenv.VENV_ENABLED": "true",

src/mxmake/topics/core/mxenv.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#:
3232
#:[setting.PYTHON_MIN_VERSION]
3333
#:description = Minimum required Python version.
34-
#:default = 3.9
34+
#:default = 3.10
3535
#:
3636
#:[setting.PYTHON_PACKAGE_INSTALLER]
3737
#:description = Install packages using the given package installer method.

0 commit comments

Comments
 (0)