qsv-client 0.1.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.
- qsv_client-0.1.0/.github/workflows/ci.yml +51 -0
- qsv_client-0.1.0/.github/workflows/publish.yml +35 -0
- qsv_client-0.1.0/.gitignore +10 -0
- qsv_client-0.1.0/.serena/.gitignore +2 -0
- qsv_client-0.1.0/.serena/memories/conventions.md +10 -0
- qsv_client-0.1.0/.serena/memories/core.md +22 -0
- qsv_client-0.1.0/.serena/memories/memory_maintenance.md +33 -0
- qsv_client-0.1.0/.serena/memories/suggested_commands.md +12 -0
- qsv_client-0.1.0/.serena/memories/task_completion.md +9 -0
- qsv_client-0.1.0/.serena/memories/tech_stack.md +11 -0
- qsv_client-0.1.0/.serena/project.yml +169 -0
- qsv_client-0.1.0/CLAUDE.md +52 -0
- qsv_client-0.1.0/LICENSE +661 -0
- qsv_client-0.1.0/PKG-INFO +156 -0
- qsv_client-0.1.0/README.md +134 -0
- qsv_client-0.1.0/pyproject.toml +52 -0
- qsv_client-0.1.0/src/qsv_client/__init__.py +47 -0
- qsv_client-0.1.0/src/qsv_client/_process.py +147 -0
- qsv_client-0.1.0/src/qsv_client/capabilities.py +131 -0
- qsv_client-0.1.0/src/qsv_client/client.py +491 -0
- qsv_client-0.1.0/src/qsv_client/errors.py +228 -0
- qsv_client-0.1.0/src/qsv_client/py.typed +0 -0
- qsv_client-0.1.0/tests/conftest.py +53 -0
- qsv_client-0.1.0/tests/test_capabilities.py +110 -0
- qsv_client-0.1.0/tests/test_errors.py +93 -0
- qsv_client-0.1.0/tests/test_integration.py +115 -0
- qsv_client-0.1.0/tests/test_process.py +144 -0
- qsv_client-0.1.0/uv.lock +513 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: astral-sh/setup-uv@v6
|
|
17
|
+
- run: uv sync
|
|
18
|
+
- run: uv run ruff check .
|
|
19
|
+
- run: uv run ruff format --check .
|
|
20
|
+
- run: uv run mypy
|
|
21
|
+
|
|
22
|
+
test:
|
|
23
|
+
strategy:
|
|
24
|
+
fail-fast: false
|
|
25
|
+
matrix:
|
|
26
|
+
os: [ubuntu-latest, macos-latest]
|
|
27
|
+
python: ["3.10", "3.11", "3.12", "3.13"]
|
|
28
|
+
runs-on: ${{ matrix.os }}
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: astral-sh/setup-uv@v6
|
|
32
|
+
with:
|
|
33
|
+
python-version: ${{ matrix.python }}
|
|
34
|
+
- run: uv sync
|
|
35
|
+
- name: Download the latest qsv release
|
|
36
|
+
env:
|
|
37
|
+
GH_TOKEN: ${{ github.token }}
|
|
38
|
+
run: |
|
|
39
|
+
if [ "$RUNNER_OS" = "Linux" ]; then target=x86_64-unknown-linux-musl; else target=aarch64-apple-darwin; fi
|
|
40
|
+
mkdir -p "$RUNNER_TEMP/qsv"
|
|
41
|
+
gh release download --repo dathere/qsv --pattern "qsv-*-${target}.zip" --dir "$RUNNER_TEMP/qsv"
|
|
42
|
+
unzip -o -q "$RUNNER_TEMP"/qsv/*.zip -d "$RUNNER_TEMP/qsv"
|
|
43
|
+
chmod +x "$RUNNER_TEMP"/qsv/qsv*
|
|
44
|
+
ls "$RUNNER_TEMP/qsv"
|
|
45
|
+
- name: Unit tests and integration tests (qsv)
|
|
46
|
+
run: QSV_BIN="$RUNNER_TEMP/qsv/qsv" uv run pytest -v
|
|
47
|
+
- name: Integration tests (qsvlite)
|
|
48
|
+
run: QSV_BIN="$RUNNER_TEMP/qsv/qsvlite" uv run pytest -q tests/test_integration.py
|
|
49
|
+
- name: Integration tests (qsvdp)
|
|
50
|
+
if: runner.os == 'Linux'
|
|
51
|
+
run: QSV_BIN="$RUNNER_TEMP/qsv/qsvdp" uv run pytest -q tests/test_integration.py
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: astral-sh/setup-uv@v6
|
|
16
|
+
- run: uv build
|
|
17
|
+
- uses: actions/upload-artifact@v4
|
|
18
|
+
with:
|
|
19
|
+
name: dist
|
|
20
|
+
path: dist/
|
|
21
|
+
|
|
22
|
+
publish:
|
|
23
|
+
needs: build
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
# PyPI Trusted Publishing: configure a publisher for this repo, workflow `publish.yml`
|
|
26
|
+
# and environment `pypi` at https://pypi.org/manage/account/publishing/
|
|
27
|
+
environment: pypi
|
|
28
|
+
permissions:
|
|
29
|
+
id-token: write
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/download-artifact@v4
|
|
32
|
+
with:
|
|
33
|
+
name: dist
|
|
34
|
+
path: dist/
|
|
35
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Conventions
|
|
2
|
+
|
|
3
|
+
- `Qsv` and `AsyncQsv` are hand-mirrored: same method set (`run`, `_run_unchecked`, `capabilities`, `version`, `_probe`, `_check_version_once`, conveniences). Any change to one must be applied to the other. In async, `capabilities`/`version` are coroutines, not properties.
|
|
4
|
+
- Shared non-I/O logic lives in `_Base`; keep I/O in subclasses and `_process.py`.
|
|
5
|
+
- `_process.py` is the only place that spawns/kills processes; it returns `RawResult` and leaves error classification to `_Base._finish` → `errors.error_from_run`.
|
|
6
|
+
- Convenience methods take `(path, *args, **kw)` and forward `**kw` to `run`; `Arg` = str | int | float | PathLike.
|
|
7
|
+
- New qsv error kind: add subclass in `errors.py`, map in `_KIND_TO_CLASS` (and `_EXIT_CODE_TO_CLASS` if it has a distinct exit code), export from `__init__.py`, update README errors table.
|
|
8
|
+
- Full type hints everywhere (mypy strict, tests included). Google-style docstrings (`Args:`/`Raises:`) on public API; private helpers mostly undocumented.
|
|
9
|
+
- Comments only for non-obvious WHY (lowercase, terse).
|
|
10
|
+
- Tests: unit tests use the `fake_qsv(body)` fixture (conftest) — writes an executable Python script standing in for qsv; integration tests use `qsv`/`qsv_bin`/`csv_files` fixtures and skip without a real binary. Integration tests must pass on qsv, qsvlite and qsvdp.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# qsv-client — core
|
|
2
|
+
|
|
3
|
+
Python library that runs the qsv CSV toolkit binary as a subprocess (qsv not bundled). Zero runtime deps. Sync `Qsv` + asyncio `AsyncQsv` with identical API.
|
|
4
|
+
|
|
5
|
+
Related: stack/versions `mem:tech_stack`; dev/test/run commands `mem:suggested_commands`; code style & sync/async mirroring rules `mem:conventions`; done-checklist (ruff/mypy/pytest as CI runs them) `mem:task_completion`.
|
|
6
|
+
|
|
7
|
+
## Source map (`src/qsv_client/`)
|
|
8
|
+
- `client.py` — `_Base` (init, env building, argv, min-version check, `_finish` → result/exception), `Qsv`, `AsyncQsv`, `QsvResult`, `find_qsv` (`$QSV_BIN`, else first of qsv/qsvmcp/qsvdp/qsvlite on PATH).
|
|
9
|
+
- `_process.py` — private spawn/kill layer: `run_sync`/`run_async` return `RawResult`; never raises qsv errors.
|
|
10
|
+
- `errors.py` — `QsvError` hierarchy, exit-code constants, `parse_json_error`, `error_from_run` (kind→class via `_KIND_TO_CLASS`, fallback exit code→class via `_EXIT_CODE_TO_CLASS`).
|
|
11
|
+
- `capabilities.py` — `Capabilities` dataclass; parsers `from_capabilities_json` (`qsv --capabilities`) and `from_version_output` (`--version` + `--list` fallback).
|
|
12
|
+
- `__init__.py` — public re-exports; `py.typed` shipped.
|
|
13
|
+
|
|
14
|
+
## Invariants
|
|
15
|
+
- Every run gets `QSV_ERROR_FORMAT=json` forced in `_Base._build_env` (overrides user env). Older qsv ignores it → classify by exit code.
|
|
16
|
+
- Success = exit code 0 or 255 (`SUCCESS_EXIT_CODES`; 255 = qsv "warning", e.g. broken pipe).
|
|
17
|
+
- Timeout/cancel/KeyboardInterrupt: kill whole process group (POSIX `start_new_session`): SIGTERM, then SIGKILL after `kill_grace`. Timeout → `QsvTimeout` with exit code 124 (`EXIT_TIMEOUT`), raised even when `check=False`.
|
|
18
|
+
- stdin is DEVNULL unless `stdin=` given.
|
|
19
|
+
- LLM secrets go via env (`QSV_LLM_APIKEY`/`_BASE_URL`/`_MODEL`), never argv.
|
|
20
|
+
- `min_version` is enforced inside `_probe` (so it holds however the capabilities cache is filled); `run()` calls `_check_version_once()` first; internal probes use `_run_unchecked` to avoid recursion.
|
|
21
|
+
- Empty `command` string → argv is just `[binary, *args]` (used for `--version`/`--list`/`--capabilities`).
|
|
22
|
+
- Windows: new process group, only qsv itself killed (children not reaped). Officially POSIX/macOS.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Memory Maintenance
|
|
2
|
+
|
|
3
|
+
## Discovery Model
|
|
4
|
+
|
|
5
|
+
- Core principle: progressive discovery through references, building a graph of memories.
|
|
6
|
+
- Initially, agents are provided with the list of all memories (names only).
|
|
7
|
+
- Agents should read `mem:core` as the top-level entry point (graph root).
|
|
8
|
+
This memory should contain references to other memories covering major project domains.
|
|
9
|
+
The referenced memories shall, in turn, shall contain references to even more specific memories, and so on.
|
|
10
|
+
The depth of the graph shall depend on the project complexity.
|
|
11
|
+
- Use topics/folders to group related memories in order to make the content structure explicit.
|
|
12
|
+
Folders can mirror project structure (e.g. modules like frontend/backend) or topics like debugging, architecture, etc.
|
|
13
|
+
- Memory references must use a mem: prefix inside backticks, e.g. `mem:frontend/core`.
|
|
14
|
+
The surrounding text should clearly indicate when to read the memory/which content to expect.
|
|
15
|
+
The text should provide more precise guidance than the memory name alone,
|
|
16
|
+
i.e. avoid a reference like "frontend debugging: `mem:frontend/debugging` and instead make clear which aspects of frontend debugging are covered.
|
|
17
|
+
- Memories themselves should not contain information about when to read them; this is the responsibility of the referring memory.
|
|
18
|
+
|
|
19
|
+
## Style
|
|
20
|
+
|
|
21
|
+
Dense agent notes, not prose docs. Prefer invariants, terse bullets.
|
|
22
|
+
Avoid obvious context, rationale, and examples unless they prevent likely mistakes.
|
|
23
|
+
Keep guidance durable and generalizable, not task-local.
|
|
24
|
+
|
|
25
|
+
## Add/update threshold
|
|
26
|
+
|
|
27
|
+
Add or update memories only with stable, non-obvious project conventions that avoid complex rediscovery in the future.
|
|
28
|
+
Do not add: quick-read facts; generic language/framework knowledge; one-off task notes; volatile line-level details; behavior likely to change soon.
|
|
29
|
+
|
|
30
|
+
## Maintenance Actions
|
|
31
|
+
|
|
32
|
+
- Renaming memories: References are updated automatically if handled via Serena's memory rename tool.
|
|
33
|
+
- Checking for stale memories (e.g. after deletion): Call `serena memories check` for a report.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Suggested commands
|
|
2
|
+
|
|
3
|
+
- Setup: `uv sync`
|
|
4
|
+
- All tests: `uv run pytest` (integration tests use `$QSV_BIN`, else `qsv` on PATH; skip if none)
|
|
5
|
+
- Against a specific binary variant: `QSV_BIN=/path/to/qsvlite uv run pytest -q tests/test_integration.py`
|
|
6
|
+
- Single test: `uv run pytest tests/test_process.py -k <name> -v`
|
|
7
|
+
- Lint: `uv run ruff check .` (autofix: `--fix`)
|
|
8
|
+
- Format: `uv run ruff format .` (CI uses `--check`)
|
|
9
|
+
- Types: `uv run mypy` (files configured in pyproject)
|
|
10
|
+
- Build wheel/sdist: `uv build` (outputs to `dist/`, gitignored)
|
|
11
|
+
|
|
12
|
+
Darwin notes: BSD `sed -i` needs `''` arg; `grep -P` unavailable (use `rg` or `grep -E`).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Task completion
|
|
2
|
+
|
|
3
|
+
Run (mirrors CI lint + test jobs), all must pass:
|
|
4
|
+
1. `uv run ruff format .`
|
|
5
|
+
2. `uv run ruff check .`
|
|
6
|
+
3. `uv run mypy`
|
|
7
|
+
4. `uv run pytest` (with a real qsv available so integration tests don't skip)
|
|
8
|
+
|
|
9
|
+
If the public API or error table changed, update README.md accordingly. If sync client changed, confirm the async mirror changed too (see `mem:conventions`).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Tech stack
|
|
2
|
+
|
|
3
|
+
- Python >=3.10 (ruff `target-version = py310`; CI matrix 3.10–3.13 on ubuntu + macos). Use `from __future__ import annotations`; no 3.11+ only stdlib features.
|
|
4
|
+
- No runtime dependencies — keep it that way (stdlib `subprocess`/`asyncio` only).
|
|
5
|
+
- Package/env manager: uv (`uv.lock` committed); dev deps in `[dependency-groups].dev`: pytest, pytest-asyncio, mypy, ruff.
|
|
6
|
+
- Build: hatchling, src layout (`src/qsv_client`). License AGPL-3.0-or-later.
|
|
7
|
+
- pytest: `asyncio_mode = "auto"` (async tests need no marker).
|
|
8
|
+
- mypy `strict = true` over `src` AND `tests`.
|
|
9
|
+
- ruff line-length 100; lint rules E,F,W,I,B,UP,SIM,RUF; `ruff format` enforced.
|
|
10
|
+
- Release: GitHub release published → `.github/workflows/publish.yml` builds with `uv build`, PyPI Trusted Publishing (env `pypi`). Version is static in `pyproject.toml`.
|
|
11
|
+
- External: real qsv binary needed only for integration tests; CI downloads latest dathere/qsv release and tests qsv, qsvlite, and (Linux) qsvdp variants.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# the name by which the project can be referenced within Serena/when chatting with the LLM.
|
|
2
|
+
project_name: "qsv-client"
|
|
3
|
+
|
|
4
|
+
# list of language servers to start when using the LSP backend; choose from:
|
|
5
|
+
# ada al angular ansible bash
|
|
6
|
+
# bsl clojure cpp cpp_ccls crystal
|
|
7
|
+
# csharp csharp_omnisharp cue dart deno
|
|
8
|
+
# elixir elm erlang fortran fsharp
|
|
9
|
+
# gdscript gleam go groovy haskell
|
|
10
|
+
# haxe hlsl html java json
|
|
11
|
+
# julia kotlin latex lean4 lua
|
|
12
|
+
# luau markdown matlab msl nextflow
|
|
13
|
+
# nix ocaml pascal perl php
|
|
14
|
+
# php_phpactor php_phpantom powershell python python_basedpyright
|
|
15
|
+
# python_jedi python_pyrefly python_ty qml r
|
|
16
|
+
# rego ruby ruby_solargraph rust scala
|
|
17
|
+
# scss solidity svelte swift systemverilog
|
|
18
|
+
# terraform toml typescript typescript_vts vue
|
|
19
|
+
# wolfram yaml zig
|
|
20
|
+
# (This list may be outdated; generated with scripts/print_language_list.py;
|
|
21
|
+
# For the current list, see values of the LanguageServerId enum here:
|
|
22
|
+
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py)
|
|
23
|
+
# For some languages, there are several alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
|
|
24
|
+
# Note:
|
|
25
|
+
# - For C, use cpp
|
|
26
|
+
# - For JavaScript, use typescript
|
|
27
|
+
# - For Angular projects, use angular (subsumes typescript+html; requires `npm install` in the project root)
|
|
28
|
+
# - For Svelte projects, use svelte (subsumes typescript/javascript for .svelte projects; requires npm)
|
|
29
|
+
# - For Deno projects, use deno (serves the same .ts/.js files as typescript; requires the deno CLI on PATH)
|
|
30
|
+
# - For SCSS / Sass / plain CSS, use scss (some-sass-language-server handles all three)
|
|
31
|
+
# - For Free Pascal/Lazarus, use pascal
|
|
32
|
+
# Special requirements:
|
|
33
|
+
# Some language servers require additional setup/installations.
|
|
34
|
+
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
|
|
35
|
+
# When using multiple language servers, the first language server that supports a given file will be used for that file.
|
|
36
|
+
# The first language server is the default language and the respective language server will be used as a fallback.
|
|
37
|
+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
|
|
38
|
+
language_servers:
|
|
39
|
+
- python
|
|
40
|
+
|
|
41
|
+
# the encoding used by text files in the project
|
|
42
|
+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
|
|
43
|
+
encoding: "utf-8"
|
|
44
|
+
|
|
45
|
+
# optional shell command to run before the language backend (LSP or JetBrains) is initialised.
|
|
46
|
+
# the command runs in the project root directory and is only executed if the project is trusted
|
|
47
|
+
# (see trusted_project_path_patterns in the global configuration).
|
|
48
|
+
# serena waits for the command to exit: a non-zero exit code is logged as an error but does not
|
|
49
|
+
# abort activation. a per-project timeout (activation_command_timeout, default 180s) is the safety
|
|
50
|
+
# backstop for non-terminating commands; on expiry the process is killed and activation continues.
|
|
51
|
+
# example: activation_command: "npx nx run-many -t build"
|
|
52
|
+
activation_command:
|
|
53
|
+
|
|
54
|
+
# maximum time in seconds to wait for activation_command to complete before killing it (default 180s).
|
|
55
|
+
# must be a positive number.
|
|
56
|
+
activation_command_timeout: 180.0
|
|
57
|
+
|
|
58
|
+
# line ending convention to use when writing source files.
|
|
59
|
+
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
|
|
60
|
+
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
|
|
61
|
+
line_ending:
|
|
62
|
+
|
|
63
|
+
# The language backend to use for this project.
|
|
64
|
+
# If not set, the global setting from serena_config.yml is used.
|
|
65
|
+
# Valid values: LSP, JetBrains
|
|
66
|
+
# Note: the backend is fixed at startup. If a project with a different backend
|
|
67
|
+
# is activated post-init, an error will be returned.
|
|
68
|
+
language_backend:
|
|
69
|
+
|
|
70
|
+
# whether to use project's .gitignore files to ignore files
|
|
71
|
+
ignore_all_files_in_gitignore: true
|
|
72
|
+
|
|
73
|
+
# advanced configuration option allowing to configure language server-specific options.
|
|
74
|
+
# Maps the language key to the options.
|
|
75
|
+
# The settings are considered only if the project is trusted (see global configuration to define trusted projects).
|
|
76
|
+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#language-server-specific-settings
|
|
77
|
+
ls_specific_settings: {}
|
|
78
|
+
|
|
79
|
+
# list of workspace folder paths (LSP backend only).
|
|
80
|
+
# These folders will be used to build up Serena's symbol index.
|
|
81
|
+
# Paths must be within the project root and should thus be relative to the project root.
|
|
82
|
+
# Furthermore, the paths should not be filtered by ignore settings.
|
|
83
|
+
# Default setting: The entire project root folder (".") is considered.
|
|
84
|
+
# In (large) monorepos, this can be used to index only subfolders of the project root, e.g.
|
|
85
|
+
# ls_workspace_folders:
|
|
86
|
+
# - "./subproject1"
|
|
87
|
+
# - "./subproject2"
|
|
88
|
+
ls_workspace_folders:
|
|
89
|
+
- "."
|
|
90
|
+
|
|
91
|
+
# list of additional workspace folder paths for cross-package reference support.
|
|
92
|
+
# Paths can be absolute or relative to the project root.
|
|
93
|
+
# Each folder is registered as an LSP workspace folder, enabling language servers to discover
|
|
94
|
+
# symbols and references across package boundaries, but these folders are not indexed by Serena,
|
|
95
|
+
# i.e. the respective symbols will not be found using Serena's symbol search tools.
|
|
96
|
+
# Example:
|
|
97
|
+
# additional_workspace_folders:
|
|
98
|
+
# - ../sibling-package
|
|
99
|
+
# - ../shared-lib
|
|
100
|
+
ls_additional_workspace_folders: []
|
|
101
|
+
|
|
102
|
+
# list of additional paths to ignore in this project.
|
|
103
|
+
# Same syntax as gitignore, so you can use * and **.
|
|
104
|
+
# Important: quote patterns that start with `*`, otherwise YAML treats them as aliases.
|
|
105
|
+
# Example:
|
|
106
|
+
# ignored_paths:
|
|
107
|
+
# - "examples/**"
|
|
108
|
+
# - ".worktrees/**"
|
|
109
|
+
# - "**/bin/**"
|
|
110
|
+
# - "**/obj/**"
|
|
111
|
+
# Note: global ignored_paths from serena_config.yml are also applied additively.
|
|
112
|
+
ignored_paths: []
|
|
113
|
+
|
|
114
|
+
# whether the project is in read-only mode
|
|
115
|
+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
|
|
116
|
+
# Added on 2025-04-18
|
|
117
|
+
read_only: false
|
|
118
|
+
|
|
119
|
+
# list of tool names to exclude.
|
|
120
|
+
# This extends the existing exclusions (e.g. from the global configuration)
|
|
121
|
+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
|
122
|
+
excluded_tools: []
|
|
123
|
+
|
|
124
|
+
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
|
|
125
|
+
# This extends the existing inclusions (e.g. from the global configuration).
|
|
126
|
+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
|
127
|
+
included_optional_tools: []
|
|
128
|
+
|
|
129
|
+
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
|
|
130
|
+
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
|
|
131
|
+
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
|
|
132
|
+
fixed_tools: []
|
|
133
|
+
|
|
134
|
+
# list of mode names that are to be activated by default, overriding the setting in the global configuration.
|
|
135
|
+
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
|
|
136
|
+
# If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
|
|
137
|
+
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
|
|
138
|
+
# Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
|
|
139
|
+
# for this project.
|
|
140
|
+
# This setting can, in turn, be overridden by CLI parameters (--mode).
|
|
141
|
+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
|
|
142
|
+
default_modes:
|
|
143
|
+
|
|
144
|
+
# list of mode names to be activated additionally for this project, e.g. ["query-projects"]
|
|
145
|
+
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
|
|
146
|
+
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
|
|
147
|
+
added_modes:
|
|
148
|
+
|
|
149
|
+
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
|
150
|
+
# (contrary to the memories, which are loaded on demand).
|
|
151
|
+
initial_prompt: ""
|
|
152
|
+
|
|
153
|
+
# time budget (seconds) per tool call for the retrieval of additional symbol information
|
|
154
|
+
# such as docstrings or parameter information.
|
|
155
|
+
# This overrides the corresponding setting in the global configuration; see the documentation there.
|
|
156
|
+
# If null or missing, use the setting from the global configuration.
|
|
157
|
+
symbol_info_budget:
|
|
158
|
+
|
|
159
|
+
# list of regex patterns which, when matched, mark a memory entry as read‑only.
|
|
160
|
+
# Extends the list from the global configuration, merging the two lists.
|
|
161
|
+
read_only_memory_patterns: []
|
|
162
|
+
|
|
163
|
+
# list of regex patterns for memories to completely ignore.
|
|
164
|
+
# Matching memories will not appear in list_memories or activate_project output
|
|
165
|
+
# and cannot be accessed via read_memory or write_memory.
|
|
166
|
+
# To access ignored memory files, use the read_file tool on the raw file path.
|
|
167
|
+
# Extends the list from the global configuration, merging the two lists.
|
|
168
|
+
# Example: ["_archive/.*", "_episodes/.*"]
|
|
169
|
+
ignored_memory_patterns: []
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Python library that runs the [qsv](https://github.com/dathere/qsv) CSV toolkit as a subprocess
|
|
4
|
+
(qsv itself is not bundled). Sync `Qsv` and asyncio `AsyncQsv` clients with the same API.
|
|
5
|
+
No runtime dependencies. Python 3.10+.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
uv sync # setup
|
|
11
|
+
uv run pytest # all tests; integration tests need $QSV_BIN or qsv on PATH
|
|
12
|
+
QSV_BIN=/path/to/qsvlite uv run pytest -q tests/test_integration.py # other binary variants
|
|
13
|
+
uv run ruff format . && uv run ruff check . && uv run mypy # must be clean before done
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
CI runs lint, format check, and mypy, plus tests on ubuntu/macos x Python 3.10–3.13 against
|
|
17
|
+
qsv, qsvlite, and qsvdp (Linux only).
|
|
18
|
+
|
|
19
|
+
## Layout (`src/qsv_client/`)
|
|
20
|
+
|
|
21
|
+
- `client.py`: `_Base` (env, argv, min-version check, `_finish` turns the raw result into
|
|
22
|
+
`QsvResult` or an exception), `Qsv`, `AsyncQsv`, `find_qsv`.
|
|
23
|
+
- `_process.py`: the only place that spawns and kills processes. Returns `RawResult` and never
|
|
24
|
+
raises qsv errors.
|
|
25
|
+
- `errors.py`: the `QsvError` hierarchy and exit-code constants. `error_from_run` maps errors
|
|
26
|
+
by JSON `kind` first, then by exit code.
|
|
27
|
+
- `capabilities.py`: parses `qsv --capabilities`, falling back to `--version` + `--list`.
|
|
28
|
+
|
|
29
|
+
## Invariants
|
|
30
|
+
|
|
31
|
+
- `_Base._build_env` always sets `QSV_ERROR_FORMAT=json`. Older qsv versions ignore it, so
|
|
32
|
+
their errors are classified by exit code.
|
|
33
|
+
- Exit codes 0 and 255 (qsv's "warning") count as success.
|
|
34
|
+
- On timeout, cancellation, or KeyboardInterrupt, the whole process group is killed: SIGTERM,
|
|
35
|
+
then SIGKILL after `kill_grace`. A timeout raises `QsvTimeout` (exit code 124) even when
|
|
36
|
+
`check=False`.
|
|
37
|
+
- LLM settings for describegpt are passed as env vars (`QSV_LLM_*`), never on argv.
|
|
38
|
+
- `min_version` is enforced inside `_probe`, so it holds however the capabilities cache is
|
|
39
|
+
filled. Internal probes use `_run_unchecked` to avoid recursing into the version check.
|
|
40
|
+
|
|
41
|
+
## Conventions
|
|
42
|
+
|
|
43
|
+
- `Qsv` and `AsyncQsv` are mirrored by hand. Apply every change to both. In `AsyncQsv`,
|
|
44
|
+
`capabilities` and `version` are coroutines, not properties.
|
|
45
|
+
- Keep it dependency-free and 3.10-compatible (`from __future__ import annotations`).
|
|
46
|
+
- mypy is strict and covers `tests/` too. Ruff line length is 100.
|
|
47
|
+
- New error kind: add a subclass in `errors.py`, map it in `_KIND_TO_CLASS` (and
|
|
48
|
+
`_EXIT_CODE_TO_CLASS` if it has its own exit code), export it from `__init__.py`, and update
|
|
49
|
+
the README errors table.
|
|
50
|
+
- Tests: unit tests use the `fake_qsv(body)` fixture (an executable Python stand-in for qsv).
|
|
51
|
+
Integration tests use the `qsv`/`csv_files` fixtures, skip without a real binary, and must
|
|
52
|
+
pass on qsv, qsvlite, and qsvdp.
|