DEVX-63: feat: extract generic tools into devx, expand devx.mak, remove personal references
This commit is contained in:
@@ -57,6 +57,7 @@ src/devx/
|
||||
│ ├── release.py # Automated versioning, tagging, changelog
|
||||
│ ├── publish.py # Build and publish to Gitea PyPI registry (--skip-build for non-Python repos)
|
||||
│ ├── auto_merge.py # Squash-merge PRs with task ID validation
|
||||
│ ├── check_auto_merge_ready.py # Pre-merge validation gate (branch, PR title, Vikunja, behind-master)
|
||||
│ ├── _shared.py # Shared utilities (get_latest_tag)
|
||||
│ ├── classify_changes.py # User-facing vs workflow-only change detection
|
||||
│ ├── detect_release_commit.py # Detect release commits on master
|
||||
@@ -74,6 +75,10 @@ src/devx/
|
||||
│ ├── setup.py # Environment setup (venv, deps, hooks)
|
||||
│ ├── install_tools.py # Install actionlint, git-cliff, act_runner, tea
|
||||
│ ├── check_test_speed.py # Measure unit test execution time
|
||||
│ ├── check_mutable_globals.py # Detect module-level mutable globals (test isolation bugs)
|
||||
│ ├── check_pyproject_deps.py # Validate pyproject.toml deps have documentation comments
|
||||
│ ├── check_test_coverage.py # Ensure changed files have corresponding tests (configurable rules)
|
||||
│ ├── check_agent_docs.py # Validate docs for stale file references (configurable patterns)
|
||||
│ ├── configure_repo.py # Branch protection and label setup
|
||||
│ └── generate_badges.py # Badge SVG generation
|
||||
├── opentofu.py # OpenTofu output helpers (get_tofu_output, get_tofu_vm_ip, get_tofu_vm_field)
|
||||
@@ -358,6 +363,90 @@ Projects using devx can override the default API URLs and language by setting
|
||||
`DEVX_*` environment variables or entries in their `.env` file. The config
|
||||
system loads `.env` automatically via `python-dotenv`.
|
||||
|
||||
### pyproject.toml [tool.devx] Configuration
|
||||
|
||||
In addition to `DEVX_` env vars, several devx tools read configuration from
|
||||
the `[tool.devx]` section in `pyproject.toml`. This allows per-project
|
||||
customization without environment variables.
|
||||
|
||||
**Base config** (`[tool.devx]`):
|
||||
- `task_prefix` — Task ID prefix (e.g. `"DEVX"`, `"GRM"`, `"OBL-INFRA"`)
|
||||
- `vikunja_project_id` — Vikunja project ID
|
||||
- `repo_owner` / `repo_name` — Gitea repository coordinates
|
||||
- `gitea_api_url` / `vikunja_api_url` — API endpoints
|
||||
|
||||
**Tool-specific config**:
|
||||
- `[tool.devx.check_mutable_globals]` — `scan_dirs`, `skip_dirs`, `known_safe`
|
||||
- `[tool.devx.check_test_coverage]` — `rules` (source_pattern → test_paths mapping), `skip_patterns`
|
||||
- `[tool.devx.check_agent_docs]` — `scan_dirs`, `deleted_files`, `deprecated_patterns`, `legitimate_indicators`
|
||||
|
||||
## devx.mak — Shared Makefile Fragment
|
||||
|
||||
`devx.mak` provides common Makefile targets that projects can include
|
||||
via `-include $(DEVX_MAK)`. This eliminates Makefile duplication across
|
||||
projects.
|
||||
|
||||
**Available targets** (all prefixed with `devx-`):
|
||||
|
||||
| Target | Purpose |
|
||||
|--------|---------|
|
||||
| `devx-create-task` | Create a Vikunja task |
|
||||
| `devx-create-pr` | Create a PR with auto-derived title |
|
||||
| `devx-push` | Push current branch to origin |
|
||||
| `devx-push-with-pr` | Push and create PR in one step |
|
||||
| `devx-check-config` | Validate devx configuration |
|
||||
| `devx-configure-gitea-pypi` | Configure Gitea private PyPI registry |
|
||||
| `devx-env` | Create .env from .env.example |
|
||||
| `devx-venv` | Create Python venv with version check |
|
||||
| `devx-activate-scripts` | Create shell/fish/zsh activate scripts |
|
||||
| `devx-install-hooks` | Set git hooks path to hooks/ |
|
||||
| `devx-install-tools` | Install actionlint, git-cliff, act_runner, tea |
|
||||
| `devx-install-checkmake` | Install checkmake (Makefile linter) |
|
||||
| `devx-checkmake` | Lint Makefiles with checkmake |
|
||||
| `devx-workflow-lint` | Static lint of Gitea Actions YAML (actionlint) |
|
||||
| `devx-workflow-dryrun` | Dry-run all workflows (act_runner) |
|
||||
| `devx-workflow-dryrun-safe` | Best-effort dry-run (skips if act_runner missing) |
|
||||
| `devx-workflow-check` | Static lint + dry-run |
|
||||
| `devx-notify-failure` | Create Gitea issue on CI failure |
|
||||
| `devx-lint-ruff` | Run ruff check |
|
||||
| `devx-lint-format` | Run ruff format --check |
|
||||
| `devx-typecheck` | Run pyright |
|
||||
| `devx-lint-bandit` | Run bandit security scan |
|
||||
| `devx-lint-deps` | Check dependencies for vulnerabilities (pip-audit) |
|
||||
| `devx-lint` | Run all lint targets |
|
||||
| `devx-test-unit` | Run unit tests without coverage |
|
||||
| `devx-pytest-cov` | Run pytest with coverage enforcement |
|
||||
| `devx-check-mutable-globals` | Scan for mutable path globals |
|
||||
| `devx-check-dep-docs` | Validate pyproject.toml deps are documented |
|
||||
| `devx-check-test-coverage` | Check changed files have corresponding tests |
|
||||
| `devx-check-docs` | Validate docs for stale references |
|
||||
| `devx-check-test-speed` | Verify test suite timing |
|
||||
| `devx-pre-push` | Run lint + tests before push |
|
||||
| `devx-clean` | Remove caches, build artifacts, coverage data |
|
||||
|
||||
**Variables** (set BEFORE including devx.mak):
|
||||
- `DEVX_PYTHON` — Python executable (default: `python3`)
|
||||
- `DEVX_VENV` — venv directory (default: `.venv`)
|
||||
- `DEVX_BIN` — venv bin directory (default: `$(DEVX_VENV)/bin`)
|
||||
- `DEVX_LINT_PATHS` — paths for ruff/bandit (default: `src/ tests/`)
|
||||
- `DEVX_COV_PKG` — coverage package (default: `src/devx`)
|
||||
- `DEVX_TEST_PATHS` — pytest paths (default: `tests/`)
|
||||
- `DEVX_PR_BASE` — PR base branch (default: `master`)
|
||||
|
||||
**Usage in project Makefile**:
|
||||
```makefile
|
||||
DEVX_PYTHON := $(BIN)/python
|
||||
DEVX_MAK := $(shell $(BIN)/python -c \
|
||||
"from pathlib import Path; import devx; print(Path(devx.__file__).parent / 'make' / 'devx.mak')" \
|
||||
2>/dev/null)
|
||||
-include $(DEVX_MAK)
|
||||
|
||||
# Aliases for project-specific names
|
||||
lint-ruff: devx-lint-ruff
|
||||
workflow-lint: devx-workflow-lint
|
||||
create-task: devx-create-task
|
||||
```
|
||||
|
||||
## Key Conventions
|
||||
|
||||
- Python 3.12+ required (ruff/pyright target `py312`)
|
||||
|
||||
Reference in New Issue
Block a user