Skip to content

Commit 67b4bdc

Browse files
Switch from Makefile to mise (#81)
Co-authored-by: Amr Abed <3361565+amrabed@users.noreply.github.com>
1 parent b6e5bcb commit 67b4bdc

13 files changed

Lines changed: 265 additions & 190 deletions

File tree

‎.devcontainer/devcontainer.json‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/python
31
{
4-
"name": "Python 3",
5-
"build": { "dockerfile": "Dockerfile" },
6-
7-
// Features to add to the dev container. More info: https://containers.dev/features.
8-
// "features": {},
9-
10-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
11-
// "forwardPorts": [],
12-
13-
// Use 'postCreateCommand' to run commands after the container is created.
14-
// "postCreateCommand": "pip3 install --user -r requirements.txt",
15-
16-
// Configure tool-specific properties.
17-
// "customizations": {},
18-
19-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
20-
"remoteUser": "root"
2+
"name": "project",
3+
"image": "mcr.microsoft.com/devcontainers/python:3",
4+
"features": {
5+
"ghcr.io/devcontainers-extra/features/mise:1": {}
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"hverlin.mise-vscode",
11+
"tamasfe.even-better-toml",
12+
"redhat.vscode-yaml",
13+
"charliermarsh.ruff",
14+
"ms-python.python"
15+
]
16+
}
17+
},
18+
"postCreateCommand": "echo 'eval \"$(mise activate bash)\"' >> ~/.bashrc",
19+
"forwardPorts": [
20+
"8000:8000"
21+
]
2122
}

‎.github/workflows/check.yml‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ jobs:
1515
- "3.12"
1616
steps:
1717
- uses: actions/checkout@v6
18-
- name: Install uv and setup Python
19-
uses: astral-sh/setup-uv@v7
18+
- uses: jdx/mise-action@v4
2019
with:
21-
python-version: ${{ matrix.python-version }}
22-
enable-cache: true
20+
tool_versions: |
21+
python ${{ matrix.python-version }}
2322
- name: Install dependencies
24-
run: make install
23+
run: mise run install
2524
- name: Format and lint
26-
run: make lint
25+
run: mise run lint
2726
- name: Run tests
28-
run: make test
27+
run: mise run test

‎.github/workflows/docs.yml‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v6
14-
- name: Setup Python
15-
uses: actions/setup-python@v6
16-
with:
17-
python-version: 3.12
14+
- uses: jdx/mise-action@v4
1815
- name: Configure Git Credentials
1916
run: |
2017
git config user.name github-actions[bot]
2118
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
22-
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
23-
- uses: actions/cache@v5
24-
with:
25-
key: mkdocs-material-${{ env.cache_id }}
26-
path: .cache
27-
restore-keys: |
28-
mkdocs-material-
29-
- name: Install dependencies
30-
run: pip install mkdocs-material mkdocstrings[python]
3119
- name: Publish to GitHub Pages
32-
run: mkdocs gh-deploy --force
20+
run: mise run docs

‎.pre-commit-config.yaml‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
repos:
2-
- repo: local
2+
# General hygiene
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v6.0.0
35
hooks:
4-
- id: lint
5-
name: Linting
6-
entry: make lint
7-
language: system
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- id: check-yaml
9+
- id: check-toml
10+
- id: check-json
11+
- id: check-merge-conflict
12+
- id: check-added-large-files
13+
args: [--maxkb=1000]
14+
- id: no-commit-to-branch
15+
args: [--branch, main]
16+
17+
- repo: https://github.com/astral-sh/ruff-pre-commit
18+
rev: v0.15.12
19+
hooks:
20+
- id: ruff
21+
args: [--fix]
22+
- id: ruff-format

