Skip to content

Commit ba51fd8

Browse files
Replace Makefile with poethepoet (#69)
1 parent a3bfaa0 commit ba51fd8

5 files changed

Lines changed: 106 additions & 91 deletions

File tree

.github/workflows/main.yml

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,59 @@
11
name: CI
22

3-
on: [ pull_request ]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- '*'
10+
workflow_dispatch:
411

512
jobs:
613

7-
backend:
8-
name: lint + test
14+
test:
15+
name: test
916
runs-on: ubuntu-latest
10-
1117
strategy:
12-
max-parallel: 4
18+
max-parallel: 5
1319
matrix:
1420
python-version: [ "3.9", "3.10", "3.11", "3.12" , "3.13" ]
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v5
28+
with:
29+
enable-cache: true
30+
cache-dependency-glob: "**/pyproject.toml"
31+
- name: Install dependencies
32+
run: uv sync --all-extras
33+
- name: Test with pytest
34+
run: uv run poe test
1535

36+
coverage:
37+
name: test + lint + coverage
38+
runs-on: ubuntu-latest
1639
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-python@v3
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: install
22-
run: |
23-
python -m pip install -U pip
24-
pip install -e ".[dev]"
25-
- name: lint
26-
run: |
27-
make lint
28-
- name: test
29-
run: |
30-
make coverage
31-
coverage report
40+
- uses: actions/checkout@v4
41+
- uses: actions/setup-python@v5
42+
with:
43+
python-version: "3.13"
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v5
46+
with:
47+
enable-cache: true
48+
cache-dependency-glob: "**/pyproject.toml"
49+
- name: Install dependencies
50+
run: uv sync --all-extras
51+
- name: Check linting
52+
run: uv run poe lint
53+
- name: Test with pytest
54+
run: uv run coverage run -m pytest --benchmark-skip
55+
- name: Generate coverage report
56+
run: |
57+
echo "# Coverage Report" >> $GITHUB_STEP_SUMMARY
58+
uv run coverage report --format=markdown >> $GITHUB_STEP_SUMMARY || true
59+
uv run coverage json -q # will cause pipeline failure if coverage < minimum

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*.mo
77
*.nja
88
*.py[co]
9+
.benchmarks
910
.cache
1011
.coverage
1112
.idea
@@ -19,7 +20,7 @@
1920
/.project
2021
/.pydevproject
2122
build
22-
coverage_html
23+
htmlcov
2324
dist
2425
venv
2526

Makefile

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

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Writing:
9191

9292
## TAG_KEY_MAPPING
9393

94-
Most fields contain string values, but some like first_authors (A1) are parsed into lists. The default mapping is
94+
Most fields contain string values, but some like first_authors (A1) are parsed into lists. The default mapping is
9595
created from specifications scattered around the web, but to our knowledge there is not one single source of RIS truth,
9696
so these may need to be modified for specific export systems:
9797

@@ -314,24 +314,31 @@ support. Software specializing in these formats includes:
314314

315315
## Developer instructions
316316

317-
Common developer commands are in the provided `Makefile`; if you don't have `make` installed, you can view the make
318-
commands and run the commands from the command-line manually:
317+
Install [uv](https://docs.astral.sh/uv/) and make it available and on your path. Then:
319318

320319
```bash
321320
# setup environment
322-
python -m venv venv
323-
source venv/bin/activate
324-
python -m pip install -U pip
325-
python -m pip install -e ".[dev]"
321+
uv venv --python=3.13
322+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
323+
uv pip install -e ".[dev]"
324+
325+
# list available tasks
326+
poe
326327

327328
# check if code format changes are required
328-
make lint
329+
poe lint
329330

330331
# reformat code
331-
make format
332+
poe format
332333

333334
# run tests
334-
make test
335+
poe test
336+
337+
# run benchmark tests
338+
poe bench
335339
```
336340

341+
If you'd prefer not to use `uv`, that's fine too; this is a standard Python package so feel free to use your
342+
preferred workflow.
343+
337344
Github Actions are currently enabled to run `lint` and `test` when submitting a pull-request.

pyproject.toml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ requires-python = ">=3.9"
3030

3131
[project.optional-dependencies]
3232
dev = [
33+
"poethepoet ~= 0.34.0",
3334
"pytest ~=7.4.4",
3435
"pytest-benchmark",
3536
"flit ~= 3.9.0",
@@ -46,8 +47,12 @@ omit = [
4647
"tests/*",
4748
]
4849

50+
[tool.coverage.report]
51+
fail_under=94
52+
precision=1
53+
4954
[tool.flit.sdist]
50-
exclude = [".github", "Makefile", "tests"]
55+
exclude = [".github", "tests"]
5156

5257
[tool.ruff]
5358
line-length = 100
@@ -61,3 +66,36 @@ select = ["F", "E", "W", "I", "UP", "S", "B", "T20", "RUF"]
6166

6267
[tool.pytest.ini_options]
6368
addopts = "--doctest-glob='*.md'"
69+
70+
[tool.poe.tasks.lint]
71+
help = "Check for formatting issues"
72+
sequence = [
73+
{cmd = "ruff format . --check"},
74+
{cmd = "ruff check ."},
75+
]
76+
77+
[tool.poe.tasks.format]
78+
help = "Fix formatting issues (where possible)"
79+
sequence = [
80+
{cmd = "ruff format ."},
81+
{cmd = "ruff check . --fix --show-fixes"},
82+
]
83+
84+
[tool.poe.tasks.test]
85+
help = "Run tests"
86+
cmd = "pytest --benchmark-skip"
87+
88+
[tool.poe.tasks.bench]
89+
help = "Run benchmark tests"
90+
cmd = "pytest --benchmark-only"
91+
92+
[tool.poe.tasks.coverage]
93+
help = "Generate test coverage report"
94+
sequence = [
95+
{cmd = "coverage run -m pytest --benchmark-skip"},
96+
{cmd = "coverage html"},
97+
]
98+
99+
[tool.poe.tasks.build]
100+
help = "Build wheel package"
101+
cmd = "uv build"

0 commit comments

Comments
 (0)