behave-trace 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. behave_trace-1.0.0/.editorconfig +18 -0
  2. behave_trace-1.0.0/.github/ISSUE_TEMPLATE/bug_report.yml +56 -0
  3. behave_trace-1.0.0/.github/ISSUE_TEMPLATE/feature_request.yml +25 -0
  4. behave_trace-1.0.0/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  5. behave_trace-1.0.0/.github/dependabot.yml +10 -0
  6. behave_trace-1.0.0/.github/workflows/ci.yml +48 -0
  7. behave_trace-1.0.0/.github/workflows/docs.yml +45 -0
  8. behave_trace-1.0.0/.github/workflows/release.yml +88 -0
  9. behave_trace-1.0.0/.gitignore +24 -0
  10. behave_trace-1.0.0/.markdownlint.json +8 -0
  11. behave_trace-1.0.0/.pre-commit-config.yaml +18 -0
  12. behave_trace-1.0.0/CHANGELOG.md +55 -0
  13. behave_trace-1.0.0/CODE_OF_CONDUCT.md +59 -0
  14. behave_trace-1.0.0/CONTRIBUTING.md +56 -0
  15. behave_trace-1.0.0/LICENSE +21 -0
  16. behave_trace-1.0.0/Makefile +61 -0
  17. behave_trace-1.0.0/PKG-INFO +171 -0
  18. behave_trace-1.0.0/README.md +132 -0
  19. behave_trace-1.0.0/SECURITY.md +21 -0
  20. behave_trace-1.0.0/behave_trace/__init__.py +61 -0
  21. behave_trace-1.0.0/behave_trace/__main__.py +10 -0
  22. behave_trace-1.0.0/behave_trace/assets/css/viewer.css +828 -0
  23. behave_trace-1.0.0/behave_trace/assets/index.html +361 -0
  24. behave_trace-1.0.0/behave_trace/assets/js/viewer.js +244 -0
  25. behave_trace-1.0.0/behave_trace/attach.py +141 -0
  26. behave_trace-1.0.0/behave_trace/cli/__init__.py +0 -0
  27. behave_trace-1.0.0/behave_trace/cli/app.py +109 -0
  28. behave_trace-1.0.0/behave_trace/collector.py +343 -0
  29. behave_trace-1.0.0/behave_trace/formatter.py +115 -0
  30. behave_trace-1.0.0/behave_trace/models.py +381 -0
  31. behave_trace-1.0.0/behave_trace/py.typed +0 -0
  32. behave_trace-1.0.0/behave_trace/serializer.py +232 -0
  33. behave_trace-1.0.0/behave_trace/utils.py +43 -0
  34. behave_trace-1.0.0/behave_trace/viewer/__init__.py +0 -0
  35. behave_trace-1.0.0/behave_trace/viewer/browser.py +59 -0
  36. behave_trace-1.0.0/behave_trace/viewer/server.py +141 -0
  37. behave_trace-1.0.0/behave_trace.pth +1 -0
  38. behave_trace-1.0.0/docs/architecture.md +104 -0
  39. behave_trace-1.0.0/docs/attachments.md +99 -0
  40. behave_trace-1.0.0/docs/changelog.md +4 -0
  41. behave_trace-1.0.0/docs/cli.md +63 -0
  42. behave_trace-1.0.0/docs/contributing.md +56 -0
  43. behave_trace-1.0.0/docs/index.md +83 -0
  44. behave_trace-1.0.0/docs/installation.md +80 -0
  45. behave_trace-1.0.0/docs/python-api.md +30 -0
  46. behave_trace-1.0.0/docs/quickstart.md +80 -0
  47. behave_trace-1.0.0/examples/calculator/README.md +29 -0
  48. behave_trace-1.0.0/examples/calculator/calculator.py +79 -0
  49. behave_trace-1.0.0/examples/calculator/features/calculator.feature +31 -0
  50. behave_trace-1.0.0/examples/calculator/features/environment.py +17 -0
  51. behave_trace-1.0.0/examples/calculator/features/steps/calculator_steps.py +77 -0
  52. behave_trace-1.0.0/mkdocs.yml +83 -0
  53. behave_trace-1.0.0/pyproject.toml +105 -0
  54. behave_trace-1.0.0/tests/__init__.py +0 -0
  55. behave_trace-1.0.0/tests/e2e/environment.py +108 -0
  56. behave_trace-1.0.0/tests/e2e/steps/steps.py +194 -0
  57. behave_trace-1.0.0/tests/e2e/trace.feature +28 -0
  58. behave_trace-1.0.0/tests/features/environment.py +1 -0
  59. behave_trace-1.0.0/tests/features/simple.feature +11 -0
  60. behave_trace-1.0.0/tests/features/steps/steps.py +32 -0
  61. behave_trace-1.0.0/tests/test_attach.py +292 -0
  62. behave_trace-1.0.0/tests/test_cli.py +277 -0
  63. behave_trace-1.0.0/tests/test_cli_show.py +171 -0
  64. behave_trace-1.0.0/tests/test_collector.py +414 -0
  65. behave_trace-1.0.0/tests/test_formatter.py +269 -0
  66. behave_trace-1.0.0/tests/test_formatter_capture.py +147 -0
  67. behave_trace-1.0.0/tests/test_models.py +331 -0
  68. behave_trace-1.0.0/tests/test_serializer.py +384 -0
  69. behave_trace-1.0.0/tests/test_server.py +229 -0
  70. behave_trace-1.0.0/tests/test_utils.py +103 -0
