Contributing¶
We'd love your help with iscc-schema, from typo fixes to new schema fields. This page covers everything you need to get a working development environment and submit a pull request.
Getting Started¶
Prerequisites¶
- Python 3.10+ (up to 3.14)
- uv for package management
- Git
Setup¶
This installs all runtime and development dependencies in an isolated virtual environment.
Verify Your Setup¶
This runs the full build pipeline: YAML formatting, code generation, JSON Schema, JSON-LD context, documentation, and tests. If it passes, your environment is set up correctly.
The Golden Rule¶
YAML schemas are the single source of truth. Many files in this project are auto-generated from
the OpenAPI 3.1.0 definitions in iscc_schema/models/*.yaml. Never edit generated files directly -
your changes will be overwritten.
Generated files (do not edit):
iscc_schema/schema.py- Pydantic modelsiscc_schema/generator.py- API modelsiscc_schema/seed_*.py- seed metadata modelsiscc_schema/service_*.py- service metadata modelsiscc_schema/contexts.py- JSON-LD context mappingsdocs/schema/*.json- JSON Schema filesdocs/context/*.jsonld- JSON-LD context files
Hand-editable source files:
iscc_schema/models/*.yaml- schema definitionsiscc_schema/base.py- custom BaseModel with serializationiscc_schema/fields.py- URL validation typeiscc_schema/recovery.py- JSON-LD context recoverytools/*.py- build scripts
Making Changes¶
Workflow¶
- Create a branch from
develop - Make your changes (see task guides below)
- Run
uv run poe allto regenerate artifacts and run tests - Commit your changes (include both source and generated files)
- Open a pull request against
develop
Adding or Modifying a Schema Field¶
- Find the appropriate YAML file in
iscc_schema/models/- fields are grouped by category (basic, technical, crypto, etc.) - Add or modify the property following the existing YAML structure
- Add the field name to the
prioritylist intools/build_json_schema.py(controls property ordering in the generated JSON Schema) - Run
uv run poe all - Check that the field appears correctly in
iscc_schema/schema.pyanddocs/schema/iscc.json
Fixing a Bug in Python Code¶
- Edit the relevant source file (
base.py,fields.py,recovery.py, etc.) - Add a test in
tests/that reproduces the bug - Run
uv run pytestto verify the fix
Improving Documentation¶
Documentation pages in docs/ can be edited directly, except for pages that are generated by
tools/build_docs.py (schema pages, terms, index, changelog). For generated docs, modify the
YAML source or the build script instead.
Serve docs locally to preview your changes:
Code Conventions¶
We use Black with line length 100 for Python formatting
(uv run poe formatcode, or poe all runs it for you). YAML files use 2-space indentation
(uv run poe formatyaml). All files use LF line endings, enforced by the build pipeline.
Type annotations go in PEP 484 type comments, not inline:
Use absolute imports. Write short, pure functions. No nested functions.
Testing¶
Tests live in tests/ and use pytest. Run the full suite with:
Run a specific test:
Guidelines:
- Use real data, not mocks - if something is hard to test without mocking, refactor the code
- Write simple, focused test functions (no test classes)
- Ensure all tests pass before submitting a PR
Build Commands Reference¶
| Command | What it does |
|---|---|
uv run poe all |
Full pipeline: format, generate, test |
uv run poe test |
Run tests only |
uv run poe buildcode |
Regenerate Pydantic models from YAML |
uv run poe buildschema |
Regenerate JSON Schema |
uv run poe buildcontext |
Regenerate JSON-LD context |
uv run poe buildterms |
Regenerate vocabulary docs |
uv run poe formatcode |
Format Python with Black |
uv run poe formatyaml |
Format YAML files |
uv run poe docs-serve |
Preview docs locally |
Questions?¶
Not sure where to start, or want to check whether an idea fits before writing code? Open a GitHub issue and we'll figure it out together.