Skip to content

Commit 694d737

Browse files
authored
📝 Update docs about contributing, reference central docs (#1975)
1 parent c4a3bb9 commit 694d737

1 file changed

Lines changed: 1 addition & 190 deletions

File tree

docs/contributing.md

Lines changed: 1 addition & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -4,193 +4,4 @@ First, you might want to see the basic ways to [help SQLModel and get help](help
44

55
## Developing
66

7-
If you already cloned the [sqlmodel repository](https://github.com/fastapi/sqlmodel) and you want to deep dive in the code, here are some guidelines to set up your environment.
8-
9-
### Install Requirements Using `uv`
10-
11-
Create a virtual environment and install the required packages in one command:
12-
13-
<div class="termy">
14-
15-
```console
16-
$ uv sync
17-
18-
---> 100%
19-
```
20-
21-
</div>
22-
23-
It will install all the dependencies and your local SQLModel in your local environment.
24-
25-
### Using your Local SQLModel
26-
27-
If you create a Python file that imports and uses SQLModel, and run it with the Python from your local environment, it will use your cloned local SQLModel source code.
28-
29-
And if you update that local SQLModel source code when you run that Python file again, it will use the fresh version of SQLModel you just edited.
30-
31-
That way, you don't have to "install" your local version to be able to test every change.
32-
33-
/// note | "Technical Details"
34-
35-
This only happens when you install using this included `requirements.txt` instead of running `pip install sqlmodel` directly.
36-
37-
That is because inside the `requirements.txt` file, the local version of SQLModel is marked to be installed in "editable" mode, with the `-e` option.
38-
39-
///
40-
41-
### Format
42-
43-
There is a script that you can run that will format and clean all your code:
44-
45-
<div class="termy">
46-
47-
```console
48-
$ bash scripts/format.sh
49-
```
50-
51-
</div>
52-
53-
It will also auto-sort all your imports.
54-
55-
## Tests
56-
57-
There is a script that you can run locally to test all the code and generate coverage reports in HTML:
58-
59-
<div class="termy">
60-
61-
```console
62-
$ bash scripts/test.sh
63-
```
64-
65-
</div>
66-
67-
This command generates a directory `./htmlcov/`, if you open the file `./htmlcov/index.html` in your browser, you can explore interactively the regions of code that are covered by the tests, and notice if there is any region missing.
68-
69-
## Docs
70-
71-
First, make sure you set up your environment as described above, that will install all the requirements.
72-
73-
### Docs Live
74-
75-
During local development, there is a script that builds the site and checks for any changes, live-reloading:
76-
77-
<div class="termy">
78-
79-
```console
80-
$ python ./scripts/docs.py live
81-
82-
<span style="color: green;">[INFO]</span> Serving on http://127.0.0.1:8008
83-
<span style="color: green;">[INFO]</span> Start watching changes
84-
<span style="color: green;">[INFO]</span> Start detecting changes
85-
```
86-
87-
</div>
88-
89-
It will serve the documentation on `http://127.0.0.1:8008`.
90-
91-
That way, you can edit the documentation/source files and see the changes live.
92-
93-
/// tip
94-
95-
Alternatively, you can perform the same steps that the script does manually.
96-
97-
Go into the docs directory at `docs/`:
98-
99-
```console
100-
$ cd docs/
101-
```
102-
103-
Then run `zensical` in that directory:
104-
105-
```console
106-
$ zensical serve --dev-addr 8008
107-
```
108-
109-
///
110-
111-
#### Typer CLI (Optional)
112-
113-
The instructions here show you how to use the script at `./scripts/docs.py` with the `python` program directly.
114-
115-
But you can also use [Typer CLI](https://typer.tiangolo.com/typer-cli/), and you will get autocompletion in your terminal for the commands after installing completion.
116-
117-
If you install Typer CLI, you can install completion with:
118-
119-
<div class="termy">
120-
121-
```console
122-
$ typer --install-completion
123-
124-
zsh completion installed in /home/user/.bashrc.
125-
Completion will take effect once you restart the terminal.
126-
```
127-
128-
</div>
129-
130-
### Docs Structure
131-
132-
The documentation uses [Zensical](https://zensical.org).
133-
134-
And there are extra tools/scripts in place in `./scripts/docs.py`.
135-
136-
/// tip
137-
138-
You don't need to see the code in `./scripts/docs.py`, you just use it in the command line.
139-
140-
///
141-
142-
All the documentation is in Markdown format in the directory `./docs`.
143-
144-
Many of the tutorials have blocks of code.
145-
146-
In most of the cases, these blocks of code are actual complete applications that can be run as is.
147-
148-
In fact, those blocks of code are not written inside the Markdown, they are Python files in the `./docs_src/` directory.
149-
150-
And those Python files are included/injected in the documentation when generating the site.
151-
152-
### Docs for Tests
153-
154-
Most of the tests actually run against the example source files in the documentation.
155-
156-
This helps to make sure that:
157-
158-
* The documentation is up-to-date.
159-
* The documentation examples can be run as is.
160-
* Most of the features are covered by the documentation, ensured by test coverage.
161-
162-
## Automated Code and AI
163-
164-
You are encouraged to use all the tools you want to do your work and contribute as efficiently as possible, this includes AI (LLM) tools, etc. Nevertheless, contributions should have meaningful human intervention, judgement, context, etc.
165-
166-
If the **human effort** put in a PR, e.g. writing LLM prompts, is **less** than the **effort we would need to put** to **review it**, please **don't** submit the PR.
167-
168-
Think of it this way: we can already write LLM prompts or run automated tools ourselves, and that would be faster than reviewing external PRs.
169-
170-
### Closing Automated and AI PRs
171-
172-
If we see PRs that seem AI generated or automated in similar ways, we'll flag them and close them.
173-
174-
The same applies to comments and descriptions, please don't copy paste the content generated by an LLM.
175-
176-
### Human Effort Denial of Service
177-
178-
Using automated tools and AI to submit PRs or comments that we have to carefully review and handle would be the equivalent of a [Denial-of-service attack](https://en.wikipedia.org/wiki/Denial-of-service_attack) on our human effort.
179-
180-
It would be very little effort from the person submitting the PR (an LLM prompt) that generates a large amount of effort on our side (carefully reviewing code).
181-
182-
Please don't do that.
183-
184-
We'll need to block accounts that spam us with repeated automated PRs or comments.
185-
186-
### Use Tools Wisely
187-
188-
As Uncle Ben said:
189-
190-
<blockquote>
191-
With great <strike>power</strike> <strong>tools</strong> comes great responsibility.
192-
</blockquote>
193-
194-
Avoid inadvertently doing harm.
195-
196-
You have amazing tools at hand, use them wisely to help effectively.
7+
To contribute code to the project, please follow the guidelines in [tiangolo.com - Contributing](https://tiangolo.com/open-source/contributing/).

0 commit comments

Comments
 (0)