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
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,41 @@ jobs:
- name: "Run pytest"
run: uv run --no-sync pytest -v

typecheck:
name: type check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@stable

- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.13"

- name: "Install uv"
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: false

- name: "Install dependencies"
run: uv sync --locked --python 3.13 --no-default-groups --group ci --group typecheck --no-install-project

- name: "Run maturin"
run: uv run --no-sync maturin develop --locked

- name: "Run mypy"
run: uv run --no-sync mypy

- name: "Run pyright"
run: uv run --no-sync pyright

- name: "Check the stub against the compiled module"
run: uv run --no-sync python -m mypy.stubtest markupever._rustlib

test-os:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ help:
@echo -e "\tbuild-prod build source (release mode)"
@echo -e "\ttest-rs clippy and test rust code"
@echo -e "\ttest-py build and test python code"
@echo -e "\ttest-types build and type check python code"
@echo -e "\tformat format rust and python code"
@echo -e "\tclean clean all the unneeded files"

Expand All @@ -30,6 +31,12 @@ test-py: build-dev
ruff clean
coverage html

.PHONY: test-types
test-types: build-dev
mypy
pyright
python -m mypy.stubtest markupever._rustlib

.PHONY: format
format:
ruff format --line-length=100 .
Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dynamic = ["description", "license", "readme", "version"]
dev = [
{ include-group = "ci" },
{ include-group = "lint" },
{ include-group = "typecheck" },
]
ci = [
{ include-group = "maturin" },
Expand All @@ -43,6 +44,7 @@ test = [
"coverage>=7.16.2",
"pytest>=9.1.1",
]
typecheck = ["mypy>=2.4.0", "pyright[nodejs]>=1.1.414"]

[build-system]
requires = ["maturin>=1.7,<2.0"]
Expand All @@ -52,3 +54,12 @@ build-backend = "maturin"
features = ["pyo3/extension-module"]
module-name = "markupever._rustlib"
python-source = "python"

[tool.mypy]
files = ["python/markupever"]
python_version = "3.10"
strict = true

[tool.pyright]
include = ["python/markupever"]
pythonVersion = "3.10"
Loading
Loading