Skip to content

Commit cb6c5c9

Browse files
authored
v0.6.0 (#6)
Features: - Add on_start and on_end callbacks to Timer (one call per measurement; sync only) - Callbacks receive the same Measurement (on_start before timings set, on_end after) Improvements: - Add Zensical docs site (guide, recipes, about) and GitHub Pages deployment - CI: pip-audit, 100% coverage enforcement, Python 3.10–3.14 matrix, standardized workflow names - Release and Pages workflows; Timer constructor keyword-only; Beta status in pyproject - Add CODE_OF_CONDUCT, SECURITY, .editorconfig, GitHub issue/PR templates - Restructure Makefile (init/clean, help); update CONTRIBUTING and pre-commit - Add block_timing Behave feature (callbacks, metadata, nested/threaded scenarios) - README: callbacks example, link to docs site; __version__ removed from __all__"
1 parent d9b0001 commit cb6c5c9

32 files changed

Lines changed: 1542 additions & 158 deletions

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
# Top-most EditorConfig file; root = true stops search at this directory
3+
root = true
4+
5+
# Defaults for all files
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
# Python
15+
[*.py]
16+
indent_size = 4
17+
18+
# YAML files (e.g. workflows, pre-commit config)
19+
[*.{yml,yaml}]
20+
indent_size = 2
21+
22+
# Markdown files (trailing whitespace often meaningful)
23+
[*.md]
24+
trim_trailing_whitespace = false
25+
26+
# Makefile (requires tab indentation)
27+
[Makefile]
28+
indent_style = tab
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of what the bug is.
12+
13+
## Steps to Reproduce
14+
15+
1.
16+
2.
17+
3.
18+
19+
## Expected Behavior
20+
21+
What you expected to happen.
22+
23+
## Actual Behavior
24+
25+
What actually happened.
26+
27+
## Environment
28+
29+
- OS: [e.g., macOS 14.0, Ubuntu 22.04]
30+
- Python version: [e.g., 3.12.0 — run `python --version`]
31+
- How you installed TimeRun: [e.g., pip from PyPI, editable install, git clone]
32+
33+
## Additional Context
34+
35+
Add any other context, logs, or information about the problem here. See [CONTRIBUTING.md](https://github.com/HH-MWB/timerun/blob/main/CONTRIBUTING.md#reporting-bugs) for more guidance.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Description
10+
11+
A clear and concise description of what you want to happen.
12+
13+
## Motivation
14+
15+
Explain why this feature would be useful. What problem does it solve?
16+
17+
## Proposed Solution
18+
19+
Describe how you envision this feature working.
20+
21+
## Alternatives Considered
22+
23+
Describe any alternative solutions or features you've considered.
24+
25+
## Additional Context
26+
27+
Add any other context or examples about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Description
2+
3+
Brief description of what this PR does and why.
4+
5+
## Type of Change
6+
7+
- [ ] Bug fix (non-breaking change which fixes an issue)
8+
- [ ] New feature (non-breaking change which adds functionality)
9+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10+
- [ ] Documentation update
11+
- [ ] Other (please describe):
12+
13+
## Related Issues
14+
15+
Fixes #
16+
17+
## Checklist
18+
19+
- [ ] I have run `make lint test` and both pass
20+
- [ ] For new or changed behavior, I have added or updated BDD scenarios in `features/`
21+
- [ ] I have updated the documentation accordingly (if applicable)

.github/workflows/ci.yaml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,52 @@
11
---
2-
name: Continuous Integration
2+
name: Run continuous integration
33

44
# yamllint disable-line rule:truthy
55
on:
66
pull_request:
7-
branches: [main]
7+
branches:
8+
- main
89
push:
9-
branches: [main]
10+
branches:
11+
- main
1012

1113
permissions:
1214
contents: read
1315

16+
concurrency:
17+
group: ci-${{ github.ref }}
18+
cancel-in-progress: true
19+
1420
jobs:
1521
lint:
22+
name: Lint
1623
runs-on: ubuntu-latest
1724
steps:
1825
- name: Checkout code
1926
uses: actions/checkout@v6
2027

21-
- name: Set up Python 3.11
28+
- name: Set up Python 3.10
2229
uses: actions/setup-python@v6
2330
with:
24-
python-version: '3.11'
31+
python-version: '3.10'
32+
cache: 'pip'
2533

2634
- name: Run pre-commit hooks
2735
uses: pre-commit/action@v3.0.1
2836

2937
test:
38+
name: Test
3039
runs-on: ubuntu-latest
3140
needs: lint
3241
strategy:
42+
fail-fast: false
3343
matrix:
34-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
44+
python-version:
45+
- '3.10'
46+
- '3.11'
47+
- '3.12'
48+
- '3.13'
49+
- '3.14'
3550
steps:
3651
- name: Checkout code
3752
uses: actions/checkout@v6
@@ -40,9 +55,13 @@ jobs:
4055
uses: actions/setup-python@v6
4156
with:
4257
python-version: ${{ matrix.python-version }}
58+
cache: 'pip'
4359

4460
- name: Install test dependencies
45-
run: pip install -e ".[dev]"
61+
run: python -m pip install -e ".[dev]"
62+
63+
- name: Audit dependencies
64+
run: python -m pip_audit
4665

4766
- name: Run tests with coverage
4867
run: |
@@ -57,6 +76,7 @@ jobs:
5776
flags: python${{ matrix.python-version }}
5877

5978
build:
79+
name: Build
6080
runs-on: ubuntu-latest
6181
needs: test
6282
steps:
@@ -67,9 +87,10 @@ jobs:
6787
uses: actions/setup-python@v6
6888
with:
6989
python-version: '3.11'
90+
cache: 'pip'
7091

7192
- name: Install build dependencies
72-
run: pip install build twine
93+
run: python -m pip install build twine
7394

7495
- name: Build package
7596
run: python -m build

.github/workflows/pages.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Deploy docs to GitHub Pages
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
push:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
name: Build site
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v6
27+
28+
- name: Set up Python 3.11
29+
uses: actions/setup-python@v6
30+
with:
31+
python-version: '3.11'
32+
33+
- name: Create venv and install docs dependencies
34+
run: |
35+
python -m venv .venv
36+
.venv/bin/pip install -e ".[docs]"
37+
38+
- name: Build site
39+
run: .venv/bin/zensical build
40+
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v4
43+
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: site
48+
49+
deploy:
50+
name: Deploy site
51+
environment:
52+
name: github-pages
53+
url: ${{ steps.deploy.outputs.page_url }}
54+
runs-on: ubuntu-latest
55+
needs: build
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deploy
59+
uses: actions/deploy-pages@v4

.github/workflows/release.yaml

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,96 @@
1+
---
12
name: Release to PyPI
23

4+
# yamllint disable-line rule:truthy
35
on:
4-
workflow_dispatch:
6+
release:
7+
types:
8+
- published
9+
- edited
510

611
permissions:
7-
contents: write
8-
id-token: write
12+
contents: read
13+
14+
concurrency:
15+
group: release
16+
cancel-in-progress: false
917

1018
jobs:
11-
release:
19+
build:
20+
name: Build distribution
1221
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
1324
steps:
1425
- name: Checkout code
1526
uses: actions/checkout@v6
27+
with:
28+
persist-credentials: false
1629

1730
- name: Set up Python 3.11
1831
uses: actions/setup-python@v6
1932
with:
2033
python-version: '3.11'
34+
cache: 'pip'
35+
36+
- name: Upgrade pip
37+
run: python -m pip install --upgrade pip
2138

2239
- name: Install build dependencies
23-
run: pip install build
40+
run: python -m pip install build twine
2441

2542
- name: Build package
2643
run: python -m build
2744

28-
- name: Release to PyPI
45+
- name: Check package
46+
run: twine check dist/*
47+
48+
- name: Store the distribution packages
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: python-package-distributions
52+
path: dist/
53+
54+
publish-testpypi:
55+
name: Publish to TestPyPI
56+
needs: build
57+
if: github.event.release.prerelease
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
id-token: write
62+
environment:
63+
name: testpypi
64+
url: https://test.pypi.org/project/timerun/
65+
steps:
66+
- name: Download distribution packages
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: python-package-distributions
70+
path: dist/
71+
72+
- name: Publish to TestPyPI
2973
uses: pypa/gh-action-pypi-publish@release/v1
74+
with:
75+
repository-url: https://test.pypi.org/legacy/
3076

31-
- name: Create tag
32-
run: |
33-
VERSION=$(python -c "import timerun; print(timerun.__version__)")
34-
git tag "v$VERSION"
35-
git push origin "v$VERSION"
77+
publish-pypi:
78+
name: Publish to PyPI
79+
needs: build
80+
if: ${{ !github.event.release.prerelease }}
81+
runs-on: ubuntu-latest
82+
permissions:
83+
contents: read
84+
id-token: write
85+
environment:
86+
name: pypi
87+
url: https://pypi.org/project/timerun/
88+
steps:
89+
- name: Download distribution packages
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: python-package-distributions
93+
path: dist/
94+
95+
- name: Publish to PyPI
96+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)