Skip to content

Commit 74cfb65

Browse files
author
Gunther Klessinger
committed
chore: <3.9 dropped
1 parent 2d52f2e commit 74cfb65

4 files changed

Lines changed: 3851 additions & 132 deletions

File tree

MIGRATION.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Migration from make/poetry to just/uv
2+
3+
## Quick Start
4+
5+
1. **Install just and uv** (if not already installed):
6+
```bash
7+
brew install just uv
8+
```
9+
10+
2. **Initialize the environment**:
11+
```bash
12+
just init
13+
```
14+
15+
3. **Common commands**:
16+
```bash
17+
just test # Run tests
18+
just docs # Build documentation
19+
just docs-serve # Serve docs locally
20+
just format # Format code
21+
just build # Build package
22+
just clean # Clean build artifacts
23+
```
24+
25+
## Command Mapping
26+
27+
| Old (make) | New (just) | Description |
28+
|------------|------------|-------------|
29+
| `source ./make -a && make tests` | `just test` | Run tests |
30+
| `make docs` | `just docs` | Build documentation |
31+
| `make docs-serve` | `just docs-serve` | Serve documentation |
32+
| `make clean` | `just clean` | Clean build artifacts |
33+
| `make release <version>` | `just release <version>` | Release new version |
34+
35+
## Key Changes
36+
37+
### Dependencies Management
38+
- **Before**: Poetry managed dependencies
39+
- **After**: uv manages dependencies (much faster)
40+
- **Migration**: Dependencies moved from `[tool.poetry.dependencies]` to `[project.dependencies]` in pyproject.toml
41+
42+
### Build System
43+
- **Before**: Poetry build backend
44+
- **After**: Hatchling build backend (modern, standards-compliant)
45+
46+
### System Dependencies
47+
- **Before**: Installed via conda through `environ` file
48+
- **After**: Installed via `brew install` in `just init`
49+
- **Dependencies**: tmux, poetry, graphviz, imagemagick
50+
51+
### Task Runner
52+
- **Before**: Bash functions in `make` script
53+
- **After**: Just recipes in `justfile`
54+
- **Benefits**:
55+
- Better syntax highlighting
56+
- Built-in help system (`just --list`)
57+
- Cross-platform compatibility
58+
- More readable recipe syntax
59+
60+
## Environment Setup
61+
62+
The old `environ` file approach is replaced by:
63+
64+
1. System dependencies via `just init` (uses brew)
65+
2. Python dependencies via `uv sync`
66+
3. Environment variables can be set in `.env` files (uv loads them automatically)
67+
68+
## Development Workflow
69+
70+
```bash
71+
# One-time setup
72+
just init
73+
74+
# Daily development
75+
just test # Run tests
76+
just format # Format code before committing
77+
just docs-serve # Preview documentation
78+
79+
# Release workflow
80+
just test # Ensure tests pass
81+
just build # Build package
82+
just release 2024.01.15 # Release with version
83+
```
84+
85+
## Migration Status
86+
87+
**Completed**:
88+
- Basic task runner (just)
89+
- Dependency management (uv)
90+
- Build system (hatchling)
91+
- Common development tasks
92+
- System dependency installation
93+
94+
**Not Yet Migrated**:
95+
- All advanced make functions (conda environment management, etc.)
96+
- Git hooks and automation
97+
- Advanced CI/CD integrations
98+
- Coverage combination logic
99+
- Changelog generation
100+
101+
These can be added incrementally as needed.

justfile

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# docutools - Development Task Runner
2+
# Modern replacement for the make script using just
3+
4+
# Default recipe to display help
5+
default:
6+
@just --list
7+
8+
# Initialize development environment using brew. Tested on OSX
9+
init:
10+
@command -v brew >/dev/null || (echo "❌ Error: Homebrew is required but not installed." && echo "Install it from: https://brew.sh" && exit 1)
11+
@echo "Installing system dependencies..."
12+
brew install tmux graphviz imagemagick
13+
@echo "Setting up uv and installing dependencies..."
14+
uv sync
15+
@echo "Development environment ready!"
16+
17+
# Install/sync dependencies
18+
install:
19+
uv sync
20+
21+
# Run all tests
22+
test *ARGS:
23+
uv run pytest {{ARGS}} tests -c config/pytest.ini
24+
25+
# Run tests with coverage
26+
test-cov:
27+
uv run coverage run --rcfile=config/coverage.pytest.ini -m pytest tests -c config/pytest.ini
28+
uv run coverage combine
29+
uv run coverage report --precision=2
30+
31+
# Format code with black
32+
format:
33+
uv run black src tests
34+
uv run isort src tests
35+
36+
# Run type checking
37+
typecheck:
38+
uv run mypy src
39+
40+
# Lint code
41+
lint:
42+
uv run flake8 src tests
43+
44+
# Run all quality checks (format, lint, typecheck)
45+
check: format lint typecheck
46+
47+
# Build documentation
48+
docs:
49+
rm -f docs/autodocs
50+
uv run coverage run --rcfile=config/coverage.lp.ini $(uv run which mkdocs) build
51+
52+
# Serve documentation locally
53+
docs-serve PORT="2222":
54+
@echo "Serving docs on http://127.0.0.1:{{PORT}}"
55+
@pkill -f "mkdocs serve.*{{PORT}}" || true
56+
uv run mkdocs serve -a "127.0.0.1:{{PORT}}"
57+
58+
# Check documentation links
59+
docs-checklinks:
60+
@command -v linkchecker >/dev/null || (echo "Install linkchecker: pip install git+https://github.com/linkchecker/linkchecker.git" && exit 1)
61+
linkchecker site --ignore-url '(.*).json'
62+
63+
# Clean build artifacts and caches
64+
clean:
65+
rm -f .coverage*
66+
rm -rf .mypy_cache .pytest_cache build dist pip-wheel-metadata site public __pycache__
67+
find . -name "*.pyc" -delete
68+
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
69+
70+
# Clean LP (Literal Programming) caches
71+
clean-lp:
72+
@echo "Cleaning LP caches..."
73+
find . -name "*.lp.py" -delete
74+
75+
# Build the package
76+
build:
77+
uv build
78+
79+
# Release a new version
80+
release VERSION="":
81+
#!/usr/bin/env bash
82+
set -euo pipefail
83+
84+
VERSION_ARG="{{VERSION}}"
85+
if [ -z "$VERSION_ARG" ]; then
86+
# Use calendar versioning by default
87+
VERSION_ARG=$(date "+%Y.%m.%d")
88+
echo "Using calendar version: $VERSION_ARG"
89+
fi
90+
91+
echo "Releasing version $VERSION_ARG"
92+
93+
# Update version in pyproject.toml
94+
sed -i '' "s/^version = .*/version = \"$VERSION_ARG\"/" pyproject.toml
95+
96+
# Run tests
97+
just test
98+
99+
# Build docs
100+
just docs
101+
102+
# Build package
103+
just build
104+
105+
# Commit and tag
106+
git commit -am "chore: Prepare release $VERSION_ARG" || true
107+
git tag "$VERSION_ARG"
108+
109+
echo "Release $VERSION_ARG ready. Run 'git push --tags' and publish manually."
110+
111+
# Development shortcuts
112+
alias t := test
113+
alias d := docs
114+
alias ds := docs-serve
115+
alias clc := clean-lp

0 commit comments

Comments
 (0)