Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
Binary file removed .coverage
Binary file not shown.
4 changes: 3 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
use flake
watch_file nix/flake.nix
watch_file nix/flake.lock
use flake ./nix
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ jobs:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Prepare dev environment
run: nix develop --command bash -lc 'just venv ${{matrix.python-version}} dev'
run: nix develop ./nix --command bash -lc 'just venv ${{matrix.python-version}} dev'

- name: Verify recorder version metadata
run: nix develop --command bash -lc 'python3 scripts/check_recorder_version.py'
run: nix develop ./nix --command bash -lc 'python3 scripts/check_recorder_version.py'

- name: Rust tests
run: nix develop --command bash -lc 'just cargo-test'
run: nix develop ./nix --command bash -lc 'just cargo-test'

- name: Python tests
run: nix develop --command bash -lc 'just py-test'
run: nix develop ./nix --command bash -lc 'just py-test'

coverage:
name: Coverage (Python 3.12)
Expand All @@ -52,17 +52,17 @@ jobs:
experimental-features = nix-command flakes

- name: Prepare dev environment (Python 3.12)
run: nix develop --command bash -lc 'just venv 3.12 dev'
run: nix develop ./nix --command bash -lc 'just venv 3.12 dev'

- name: Collect coverage
id: coverage-run
run: nix develop --command bash -lc 'just coverage'
run: nix develop ./nix --command bash -lc 'just coverage'

- name: Generate coverage comment
if: steps.coverage-run.outcome == 'success'
run: |
ROOT="$(pwd)"
nix develop --command bash -lc "python3 codetracer-python-recorder/scripts/generate_coverage_comment.py \
nix develop ./nix --command bash -lc "python3 codetracer-python-recorder/scripts/generate_coverage_comment.py \
--rust-summary codetracer-python-recorder/target/coverage/rust/summary.json \
--python-json codetracer-python-recorder/target/coverage/python/coverage.json \
--output codetracer-python-recorder/target/coverage/coverage-comment.md \
Expand Down
224 changes: 0 additions & 224 deletions .github/workflows/maturin-generated.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ build
*~
.idea/
.cargo/

.coverage
**/*.egg-info/
codetracer-python-recorder/codetracer_python_recorder/*.so
26 changes: 24 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,44 @@ venv version=PYTHON_DEFAULT_VERSION:

# Build the module in dev mode
dev:
uv run --directory codetracer-python-recorder maturin develop --uv
uv run --directory codetracer-python-recorder maturin develop --uv --features integration-test

# Run unit tests of dev build
test: cargo-test py-test

# Run Rust unit tests without default features to link Python C library
cargo-test:
uv run cargo nextest run --manifest-path codetracer-python-recorder/Cargo.toml --no-default-features
uv run cargo nextest run --manifest-path codetracer-python-recorder/Cargo.toml --workspace --no-default-features

py-test:
uv run --group dev --group test pytest codetracer-python-recorder/tests/python codetracer-pure-python-recorder

lint: lint-rust lint-errors

lint-rust:
uv run cargo clippy --manifest-path codetracer-python-recorder/Cargo.toml --workspace --no-default-features -- -D clippy::panic

lint-errors:
uv run python3 codetracer-python-recorder/scripts/lint_no_unwraps.py

# Run tests only on the pure recorder
test-pure:
uv run --group dev --group test pytest codetracer-pure-python-recorder

# Inspect ad-hoc error handling patterns across the Rust/Python recorder
errors-audit:
@echo "== PyRuntimeError construction =="
@rg --color=never --no-heading -n "PyRuntimeError::new_err" codetracer-python-recorder/src codetracer-python-recorder/tests codetracer-python-recorder/codetracer_python_recorder || true
@echo
@echo "== unwrap()/expect()/panic! usage =="
@rg --color=never --no-heading -n "\\.unwrap\\(" codetracer-python-recorder/src || true
@rg --color=never --no-heading -n "\\.expect\\(" codetracer-python-recorder/src || true
@rg --color=never --no-heading -n "panic!" codetracer-python-recorder/src || true
@echo
@echo "== Python-side bare RuntimeError/ValueError =="
@rg --color=never --no-heading -n "raise RuntimeError" codetracer-python-recorder/codetracer_python_recorder || true
@rg --color=never --no-heading -n "raise ValueError" codetracer-python-recorder/codetracer_python_recorder || true

# Generate combined coverage artefacts for both crates
coverage:
just coverage-rust
Expand Down
Loading
Loading