Skip to content

Contributing

We welcome contributions to the project. Thank you in advance for your contribution to githubkit!

Development Environment

Open in Codespaces (Dev Container):

Open in GitHub Codespaces

Local development environment setup:

Make sure you have installed uv.

uv sync --all-extras && uv run pre-commit install

GitHub Schema Update

Generate latest models and apis from GitHub's OpenAPI schema:

Warning

This may use about 400M memory and take a long time.

uv run bash ./scripts/run-codegen.sh

If you encounter rate limit error, you can set GITHUB_TOKEN environment variable to a GitHub personal access token.

Note

All schema packages under the packages directory are generated by codegen, so please do not modify them manually. Package versions are also automatically updated by codegen.

Patch Schema

If you encounter schema error, you can patch the schema by modifying the pyproject.toml file.

In the [tool.codegen.overrides.schema_overrides] section, you can modify the schema using json pointer. The value will override the original schema.

Specially, if the json pointer points to a dictionary, you can use special value <unset> to remove the key from the dictionary. If the json pointer points to a array, you can use a list value to replace the original array. Or you can use a dict with key <add> and <remove> to add or remove items from the array. For any json pointer, you can use a dict with key "" to replace the pointer data by the value pointer's data.

Please add a comment to explain the reason for the patch if you want to submit a PR.

Testing

Run tests with pytest:

env GITHUB_TOKEN='<your token here>' uv run --no-sync pytest -n auto tests

If you want to switch between pydantic v1 and v2, you can use the following command:

# Pydantic v1
uv sync --all-extras --group pydantic-v1
# Pydantic v2
uv sync --all-extras --group pydantic-v2