@@ -0,0 +1,18 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+
9
+ [*.py]
10
+ indent_style = space
11
+ indent_size = 4
12
+
13
+ [*.{yaml,yml}]
14
+ indent_style = space
15
+ indent_size = 2
16
+
17
+ [Makefile]
18
+ indent_style = tab
@@ -0,0 +1,56 @@
1
+ name: Bug report
2
+ description: Report a bug or unexpected behavior
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes:
8
+ label: Description
9
+ description: A clear description of the bug.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: reproduce
14
+ attributes:
15
+ label: Steps to reproduce
16
+ description: Steps to reproduce the behavior.
17
+ value: |
18
+ 1. Run `behave --format behave-trace -o trace.json ...`
19
+ 2. Run `behave-trace show trace.json`
20
+ 3. See error
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: expected
25
+ attributes:
26
+ label: Expected behavior
27
+ description: What you expected to happen.
28
+ validations:
29
+ required: true
30
+ - type: textarea
31
+ id: actual
32
+ attributes:
33
+ label: Actual behavior
34
+ description: What actually happened.
35
+ validations:
36
+ required: true
37
+ - type: input
38
+ id: version
39
+ attributes:
40
+ label: behave-trace version
41
+ description: Output of `behave-trace --version`
42
+ validations:
43
+ required: true
44
+ - type: input
45
+ id: python
46
+ attributes:
47
+ label: Python version
48
+ validations:
49
+ required: true
50
+ - type: textarea
51
+ id: trace
52
+ attributes:
53
+ label: Trace JSON (if applicable)
54
+ description: Attach the trace.json file or paste relevant content.
55
+ validations:
56
+ required: false
@@ -0,0 +1,25 @@
1
+ name: Feature request
2
+ description: Suggest a new feature or improvement
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: Problem
9
+ description: What problem does this feature solve?
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: solution
14
+ attributes:
15
+ label: Proposed solution
16
+ description: What would you like to see happen?
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: alternatives
21
+ attributes:
22
+ label: Alternatives considered
23
+ description: Any alternative solutions you've considered.
24
+ validations:
25
+ required: false
@@ -0,0 +1,22 @@
1
+ ## Summary
2
+
3
+ <!-- Brief description of what this PR changes and why. -->
4
+
5
+ ## Changes
6
+
7
+ -
8
+
9
+ ## Type of change
10
+
11
+ - [ ] Bug fix
12
+ - [ ] New feature
13
+ - [ ] Breaking change
14
+ - [ ] Documentation
15
+ - [ ] Refactor / cleanup
16
+
17
+ ## Testing checklist
18
+
19
+ - [ ] `make lint` passes (ruff check + mypy --strict)
20
+ - [ ] `make format-check` passes (ruff format --check)
21
+ - [ ] `make test-cov` passes with >= 90% coverage
22
+ - [ ] New tests added for new behavior
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: "/"
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,48 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ lint:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.13"
21
+ - run: pip install -e ".[dev]"
22
+ - run: ruff check .
23
+ - run: ruff format --check .
24
+ - run: mypy --strict behave_trace
25
+
26
+ test:
27
+ runs-on: ${{ matrix.os }}
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ os: [ubuntu-latest]
32
+ python-version: ["3.11", "3.12", "3.13"]
33
+ include:
34
+ - os: windows-latest
35
+ python-version: "3.13"
36
+ - os: macos-latest
37
+ python-version: "3.13"
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - uses: actions/setup-python@v5
41
+ with:
42
+ python-version: ${{ matrix.python-version }}
43
+ - run: pip install -e ".[dev]"
44
+ - run: python -m build
45
+ - run: pytest tests/ -v --cov --cov-report=xml --timeout=60
46
+ - uses: codecov/codecov-action@v5
47
+ with:
48
+ files: ./coverage.xml
@@ -0,0 +1,45 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ concurrency:
14
+ group: pages
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ build-deploy:
19
+ runs-on: ubuntu-latest
20
+ environment:
21
+ name: github-pages
22
+ url: ${{ steps.deployment.outputs.page_url }}
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.13"
31
+
32
+ - name: Install docs dependencies
33
+ run: pip install -e ".[docs]"
34
+
35
+ - name: Build site
36
+ run: mkdocs build --strict
37
+
38
+ - uses: actions/configure-pages@v5
39
+
40
+ - uses: actions/upload-pages-artifact@v3
41
+ with:
42
+ path: ./site
43
+
44
+ - id: deployment
45
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,88 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "pyproject.toml"
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ build:
15
+ name: Build distributions
16
+ runs-on: ubuntu-latest
17
+ outputs:
18
+ version: ${{ steps.version.outputs.version }}
19
+ bump: ${{ steps.version.outputs.bump }}
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0
24
+ - uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.13"
27
+ - name: Detect version bump
28
+ id: version
29
+ run: |
30
+ NEW_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
31
+ echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
32
+ if git rev-parse "v$NEW_VERSION" >/dev/null 2>&1; then
33
+ echo "bump=false" >> "$GITHUB_OUTPUT"
34
+ else
35
+ echo "bump=true" >> "$GITHUB_OUTPUT"
36
+ fi
37
+ - name: Build distributions
38
+ if: steps.version.outputs.bump == 'true'
39
+ run: |
40
+ pip install build
41
+ python -m build
42
+ - uses: actions/upload-artifact@v4
43
+ if: steps.version.outputs.bump == 'true'
44
+ with:
45
+ name: dist
46
+ path: dist/
47
+
48
+ publish:
49
+ name: Publish to PyPI (Trusted Publishing)
50
+ needs: build
51
+ if: needs.build.outputs.bump == 'true'
52
+ runs-on: ubuntu-latest
53
+ environment: pypi
54
+ permissions:
55
+ id-token: write
56
+ steps:
57
+ - uses: actions/download-artifact@v4
58
+ with:
59
+ name: dist
60
+ path: dist/
61
+ - name: Publish to PyPI
62
+ uses: pypa/gh-action-pypi-publish@v1.12.4
63
+
64
+ release:
65
+ name: Create GitHub Release
66
+ needs: [build, publish]
67
+ if: needs.build.outputs.bump == 'true'
68
+ runs-on: ubuntu-latest
69
+ permissions:
70
+ contents: write
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+ with:
74
+ fetch-depth: 0
75
+ - name: Create git tag
76
+ run: |
77
+ git tag "v${{ needs.build.outputs.version }}"
78
+ git push origin "v${{ needs.build.outputs.version }}"
79
+ - uses: actions/download-artifact@v4
80
+ with:
81
+ name: dist
82
+ path: dist/
83
+ - name: Create GitHub Release
84
+ uses: softprops/action-gh-release@v2.2.2
85
+ with:
86
+ tag_name: "v${{ needs.build.outputs.version }}"
87
+ generate_release_notes: true
88
+ files: dist/*
@@ -0,0 +1,24 @@
1
+ ref/
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .eggs/
9
+ *.egg
10
+ .venv/
11
+ venv/
12
+ .env
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+ .pytest_cache/
16
+ htmlcov/
17
+ .coverage
18
+ .coverage.*
19
+ bin/
20
+ tmp-clean-venv/
21
+ tmp-e2e/
22
+ examples/*/trace.json
23
+ site/
24
+ ref/
@@ -0,0 +1,8 @@
1
+ {
2
+ "MD013": {
3
+ "line_length": 120
4
+ },
5
+ "MD024": {
6
+ "siblings_only": true
7
+ }
8
+ }
@@ -0,0 +1,18 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-toml
9
+ - id: check-json
10
+ - id: check-merge-conflict
11
+ - id: check-added-large-files
12
+ - id: detect-private-key
13
+ - repo: https://github.com/astral-sh/ruff-pre-commit
14
+ rev: v0.8.0
15
+ hooks:
16
+ - id: ruff
17
+ args: [--check]
18
+ - id: ruff-format
@@ -0,0 +1,55 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 1.0.0 — 2025-08-03
9
+
10
+ ### Added
11
+
12
+ - **Trace formatter** (`behave_trace.formatter:TraceFormatter`) — captures Behave
13
+ execution events (features, scenarios, steps, statuses, durations, errors) into
14
+ a structured `Trace` model.
15
+ - **Collector** (`Collector`) — accumulates events from Behave's formatter API
16
+ into `Trace`, `Feature`, `Scenario`, `Step` dataclasses with computed stats.
17
+ - **Serializer** (`Serializer`) — JSON serialization/deserialization for trace
18
+ files with full round-trip fidelity.
19
+ - **Attachment API** (`attach_screenshot`, `attach_dom`, `attach_text`, `log`) —
20
+ high-level helpers for capturing screenshots, DOM snapshots, and log lines
21
+ from `environment.py` hooks.
22
+ - **CLI** (`behave-trace`) — `show` subcommand that loads a trace file, starts
23
+ a local HTTP server, and opens the viewer in a browser (Chrome app mode
24
+ preferred, falls back to default browser).
25
+ - **Viewer server** (`ViewerServer`) — stdlib-only `ThreadingHTTPServer` serving
26
+ static assets and `/api/trace` endpoint with gzip compression and path
27
+ traversal protection.
28
+ - **Viewer frontend** — single-page application with Alpine.js (CDN, no build
29
+ step), dark theme, Playwright-inspired layout:
30
+ - Header with status badges and duration
31
+ - Sidebar with filters (all / failed / slow), scenario tree, and stats
32
+ - Timeline with colored segments and scrubable cursor
33
+ - Step list with status icons, keywords, durations, and mini-badges
34
+ - Step detail with tabs: Screenshot, Snapshot (before/after), Source,
35
+ Console, Error, Artifacts
36
+ - Filmstrip with screenshot thumbnails
37
+ - Empty state
38
+ - **Example project** (`examples/calculator/`) — a real Behave project
39
+ demonstrating screenshots, DOM snapshots, logs, and a failing scenario.
40
+ - **E2E tests** — meta Behave suite that runs Behave with `behave-trace`
41
+ formatter on inner test features and verifies the trace JSON structure,
42
+ statuses, artifacts, stats, and environment capture.
43
+ - **Unit tests** — 199 tests covering models, collector, formatter, serializer,
44
+ attach API, CLI, server, and utils.
45
+ - **CI/CD** — GitHub Actions workflows for lint (ruff), typecheck (mypy),
46
+ test (pytest with coverage + codecov) on Python 3.11-3.13 across
47
+ Ubuntu/Windows/macOS, automated release to PyPI via Trusted Publishing,
48
+ and MkDocs documentation deployment to GitHub Pages.
49
+ - **Documentation** — MkDocs Material site with installation, quickstart,
50
+ CLI reference, attachments guide, Python API (mkdocstrings), architecture,
51
+ and contributing guide.
52
+ - **Community files** — CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md,
53
+ PR/issue templates, dependabot configuration.
54
+ - **Developer tooling** — Makefile, pre-commit hooks, .editorconfig,
55
+ .markdownlint.json, py.typed marker.
@@ -0,0 +1,59 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes
24
+ - Focusing on what is best for the overall community, not just us as individuals
25
+
26
+ Examples of unacceptable behavior include:
27
+
28
+ - The use of sexualized language or imagery, and sexual attention or advances
29
+ - Trolling, insulting or derogatory comments, and personal or political attacks
30
+ - Public or private harassment
31
+ - Publishing others' private information without their explicit permission
32
+ - Other conduct which could reasonably be considered inappropriate
33
+
34
+ ## Enforcement Responsibilities
35
+
36
+ Community leaders are responsible for clarifying and enforcing our standards
37
+ of acceptable behavior and will take appropriate and fair corrective action in
38
+ response to any behavior that they deem inappropriate, threatening, offensive,
39
+ or harmful.
40
+
41
+ ## Scope
42
+
43
+ This Code of Conduct applies within all community spaces, and also applies
44
+ when an individual is officially representing the community in public spaces.
45
+
46
+ ## Enforcement
47
+
48
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
49
+ reported to **mathias@paulenko.dev**. All complaints will be reviewed and
50
+ investigated promptly and fairly.
51
+
52
+ ## Attribution
53
+
54
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
55
+ version 2.1, available at
56
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
57
+
58
+ [homepage]: https://www.contributor-covenant.org
59
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
@@ -0,0 +1,56 @@
1
+ # Contributing to behave-trace
2
+
3
+ Thanks for your interest in contributing! This guide covers setup, common
4
+ commands, and the release process.
5
+
6
+ ## Setup
7
+
8
+ ```bash
9
+ git clone https://github.com/MathiasPaulenko/behave-trace.git
10
+ cd behave-trace
11
+ make dev
12
+ pre-commit install
13
+ ```
14
+
15
+ ## Development commands
16
+
17
+ | Command | Description |
18
+ | ------------------- | -------------------------------------------- |
19
+ | `make help` | Show all available targets. |
20
+ | `make dev` | Install with dev extras. |
21
+ | `make lint` | Run `ruff check` + `mypy --strict`. |
22
+ | `make lint-fix` | Auto-fix lint issues. |
23
+ | `make format` | Format the code with `ruff format`. |
24
+ | `make format-check` | Verify formatting without changes. |
25
+ | `make test` | Run the test suite. |
26
+ | `make test-cov` | Run tests with coverage (fail under 90%). |
27
+ | `make check` | Full pre-commit check (lint + format + test).|
28
+ | `make build` | Build sdist + wheel into `dist/`. |
29
+ | `make clean` | Remove build artifacts and caches. |
30
+
31
+ ## Pre-PR checklist
32
+
33
+ Before opening a pull request, make sure all of the following pass:
34
+
35
+ - [ ] `make check` (runs lint + format-check + test)
36
+ - [ ] `make test-cov` passes with >= 90% coverage
37
+ - [ ] New behavior is covered by tests
38
+ - [ ] `CHANGELOG.md` updated under `[Unreleased]`
39
+
40
+ ## Release process
41
+
42
+ Releases are automated via the `release.yml` GitHub Actions workflow:
43
+
44
+ 1. Bump the version in `pyproject.toml`.
45
+ 2. Move the `[Unreleased]` section in `CHANGELOG.md` to the new version.
46
+ 3. Commit and push to `main`.
47
+ 4. The workflow detects the version bump, creates a git tag, builds the
48
+ distributions, publishes to PyPI via Trusted Publishing (OIDC), and
49
+ creates a GitHub Release with auto-generated notes.
50
+
51
+ ## Code style
52
+
53
+ - Python >=3.11, `from __future__ import annotations` in every module.
54
+ - `ruff` for linting and formatting (line length 100).
55
+ - `mypy --strict` with no errors.
56
+ - Public API documented with docstrings.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mathias Paulenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,61 @@
1
+ .PHONY: help install dev lint lint-fix format format-check test test-cov clean build check docs docs-serve
2
+
3
+ help: ## Show this help message
4
+ @echo "Available targets:"
5
+ @echo " make install - Editable install (no dev extras)"
6
+ @echo " make dev - Editable install with dev extras"
7
+ @echo " make lint - Run ruff check + mypy --strict"
8
+ @echo " make lint-fix - Auto-fix lint issues with ruff"
9
+ @echo " make format - Format code with ruff format"
10
+ @echo " make format-check - Verify formatting without changes"
11
+ @echo " make test - Run the test suite"
12
+ @echo " make test-cov - Run tests with coverage (fail under 90%)"
13
+ @echo " make check - Run lint + format-check + test (full pre-commit check)"
14
+ @echo " make build - Build sdist + wheel into dist/"
15
+ @echo " make docs - Build documentation site"
16
+ @echo " make docs-serve - Serve documentation locally"
17
+ @echo " make clean - Remove build artifacts and caches"
18
+
19
+ install: ## Editable install (no dev extras)
20
+ pip install -e .
21
+
22
+ dev: ## Editable install with dev extras
23
+ pip install -e ".[dev]"
24
+
25
+ lint: ## Run ruff check + mypy --strict
26
+ ruff check .
27
+ mypy --strict behave_trace
28
+
29
+ lint-fix: ## Auto-fix lint issues
30
+ ruff check --fix .
31
+
32
+ format: ## Format code with ruff format
33
+ ruff format .
34
+
35
+ format-check: ## Verify formatting without changes
36
+ ruff format --check .
37
+
38
+ test: ## Run the test suite
39
+ pytest
40
+
41
+ test-cov: ## Run tests with coverage (fail under 90%)
42
+ pytest --cov=behave_trace --cov-report=term-missing --cov-fail-under=90
43
+
44
+ check: ## Run lint + format-check + test (full pre-commit check)
45
+ ruff check .
46
+ ruff format --check .
47
+ mypy --strict behave_trace
48
+ pytest
49
+
50
+ build: ## Build sdist + wheel into dist/
51
+ python -m build
52
+
53
+ docs: ## Build documentation site
54
+ mkdocs build --strict
55
+
56
+ docs-serve: ## Serve documentation locally
57
+ mkdocs serve
58
+
59
+ clean: ## Remove build artifacts and caches
60
+ python -c "import shutil, pathlib; [shutil.rmtree(p, ignore_errors=True) for p in ['dist','build','.pytest_cache','.mypy_cache','.ruff_cache','htmlcov'] + list(pathlib.Path('.').glob('*.egg-info'))]"
61
+ python -c "import shutil, pathlib; [shutil.rmtree(p, ignore_errors=True) for p in pathlib.Path('.').rglob('__pycache__')]"