From aff9025a4e5e950ab1380687e97fc0af9c180059 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 20 Nov 2026 13:56:10 +0100 Subject: [PATCH 1/3] Add AGENTS.md --- AGENTS.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..0a43750 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,44 @@ +# Agent guidelines + +Rules for anyone (human or AI) changing Vecorel CLI, collected from recurring review comments. + +## Scope + +- Vecorel CLI is generic: nothing specific to fiboa, an extension or a dataset belongs here. +- Behaviour that several converters need belongs here, not in each downstream converter. Offer it + as a declarative attribute on `BaseConverter` (like `crs`, `side_files`, `id_columns`) that a + converter sets, not as a method it has to override. +- fiboa CLI and other tools build on the converter attributes and hooks. Keep them backwards + compatible where possible. +- Schemas use the Vecorel SDL, which is not JSON Schema. Only support the keywords that the SDL + defines. + +## Code + +- Reuse what exists instead of adding a second copy that can disagree with the first, e.g. the + type mappings in `vecorel_cli/parquet/types.py`, `_sql_name` for SQL identifiers, or the + existing CRS checks. +- The GeoPandas and DuckDB paths (converters and `vec merge`) must give the same results. Change + and test both. +- Fail with a clear error instead of guessing, silently falling back or dropping data. Don't add + implicit defaults that hide a problem. +- Don't add code for niche cases that no dataset has. Add it when a dataset needs it. +- For changes on the conversion or write path, measure the cost on large datasets (millions of + rows). +- Change dependencies in `pyproject.toml` and `pixi.lock` together. CI tests the oldest and + newest supported Python through the pixi environments `dev-py311` and `dev-py314`. + +## Tests + +- Keep tests proportionate +- Tests and fixtures must actually exercise the code paths they are meant to cover. + +## Changelog and PRs + +- Every non-trivial change needs a `CHANGELOG.md` entry (CI checks it). +- Changelog entries are short and user-facing, without internals, in Added / Changed / Fixed / etc. +- Keep PRs small and focused (one topic) and target `main`. Say if a PR depends on another one. +- Write `#123` only for issues and PRs of this repository, `owner/repo#123` for others, and no `#` in + front of other numbers. +- Keep code comments, PR descriptions and review replies short. Answer questions in a sentence or two. +- Run `pixi run check` (lint, format, tests) before pushing. From c18636dc77131118cdb8e638bef1b8f8b6373138 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 20 Nov 2026 15:53:24 +0100 Subject: [PATCH 2/3] Split into CONTRIBUTING, AGENTS file --- AGENTS.md | 44 +++++--------------------------------------- CONTRIBUTING.md | 43 +++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 3 files changed, 49 insertions(+), 39 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/AGENTS.md b/AGENTS.md index 0a43750..2156b5f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,44 +1,10 @@ # Agent guidelines -Rules for anyone (human or AI) changing Vecorel CLI, collected from recurring review comments. +Follow [CONTRIBUTING.md](CONTRIBUTING.md) and the [Development](README.md#development) section of +the README. In addition: -## Scope - -- Vecorel CLI is generic: nothing specific to fiboa, an extension or a dataset belongs here. -- Behaviour that several converters need belongs here, not in each downstream converter. Offer it - as a declarative attribute on `BaseConverter` (like `crs`, `side_files`, `id_columns`) that a - converter sets, not as a method it has to override. -- fiboa CLI and other tools build on the converter attributes and hooks. Keep them backwards - compatible where possible. -- Schemas use the Vecorel SDL, which is not JSON Schema. Only support the keywords that the SDL - defines. - -## Code - -- Reuse what exists instead of adding a second copy that can disagree with the first, e.g. the - type mappings in `vecorel_cli/parquet/types.py`, `_sql_name` for SQL identifiers, or the - existing CRS checks. -- The GeoPandas and DuckDB paths (converters and `vec merge`) must give the same results. Change - and test both. -- Fail with a clear error instead of guessing, silently falling back or dropping data. Don't add - implicit defaults that hide a problem. -- Don't add code for niche cases that no dataset has. Add it when a dataset needs it. -- For changes on the conversion or write path, measure the cost on large datasets (millions of - rows). -- Change dependencies in `pyproject.toml` and `pixi.lock` together. CI tests the oldest and - newest supported Python through the pixi environments `dev-py311` and `dev-py314`. - -## Tests - -- Keep tests proportionate -- Tests and fixtures must actually exercise the code paths they are meant to cover. - -## Changelog and PRs - -- Every non-trivial change needs a `CHANGELOG.md` entry (CI checks it). -- Changelog entries are short and user-facing, without internals, in Added / Changed / Fixed / etc. -- Keep PRs small and focused (one topic) and target `main`. Say if a PR depends on another one. +- Keep PR descriptions, review comments and replies short. Answer questions in a sentence or two, + and don't repeat what the author already did. - Write `#123` only for issues and PRs of this repository, `owner/repo#123` for others, and no `#` in front of other numbers. -- Keep code comments, PR descriptions and review replies short. Answer questions in a sentence or two. -- Run `pixi run check` (lint, format, tests) before pushing. +- Measure or run the code instead of assuming how it behaves. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c52a4e7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,43 @@ +# Contributing to Vecorel CLI + +Thanks for contributing! The [Development](README.md#development) section of the README explains the +setup. The guidelines below collect what reviews ask for most often. + +## Scope + +- Vecorel CLI is generic: nothing specific to fiboa, an extension or a dataset belongs here. +- Behaviour that several converters need belongs here, not in each downstream converter. Offer it + as a declarative attribute on `BaseConverter` (like `crs`, `side_files`, `id_columns`) that a + converter sets, not as a method it has to override. +- fiboa CLI and other tools build on the converter attributes and hooks. Keep them backwards + compatible where possible. +- Schemas use the Vecorel SDL, which is not JSON Schema. Only support the keywords that the SDL + defines. + +## Code + +- Reuse what exists instead of adding a second copy that can disagree with the first, e.g. the + type mappings in `vecorel_cli/parquet/types.py`, `_sql_name` for SQL identifiers, or the + existing CRS checks. +- The GeoPandas and DuckDB paths (converters and `vec merge`) must give the same results. Change + and test both. +- Fail with a clear error instead of guessing, silently falling back or dropping data. Don't add + implicit defaults that hide a problem. +- Don't add code for niche cases that no dataset has. Add it when a dataset needs it. +- For changes on the conversion or write path, measure the cost on large datasets (millions of + rows). +- Change dependencies in `pyproject.toml` and `pixi.lock` together. CI tests the oldest and + newest supported Python through the pixi environments `dev-py311` and `dev-py314`. + +## Tests + +- Keep tests proportionate. +- Tests and fixtures must actually exercise the code paths they are meant to cover. + +## Changelog and pull requests + +- Every non-trivial change needs a `CHANGELOG.md` entry (CI checks it). +- Changelog entries are short and user-facing, without internals, in Added / Changed / Fixed / etc. +- Keep PRs small and focused (one topic) and target `main`. Say if a PR depends on another one. +- Keep code comments and PR descriptions short. +- Run `pixi run -e dev check` (lint, format, tests) before pushing. diff --git a/README.md b/README.md index 7092f01..df94c30 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,7 @@ See [Implement a converter](#implement-a-converter) for details about how to ## Development This project uses [Pixi](https://pixi.sh/) for dependency management and development workflows. +See [CONTRIBUTING.md](CONTRIBUTING.md) for the guidelines. ```bash # Install all dependencies including development tools From fc165db25a372920088a94fadc4d1133e79b1064 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 20 Nov 2026 16:10:48 +0100 Subject: [PATCH 3/3] Rewritten --- CONTRIBUTING.md | 65 +++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c52a4e7..27bad17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,41 +3,58 @@ Thanks for contributing! The [Development](README.md#development) section of the README explains the setup. The guidelines below collect what reviews ask for most often. +## Responsibility and AI + +- You are responsible for everything you contribute, no matter how it was made. Check all of it + before you ask for a review: reviewing a contribution should take less work than making it. +- Comments, reviews and replies on GitHub that are addressed to people should be written by a human + and concisely for a human. +- Saying in the PR that you used AI is appreciated. Commits don't need AI attribution, as the + responsibility is entirely yours. + ## Scope - Vecorel CLI is generic: nothing specific to fiboa, an extension or a dataset belongs here. -- Behaviour that several converters need belongs here, not in each downstream converter. Offer it - as a declarative attribute on `BaseConverter` (like `crs`, `side_files`, `id_columns`) that a - converter sets, not as a method it has to override. -- fiboa CLI and other tools build on the converter attributes and hooks. Keep them backwards - compatible where possible. -- Schemas use the Vecorel SDL, which is not JSON Schema. Only support the keywords that the SDL - defines. +- Behaviour that several converters need belongs here, ideally as a declarative attribute on the + [base converter](vecorel_cli/conversion/base.py) rather than a method to override. +- fiboa CLI and other tools build on these attributes, so keep them backwards compatible where + possible. +- Schemas use the [Vecorel SDL](https://github.com/vecorel/sdl), which is not JSON Schema. + +## Converters + +- A conversion with the [base converter](vecorel_cli/conversion/base.py) runs these steps in order: + 1. Download the `sources` and read them with `open_options` + 2. `file_migration` (per file), then reprojection to `crs` + 3. `migrate` + 4. `column_filters` + 5. `column_additions` + 6. `column_migrations` + 7. `post_migrate` + 8. Create the `id` (e.g. from `id_columns`) and drop rows that miss required values + 9. Rename the columns as listed in `columns`, fix the geometries, number repeated ids and drop all + other columns + + Until step 9, the columns have the source's names. +- Keep this order when changing the base converter, as converters rely on it. ## Code -- Reuse what exists instead of adding a second copy that can disagree with the first, e.g. the - type mappings in `vecorel_cli/parquet/types.py`, `_sql_name` for SQL identifiers, or the - existing CRS checks. -- The GeoPandas and DuckDB paths (converters and `vec merge`) must give the same results. Change - and test both. -- Fail with a clear error instead of guessing, silently falling back or dropping data. Don't add - implicit defaults that hide a problem. -- Don't add code for niche cases that no dataset has. Add it when a dataset needs it. -- For changes on the conversion or write path, measure the cost on large datasets (millions of - rows). -- Change dependencies in `pyproject.toml` and `pixi.lock` together. CI tests the oldest and - newest supported Python through the pixi environments `dev-py311` and `dev-py314`. +- Reuse existing helpers instead of adding a second copy that can disagree with the first. +- The GeoPandas and DuckDB paths must give the same results, so change and test both. +- Fail with a clear error instead of guessing, silently falling back or dropping data. +- Don't add code for niche cases until a dataset needs it. +- Measure the cost of changes to the conversion or write path on large datasets. +- Update `pixi.lock` together with the dependencies in `pyproject.toml`. ## Tests -- Keep tests proportionate. -- Tests and fixtures must actually exercise the code paths they are meant to cover. +- Keep tests proportionate, and make sure they cover what they claim to. ## Changelog and pull requests - Every non-trivial change needs a `CHANGELOG.md` entry (CI checks it). -- Changelog entries are short and user-facing, without internals, in Added / Changed / Fixed / etc. -- Keep PRs small and focused (one topic) and target `main`. Say if a PR depends on another one. +- Changelog entries are short and user-facing. +- Keep PRs small and focused on one topic, and say if a PR depends on another one. - Keep code comments and PR descriptions short. -- Run `pixi run -e dev check` (lint, format, tests) before pushing. +- Run `pixi run -e dev check` before pushing.