Skip to content

Commit 4d8c124

Browse files
committed
contributing.md: keep some of the old general guidelines, re-organize into sections depending on phases of development
1 parent 1308840 commit 4d8c124

File tree

1 file changed

+82
-43
lines changed

1 file changed

+82
-43
lines changed

CONTRIBUTING.md

Lines changed: 82 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
11
# Contributing to duckdb-python
22

3-
Start by <a href="https://github.com/duckdb/duckdb-python/fork"><svg height="16" viewBox="0 0 16 16" version="1.1" width="16">
4-
<path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878z"></path>
5-
</svg>forking duckdb-python</a>.
3+
## General Guidelines
64

7-
### Cloning
5+
### **Did you find a bug?**
6+
7+
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/duckdb/duckdb-python/issues).
8+
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/duckdb/duckdb-python/issues/new/choose). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
9+
10+
### **Did you write a patch that fixes a bug?**
11+
12+
* Great!
13+
* If possible, add a unit test case to make sure the issue does not occur again.
14+
* Open a new GitHub pull request with the patch.
15+
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
16+
17+
### Outside Contributors
18+
19+
* Discuss your intended changes with the core team on Github
20+
* Announce that you are working or want to work on a specific issue
21+
* Avoid large pull requests - they are much less likely to be merged as they are incredibly hard to review
22+
23+
### Pull Requests
24+
25+
* Do not commit/push directly to the main branch. Instead, create a fork and file a pull request.
26+
* When maintaining a branch, merge frequently with the main.
27+
* When maintaining a branch, submit pull requests to the main frequently.
28+
* If you are working on a bigger issue try to split it up into several smaller issues.
29+
* Please do not open "Draft" pull requests. Rather, use issues or discussion topics to discuss whatever needs discussing.
30+
* We reserve full and final discretion over whether or not we will merge a pull request. Adhering to these guidelines is not a complete guarantee that your pull request will be merged.
31+
32+
### CI for pull requests
33+
34+
* Pull requests will need to pass all continuous integration checks before merging.
35+
* For faster iteration and more control, consider running CI on your own fork or when possible directly locally.
36+
* Submitting changes to an open pull request will move it to 'draft' state.
37+
* Pull requests will get a complete run on the main repo CI only when marked as 'ready for review' (via Web UI, button on bottom right).
38+
39+
### Nightly CI
40+
41+
* Packages creation and long running tests will be performed during a nightly run
42+
* On your fork you can trigger long running tests (NightlyTests.yml) for any branch following information from https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow#running-a-workflow
43+
44+
## Setting up a development environment
45+
46+
Start by [forking duckdb-python](https://github.com/duckdb/duckdb-python/fork) into
47+
a personal repository.
848

949
After forking the duckdb-python repo we recommend you clone your fork as follows:
1050
```shell
@@ -20,6 +60,9 @@ git remote add upstream https://github.com/duckdb/duckdb-python.git
2060
git fetch --all
2161
```
2262

63+
The submodule stuff is needed because we vendor the core DuckDB repository as a git submodule,
64+
and to build the python package we also need to build DuckDB itself.
65+
2366
### Submodule update hook
2467

2568
If you'll be switching between branches that are have the submodule set to different refs, then make your life
@@ -28,10 +71,10 @@ easier and add the git hooks in the .githooks directory to your local config:
2871
git config --local core.hooksPath .githooks/
2972
```
3073

31-
3274
### Editable installs (general)
3375

34-
It's good to be aware of the following when performing an editable install:
76+
It's good to be aware of the following when performing an editable install:
77+
3578
- `uv sync` or `uv run [tool]` perform an editable install by default. We have
3679
configured the project so that scikit-build-core will use a persistent build-dir, but since the build itself
3780
happens in an isolated, ephemeral environment, cmake's paths will point to non-existing directories. CMake itself
@@ -49,33 +92,31 @@ uv sync --no-build-isolation
4992

5093
### Editable installs (IDEs)
5194

52-
If you're using an IDE then life is a little simpler. You install build dependencies and the project in the two
53-
steps outlined above, and from that point on you can rely on e.g. CLion's cmake capabilities to do incremental
54-
compilation and editable rebuilds. This will skip scikit-build-core's build backend and all of uv's dependency
55-
management, so for "real" builds you better revert to the CLI. However, this should work fine for coding and debugging.
95+
If you're using an IDE then life is a little simpler. You install build dependencies and the project in the two
96+
steps outlined above, and from that point on you can rely on e.g. CLion's cmake capabilities to do incremental
97+
compilation and editable rebuilds. This will skip scikit-build-core's build backend and all of uv's dependency
98+
management, so for "real" builds you better revert to the CLI. However, this should work fine for coding and debugging.
5699

100+
## Day to day development
57101

58-
### Cleaning
102+
After setting up the development environment, these are the most common tasks you'll be performing.
59103

104+
### Tooling
105+
This codebase is developed with the following tools:
106+
- [Astral uv](https://docs.astral.sh/uv/) - for dependency management across all platforms we provide wheels for,
107+
and for Python environment management. It will be hard to work on this codebase without having UV installed.
108+
- [Scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/index.html) - the build backend for
109+
building the extension. On the background, scikit-build-core uses cmake and ninja for compilation.
110+
- [pybind11](https://pybind11.readthedocs.io/en/stable/index.html) - a bridge between C++ and Python.
111+
- [CMake](https://cmake.org/) - the build system for both DuckDB itself and the DuckDB Python module.
112+
- Cibuildwheel
113+
114+
### Cleaning
60115
```shell
61116
uv cache clean
62117
rm -rf build .venv uv.lock
63118
```
64119

65-
66-
### Building wheels and sdists
67-
68-
To build a wheel and sdist for your system and the default Python version:
69-
```bash
70-
uv build
71-
````
72-
73-
To build a wheel for a different Python version:
74-
```bash
75-
# E.g. for Python 3.9
76-
uv build -p 3.9
77-
```
78-
79120
### Running tests
80121

81122
Run all pytests:
@@ -122,10 +163,25 @@ uvx gcovr \
122163
--print-summary
123164
```
124165

125-
### Typechecking and linting
166+
### Typechecking, linting, style, and formatting
126167

127168
- We're not running any mypy typechecking tests at the moment
128169
- We're not running any Ruff / linting / formatting at the moment
170+
- Follow the [Google Python styleguide](https://google.github.io/styleguide/pyguide.html)
171+
- See the section on [Comments and Docstrings](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings)
172+
173+
### Building wheels and sdists
174+
175+
To build a wheel and sdist for your system and the default Python version:
176+
```bash
177+
uv build
178+
````
179+
180+
To build a wheel for a different Python version:
181+
```bash
182+
# E.g. for Python 3.9
183+
uv build -p 3.9
184+
```
129185

130186
### Cibuildwheel
131187

@@ -134,22 +190,6 @@ You can run cibuildwheel locally for Linux. E.g. limited to Python 3.9:
134190
CIBW_BUILD='cp39-*' uvx cibuildwheel --platform linux .
135191
```
136192

137-
### Code conventions
138-
139-
* Follow the [Google Python styleguide](https://google.github.io/styleguide/pyguide.html)
140-
* See the section on [Comments and Docstrings](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings)
141-
142-
### Tooling
143-
144-
This codebase is developed with the following tools:
145-
- [Astral uv](https://docs.astral.sh/uv/) - for dependency management across all platforms we provide wheels for,
146-
and for Python environment management. It will be hard to work on this codebase without having UV installed.
147-
- [Scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/index.html) - the build backend for
148-
building the extension. On the background, scikit-build-core uses cmake and ninja for compilation.
149-
- [pybind11](https://pybind11.readthedocs.io/en/stable/index.html) - a bridge between C++ and Python.
150-
- [CMake](https://cmake.org/) - the build system for both DuckDB itself and the DuckDB Python module.
151-
- Cibuildwheel
152-
153193
### Merging changes to pythonpkg from duckdb main
154194

155195
1. Checkout main
@@ -175,7 +215,6 @@ git log --oneline 71c5c07cdd..c9254ecff2 -- tools/pythonpkg/
175215
git diff --name-status <HASH_A> <HASH_B> -- tools/pythonpkg/
176216
```
177217

178-
179218
## Versioning and Releases
180219

181220
The DuckDB Python package versioning and release scheme follows that of DuckDB itself. This means that a `X.Y.Z[.

0 commit comments

Comments
 (0)