Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ Explain why this change is needed.

## Changes

-
-
-
List the most important changes.

## Type of change

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- name: Check formatting
run: uv run ruff format --check .

- name: Lint Markdown
run: uv run rumdl check .

- name: Run tests with coverage
run: uv run pytest --cov=text_toolkit --cov-report=term-missing

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ htmlcov/
# Tool caches
.ruff_cache/
.mypy_cache/
.rumdl_cache/

# IDE settings
.vscode/
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ repos:
- id: check-toml
- id: check-merge-conflict

- repo: local
hooks:
- id: rumdl
name: lint Markdown with rumdl
entry: uv run rumdl check
language: system
types: [markdown]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
hooks:
Expand Down
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ Delete the corresponding local branch after updating `main`.

## Documentation terminology

Use the official spelling of tool names: `uv`, pytest, mypy, and `pre-commit`
are lowercase, while Ruff is capitalized in prose. Keep command names and
configuration keys in code format.
Use the official spelling of tool names: `uv`, pytest, mypy, `rumdl`, and
`pre-commit` are lowercase, while Ruff is capitalized in prose. Keep command
names and configuration keys in code format.

Call the ordered set of core chapters the **main learning path**. Call the
supporting quickstarts, troubleshooting pages, and focused guides
Expand Down Expand Up @@ -203,6 +203,7 @@ Before opening a pull request with code changes, run the local quality checks:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
uv build --no-sources
Expand All @@ -219,6 +220,7 @@ Then repeat the checks:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
uv build --no-sources
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![CI](https://github.com/michalmaj/modern-python-project-guide/actions/workflows/ci.yml/badge.svg)](https://github.com/michalmaj/modern-python-project-guide/actions/workflows/ci.yml)

A practical, beginner-friendly guide to building a clean Python project with
`uv`, `pytest`, Ruff, mypy, `pyproject.toml`, GitHub Actions, and a
`uv`, `pytest`, Ruff, mypy, `rumdl`, `pyproject.toml`, GitHub Actions, and a
pull-request-based workflow with `pre-commit` hooks.

This repository is both a tutorial and a working example. It introduces each
Expand Down Expand Up @@ -32,6 +32,7 @@ By following the guide, you will learn how to:
- inspect statement and branch coverage with pytest-cov,
- lint and format code with Ruff,
- check type annotations with mypy,
- lint Markdown documentation with `rumdl`,
- automate fast checks with `pre-commit` hooks,
- run automated quality checks in GitHub Actions,
- work with branches, commits, and pull requests.
Expand All @@ -57,7 +58,8 @@ understand why each tool and file is introduced.
11. [Static type checking with mypy](docs/11_type_checking_with_mypy.md)
12. [Test coverage with pytest-cov](docs/12_test_coverage.md)
13. [`pre-commit` hooks](docs/13_pre_commit_hooks.md)
14. [Project checklist](docs/09_checklist.md)
14. [Markdown linting with rumdl](docs/14_markdown_linting.md)
15. [Project checklist](docs/09_checklist.md)

## Reference material

Expand Down Expand Up @@ -124,6 +126,7 @@ Run the same quality checks used by CI:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
uv build --no-sources
Expand Down
1 change: 1 addition & 0 deletions docs/02_uv.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ How do I run the code?
How do I run the tests?
How do I check code quality?
```

If the project answers these questions clearly, the tooling is doing its job.

## Continue
Expand Down
14 changes: 11 additions & 3 deletions docs/03_pyproject_toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dev = [
"pytest>=9.0.3",
"pytest-cov>=7.1.0",
"ruff>=0.15.12",
"rumdl>=0.2.77",
]

[tool.pytest.ini_options]
Expand All @@ -61,6 +62,13 @@ source = ["text_toolkit"]
[tool.coverage.report]
show_missing = true

[tool.rumdl]
disable = ["MD013"]

[tool.rumdl.per-file-ignores]
".github/pull_request_template.md" = ["MD041"]
"docs/markdown_review.md" = ["MD014"]

[tool.ruff]
line-length = 88
target-version = "py312"
Expand All @@ -77,8 +85,8 @@ select = [
```

This describes the project, its build system, its development dependencies, and
the settings used by pytest, mypy, Coverage.py, and Ruff. `pre-commit` is a
development dependency, but its hooks use the separate
the settings used by pytest, mypy, Coverage.py, Ruff, and `rumdl`. `pre-commit`
is a development dependency, but its hooks use the separate
`.pre-commit-config.yaml` file.

## The `[project]` section
Expand Down Expand Up @@ -147,7 +155,7 @@ This is intentional.

The example package starts with standard library code only.

Development tools such as `pytest`, pytest-cov, mypy, and Ruff are stored
Development tools such as `pytest`, pytest-cov, mypy, Ruff, and `rumdl` are stored
separately in the `dev` dependency group.

## The `[build-system]` section
Expand Down
16 changes: 15 additions & 1 deletion docs/06_github_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ In this project, the local checks are:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
uv build --no-sources
Expand Down Expand Up @@ -171,7 +172,8 @@ The `--group dev` option installs development dependencies such as:
- `pytest`,
- `pytest-cov`,
- `mypy`,
- `ruff`.
- `ruff`,
- `rumdl`.

These tools are needed for checks, but they are not runtime dependencies of the package.

Expand Down Expand Up @@ -214,6 +216,18 @@ The developer can fix formatting locally with:
uv run ruff format .
```

## Markdown linting

The workflow checks Markdown structure and consistency:

```yaml
- name: Lint Markdown
run: uv run rumdl check .
```

The command uses the `[tool.rumdl]` configuration in `pyproject.toml`. It does
not replace the pytest check for local documentation links or human review.

## Tests and coverage

The workflow runs tests and prints a coverage report:
Expand Down
5 changes: 3 additions & 2 deletions docs/07_git_commits_branches_prs.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ A good pull request description may include:

Example:

```markdown
````markdown
## Summary

Adds tests for the text statistics utilities.
Expand All @@ -292,7 +292,7 @@ Local check:
```bash
uv run pytest
```
```
````

## Review mindset

Expand Down Expand Up @@ -334,6 +334,7 @@ For code changes, run:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
```
Expand Down
1 change: 1 addition & 0 deletions docs/08_common_mistakes.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ For code changes, run:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
```
Expand Down
22 changes: 21 additions & 1 deletion docs/09_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ uv run pre-commit install
uv run pre-commit run --all-files
```

## Markdown linting

Documentation should have lightweight automated checks:

- [ ] `rumdl` is installed as a development dependency
- [ ] Markdown rules are configured deliberately
- [ ] project-specific exceptions are narrow and explained
- [ ] linting runs locally, in pre-commit, and in CI
- [ ] link checking and human review remain separate checks

In this guide, Markdown linting runs with:

```bash
uv run rumdl check .
```

## Continuous integration

The project should run checks automatically in CI:
Expand All @@ -186,6 +202,7 @@ The project should run checks automatically in CI:
- [ ] CI installs dependencies from the lockfile
- [ ] CI runs linting
- [ ] CI checks formatting
- [ ] CI lints Markdown
- [ ] CI runs tests with coverage reporting
- [ ] CI runs type checking
- [ ] CI builds a wheel and source distribution
Expand Down Expand Up @@ -234,6 +251,7 @@ For code changes, run:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
uv build --no-sources
Expand All @@ -250,6 +268,7 @@ Then repeat:
```bash
uv run ruff check .
uv run ruff format --check .
uv run rumdl check .
uv run pytest --cov=text_toolkit --cov-report=term-missing
uv run mypy
uv build --no-sources
Expand Down Expand Up @@ -288,6 +307,7 @@ Where are the tests?
How do I run the tests?
How do I inspect test coverage?
How do I check formatting and linting?
How do I lint Markdown documentation?
How do I check type annotations?
How do I build distribution files?
What happens before code is merged?
Expand All @@ -311,5 +331,5 @@ Let the project grow gradually.

## Continue

- [Previous: `pre-commit` Hooks](13_pre_commit_hooks.md)
- [Previous: Markdown Linting with rumdl](14_markdown_linting.md)
- [Back to README](../README.md)
5 changes: 4 additions & 1 deletion docs/13_pre_commit_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ The Ruff hooks:
- apply safe lint fixes,
- format changed Python files.

The local `rumdl` hook lints changed Markdown files using the project's locked
development environment.

These checks are deliberately fast. Tests, coverage, mypy, and distribution
builds remain part of the complete local and CI checks.

Expand Down Expand Up @@ -113,5 +116,5 @@ Keep the complete quality checks visible and understandable.
## Continue

- [Previous: Test Coverage with pytest-cov](12_test_coverage.md)
- [Next: Project Checklist](09_checklist.md)
- [Next: Markdown Linting with rumdl](14_markdown_linting.md)
- [Back to README](../README.md)
Loading
Loading