‎.vscode/settings.json‎

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
11
{
2-
"makefile.configureOnOpen": false
3-
}
2+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
3+
"editor.defaultFormatter": "charliermarsh.ruff",
4+
"editor.formatOnSave": true,
5+
"[python]": {
6+
"editor.defaultFormatter": "charliermarsh.ruff",
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.ruff": "explicit",
9+
"source.organizeImports.ruff": "explicit"
10+
}
11+
},
12+
"[toml]": {
13+
"editor.defaultFormatter": "tamasfe.even-better-toml"
14+
},
15+
"[yaml]": {
16+
"editor.defaultFormatter": "redhat.vscode-yaml"
17+
},
18+
"python.testing.pytestEnabled": true,
19+
"python.testing.unittestEnabled": false,
20+
"python.testing.pytestArgs": [
21+
"--tb=short"
22+
],
23+
"files.exclude": {
24+
"**/__pycache__": true,
25+
"**/*.pyc": true,
26+
"**/.pytest_cache": true,
27+
"**/.ruff_cache": true,
28+
"**/cdk.out": true,
29+
"**/.venv": true
30+
},
31+
"search.exclude": {
32+
"**/__pycache__": true,
33+
"**/.venv": true,
34+
"**/cdk.out": true,
35+
"**/node_modules": true,
36+
"uv.lock": true
37+
},
38+
"editor.rulers": [
39+
120
40+
],
41+
"editor.insertSpaces": true,
42+
"editor.tabSize": 4,
43+
"files.trimTrailingWhitespace": true,
44+
"files.insertFinalNewline": true
45+
}

