diff --git a/.claude/skills/memray/SKILL.md b/.claude/skills/memray/SKILL.md index 79f704ea6..94f2feaed 100644 --- a/.claude/skills/memray/SKILL.md +++ b/.claude/skills/memray/SKILL.md @@ -1,9 +1,8 @@ --- - name: memray description: Profile the memory usage of a Python script using memray and visualize a temporal flamegraph in the browser. Use when the user wants to investigate memory consumption, find leaks, or understand allocation patterns. compatibility: Requires the pixi profiling environment (pixi run -e profiling). Supports Linux and macOS. -allowed-tools: Bash(pixi run -e profiling memray-run:_) Bash(pixi run -e profiling memray-flame:_) Bash(open:_) Bash(xdg-open:_) Bash(python -m webbrowser:*) +allowed-tools: Bash(pixi run -e profiling memray-run:*) Bash(pixi run -e profiling memray-flame:*) Bash(open:*) Bash(xdg-open:*) Bash(python -m webbrowser:*) --- ## Steps @@ -12,24 +11,24 @@ allowed-tools: Bash(pixi run -e profiling memray-run:_) Bash(pixi run -e profili 2. Run the script under memray: - ```bash - pixi run -e profiling memray-run script.py - ``` + ```bash + pixi run -e profiling memray-run script.py + ``` - This produces a binary file named `memray-script.py..bin` in the current directory. + This produces a binary file named `memray-script.py..bin` in the current directory. 3. Generate the flamegraph HTML report from the `.bin` file: - ```bash - pixi run -e profiling memray-flame memray-script.py..bin - ``` + ```bash + pixi run -e profiling memray-flame memray-script.py..bin + ``` - Replace `` with the actual PID shown in the filename. This writes `memray-flamegraph-script.py..html`. + Replace `` with the actual PID shown in the filename. This writes `memray-flamegraph-script.py..html`. 4. Open the report in the browser: - - macOS: `open memray-flamegraph-script.py..html` - - Linux: `xdg-open memray-flamegraph-script.py..html` - - Either: `python -m webbrowser memray-flamegraph-script.py..html` + - macOS: `open memray-flamegraph-script.py..html` + - Linux: `xdg-open memray-flamegraph-script.py..html` + - Either: `python -m webbrowser memray-flamegraph-script.py..html` ## Notes diff --git a/.claude/skills/profimp/SKILL.md b/.claude/skills/profimp/SKILL.md index 5f54fa007..2da0903a8 100644 --- a/.claude/skills/profimp/SKILL.md +++ b/.claude/skills/profimp/SKILL.md @@ -1,17 +1,16 @@ --- - name: profimp description: Profile Python import time using profimp and open a waterfall HTML report. Use when investigating slow startup or wanting to identify which imports are most expensive. compatibility: Requires profimp (available as a pixi dependency). macOS or Linux. -allowed-tools: Bash(profimp:_) Bash(open:_) Bash(xdg-open:_) Bash(python -m webbrowser:_) +allowed-tools: Bash(profimp:*) Bash(open:*) Bash(xdg-open:*) Bash(python -m webbrowser:*) --- ## Steps 1. Ask what to profile. Suggest common patterns for this repo: - - `import spatialdata` - - `from spatialdata import SpatialData` - - `from spatialdata_io import xenium` + - `import spatialdata` + - `from spatialdata import SpatialData` + - `from spatialdata_io import xenium` 2. Run: @@ -20,9 +19,9 @@ profimp --html "" > /tmp/profimp.html ``` 3. Open the report: - - macOS: `open /tmp/profimp.html` - - Linux: `xdg-open /tmp/profimp.html` - - Either: `python -m webbrowser /tmp/profimp.html` + - macOS: `open /tmp/profimp.html` + - Linux: `xdg-open /tmp/profimp.html` + - Either: `python -m webbrowser /tmp/profimp.html` ## Notes diff --git a/.claude/skills/pyspy/SKILL.md b/.claude/skills/pyspy/SKILL.md index 97c9a487f..00c6408c7 100644 --- a/.claude/skills/pyspy/SKILL.md +++ b/.claude/skills/pyspy/SKILL.md @@ -1,9 +1,8 @@ --- - name: pyspy description: Profile the execution time of a Python script using py-spy and visualize the result with speedscope. Use when the user wants to benchmark performance, find slow code paths, or profile CPU time. compatibility: Requires the pixi profiling environment (pixi run -e profiling). Speedscope must be installed separately (npm install -g speedscope). sudo is required on macOS. -allowed-tools: Bash(pixi run -e profiling pyspy:_) Bash(pixi run -e profiling speedscope:_) Bash(sudo pixi run -e profiling pyspy:*) +allowed-tools: Bash(pixi run -e profiling pyspy:*) Bash(pixi run -e profiling speedscope:*) Bash(sudo pixi run -e profiling pyspy:*) --- ## Steps @@ -12,33 +11,31 @@ allowed-tools: Bash(pixi run -e profiling pyspy:_) Bash(pixi run -e profiling sp 2. Run py-spy to record the profile. The output is always written to `profile.speedscope.json` in the current directory. - **Linux** (no sudo needed): + **Linux** (no sudo needed): - ```bash - pixi run -e profiling pyspy script.py - ``` + ```bash + pixi run -e profiling pyspy script.py + ``` - **macOS** (sudo required — py-spy needs to attach to the process): + **macOS** (sudo required — py-spy needs to attach to the process): - ```bash - sudo pixi run -e profiling pyspy script.py - ``` + ```bash + sudo pixi run -e profiling pyspy script.py + ``` - If sudo fails to find the pixi environment, use absolute paths: + If sudo fails to find the pixi environment, use absolute paths: - ```bash - sudo /path/to/.pixi/envs/profiling/bin/py-spy record --gil \ - -o profile.speedscope.json --format speedscope \ - -- /path/to/.pixi/envs/profiling/bin/python script.py - ``` + ```bash + sudo /path/to/.pixi/envs/profiling/bin/py-spy record --gil \ + -o profile.speedscope.json --format speedscope \ + -- /path/to/.pixi/envs/profiling/bin/python script.py + ``` 3. Open the result in speedscope: - - ```bash - pixi run -e profiling speedscope - ``` - - This opens `profile.speedscope.json` in the browser via the local speedscope CLI. + ```bash + pixi run -e profiling speedscope + ``` + This opens `profile.speedscope.json` in the browser via the local speedscope CLI. ## Notes diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1a6258fd8..0debe4dd8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,7 @@ repos: - id: biome-format exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually. groups: [format] + # further file exclusions and other options are configured in biome.jsonc - repo: https://github.com/tox-dev/pyproject-fmt rev: v2.30.3 hooks: diff --git a/biome.jsonc b/biome.jsonc index a70f80c13..6fa28f0cd 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.6.3/schema.json", + "$schema": "https://biomejs.dev/schemas/2.6.4/schema.json", "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true }, "formatter": { "useEditorconfig": true }, "overrides": [ @@ -19,4 +19,11 @@ "json": { "parser": { "allowComments": true } }, }, ], + "files": { + "includes": [ + "**", + // Claude Code skills and settings, not project source. + "!.claude", + ], + }, }