| description | Guidelines for contributing to City2Graph. Learn how to report bugs, suggest features, and submit pull requests to help improve the project. | |
|---|---|---|
| keywords | contributing, pull request, bug report, feature request, development environment, pre-commit, pytest, code style, ruff, documentation | |
| hide |
|
We welcome contributions to the City2Graph project! This document provides guidelines for contributing to the project.
-
Fork the repository on GitHub.
-
Clone your fork locally:
git clone https://github.com/<your-name>/city2graph.git cd city2graph git remote add upstream https://github.com/c2g-dev/city2graph.git
-
Set up the development environment:
uv sync --group dev --extra cpu source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Create a new branch for your changes:
git checkout -b your-feature-name
-
Make your changes to the codebase.
-
Run pre-commit checks before committing:
uv run pre-commit run --all-files
-
Run the tests to ensure your changes don't break existing functionality:
uv run pytest -q
-
Update or add documentation as needed.
-
Commit your changes with a descriptive commit message.
We follow strict code quality standards using the following tools:
- Ruff: For linting and formatting Python code
- mypy: For static type checking
- numpydoc: For docstring style validation
Key style guidelines:
- Use 4 spaces for indentation.
- Maximum line length of 88 characters.
- Use docstrings following numpydoc conventions for all public modules, functions, classes, and methods.
- Use type hints where appropriate.
Pre-commit hooks will automatically run these checks when you commit changes.
When contributing new features or making significant changes, please update the documentation:
- Add docstrings to all public functions, classes, and methods.
- Update the relevant documentation files in the
docsdirectory. - If adding a new feature, consider adding an example to
docs/examples/index.md.
-
Push your changes to your fork:
git push origin your-feature-name
-
Open a pull request on GitHub.
-
Describe your changes in the pull request description.
-
Reference any related issues that your pull request addresses.
Your pull request will be reviewed, and you may be asked to make changes before it's merged.
To build and preview the documentation locally:
-
Create and activate a virtual environment with uv:
uv venv docs-env source docs-env/bin/activate # On Windows: docs-env\Scripts\activate
-
Install documentation dependencies:
uv pip install -e ".[docs]" -
Build the documentation:
uv run mkdocs serve
-
Open
http://127.0.0.1:8000/in your browser to view the documentation.