‎AGENTS.md‎

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This is a **Python project template** that provides a pre-configured, production
1717
- **Documentation** via [MkDocs](https://www.mkdocs.org) with [mkdocstrings](https://mkdocstrings.github.io), auto-deployed to GitHub Pages
1818
- **CI/CD** via GitHub Actions
1919
- **Containerisation** via Docker and Dev Containers
20+
- **Environment & Task Management** via [mise](https://mise.jdx.dev)
2021

2122
---
2223

@@ -30,71 +31,62 @@ This is a **Python project template** that provides a pre-configured, production
3031
│ ├── README.md # Project README and MkDocs home page
3132
│ ├── CONTRIBUTING.md # Contributing guidelines
3233
│ └── reference/ # Auto-generated API reference pages
33-
├── project/ # Main source package (renamed via `make project`)
34+
├── project/ # Main source package (renamed via `mise run project`)
3435
│ ├── __init__.py
3536
│ └── app.py # CLI entry point
3637
├── tests/ # Test suite
3738
│ ├── conftest.py # Shared pytest fixtures and hooks
3839
│ └── test_app.py # Sample tests
3940
├── compose.yml # Docker Compose file
4041
├── Dockerfile # App container
41-
├── Makefile # Workflow automation targets
42+
├── mise.toml # Workflow automation tasks
4243
├── mkdocs.yml # MkDocs configuration
4344
├── pyproject.toml # Project metadata, dependencies, and tool configuration
4445
└── uv.lock # Locked dependency versions (do not edit manually)
4546
```
4647

47-
> **Note:** The `project/` folder is the template placeholder. After initialising a real project with `make project NAME=...`, it is renamed to the chosen package name.
48+
> **Note:** The `project/` folder is the template placeholder. After initialising a real project with `mise run project name=...`, it is renamed to the chosen package name.
4849
4950
---
5051

5152
## Setup
5253

5354
### Prerequisites
5455

55-
- Python 3.12+
56-
- [pipx](https://pipx.pypa.io) (to install uv)
56+
- [mise](https://mise.jdx.dev)
5757
- Docker (for Dev Container or containerised runs)
5858

5959
### First-time setup
6060

6161
```bash
62-
# 1. Install uv (if not already installed)
63-
make uv
64-
65-
# 2. Install all dependencies
66-
make install
67-
68-
# 3. Install pre-commit hooks
69-
make precommit
70-
71-
# 4. Activate the virtual environment
72-
make venv
62+
# Install tools, project dependencies, and pre-commit hooks
63+
mise run dev
7364
```
7465

7566
### Rename the template for a new project (run once)
7667

7768
```bash
78-
make project NAME="my-project" DESCRIPTION="My app" AUTHOR="Your Name" EMAIL="you@example.com" GITHUB="your-username"
69+
mise run project --name "my-project" --description "My app" --author "Your Name" --email "you@example.com" --github "your-username"
7970
```
8071

8172
---
8273

8374
## Common Commands
8475

85-
| Task | Command |
86-
|---|---|
87-
| Install dependencies | `make install` |
88-
| Update dependencies | `make update` |
89-
| Lint and format | `make lint` |
90-
| Run tests with coverage | `make test` |
91-
| Run app locally | `app` (after `make venv`) or `uv run app` |
92-
| Run app in Docker | `docker compose run app` |
93-
| Serve docs locally | `make local` |
94-
| Deploy docs to GitHub Pages | `make docs` |
95-
| Full setup from scratch | `make all` |
96-
97-
> Refer to `docs/README.md` for the full list of available targets. Add new targets to `Makefile` as needed.
76+
| Task | Command | Alias |
77+
|---|---|---|
78+
| Install dependencies | `mise run install` | `i` |
79+
| Update dependencies | `mise run update` | `u` |
80+
| Lint and format | `mise run lint` | `l` |
81+
| Run tests with coverage | `mise run test` | `t` |
82+
| Run app locally | `mise run app` | `a` |
83+
| Run app in Docker | `docker compose run app` | |
84+
| Serve docs locally | `mise run local-docs` | `d` |
85+
| Deploy docs to GitHub Pages | `mise run docs` | |
86+
| Setup dev environment | `mise run dev` | |
87+
| Full setup from scratch | `mise run all` | |
88+
89+
> Refer to `docs/README.md` for the full list of available targets. Add new targets to `mise.toml` as needed.
9890
9991
---
10092

@@ -104,15 +96,15 @@ make project NAME="my-project" DESCRIPTION="My app" AUTHOR="Your Name" EMAIL="yo
10496
- **Linter/formatter**: `ruff` — enforces `E` (pycodestyle errors) and `I` (isort) rules
10597
- **Type checker**: `pyright` — all imports must resolve; missing imports are errors
10698
- **Pre-commit**: hooks run `ruff` automatically before every commit
107-
- Run `make lint` to format, sort imports, and check types manually
99+
- Run `mise run lint` to format, sort imports, and check types manually
108100
- All public functions and classes must have docstrings (used by `mkdocstrings` for API docs)
109101

110102
---
111103

112104
## Testing
113105

114106
- Tests live in the `tests/` directory and mirror the source structure
115-
- Run the full test suite with coverage using `make test` (runs `pytest` via `coverage`)
107+
- Run the full test suite with coverage using `mise run test` (runs `pytest` via `coverage`)
116108
- Coverage is measured with branch coverage enabled; the report is printed to the terminal and exported as `coverage.xml`
117109
- Shared fixtures belong in `tests/conftest.py`
118110
- Test files must be named `test_*.py`
@@ -140,15 +132,15 @@ make project NAME="my-project" DESCRIPTION="My app" AUTHOR="Your Name" EMAIL="yo
140132
- Use `pytest` monkeypatch and `pytest-mock` for mocking instead of `unittest.MagicMock`
141133
- Do not cheat! Never modify source code just to make a failing test pass. Fix real bugs in source code and fix incorrect assertions in tests
142134

143-
## Make Targets
135+
## Mise Tasks
144136

145-
Use `make` targets for all common workflows: lint, test, run locally, and deploy. Refer to `docs/README.md` for currently available targets. Add new targets to `Makefile` as needed.
137+
Use `mise` tasks for all common workflows: lint, test, run locally, and deploy. Refer to `docs/README.md` for currently available tasks. Add new tasks to `mise.toml` as needed.
146138

147139
## Notes
148140

149141
- Python 3.12+ required
150142
- Dependencies are managed via `pyproject.toml` and locked in `uv.lock`
151-
- Do not edit `uv.lock` directly; use `make update` to update dependencies
143+
- Do not edit `uv.lock` directly; use `mise run update` to update dependencies
152144

153145
## Coding Conventions
154146

‎Dockerfile‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
FROM python:3.12-alpine
1+
FROM python:3.14-alpine
22
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
33
WORKDIR /code
4-
RUN apk add -u make
54
COPY . .
6-
RUN make install
5+
RUN uv sync
76
ENTRYPOINT ["uv", "run", "app"]

‎Makefile‎

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

0 commit comments

Comments
 (0)