You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/customization.qmd
+24-6Lines changed: 24 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ The project uses Poetry to manage dependencies:
15
15
- Install dependencies: `poetry install`
16
16
- Update all dependencies: `poetry update`
17
17
18
+
If you are using VSCode or Cursor as your IDE, you will need to select the Poetry-managed Python version as your interpreter for the project. To find the location of the Poetry-managed Python interpreter, run `poetry env info` and look for the `Path` field. Then, in VSCode, go to `View > Command Palette`, search for `Python: Select Interpreter`, and either select Poetry's Python version from the list (if it has been auto-detected) or "Enter interpreter path" manually.
19
+
18
20
### Testing
19
21
20
22
The project uses Pytest for unit testing. It's highly recommended to write and run tests before committing code to ensure nothing is broken!
@@ -96,7 +98,7 @@ We name our GET routes using the convention `read_<name>`, where `<name>` is the
96
98
We divide our GET routes into authenticated and unauthenticated routes, using commented section headers in our code that look like this:
97
99
98
100
```python
99
-
# -- Authenticated Routes --
101
+
# --- Authenticated Routes ---
100
102
```
101
103
102
104
Some of our routes take request parameters, which we pass as keyword arguments to the route handler. These parameters should be type annotated for validation purposes.
@@ -243,11 +245,16 @@ SQLModel is an Object-Relational Mapping (ORM) library that allows us to interac
243
245
Our database models are defined in `utils/models.py`. Each model is a Python class that inherits from `SQLModel` and represents a database table. The key models are:
244
246
245
247
-`Organization`: Represents a company or team
246
-
-`User`: Represents a user account
247
-
-`Role`: Represents a discrete set of user permissions within an organization
248
-
-`Permission`: Represents specific actions a user can perform
249
-
-`RolePermissionLink`: Maps roles to their allowed permissions
The session automatically handles transaction management, ensuring that database operations are atomic and consistent.
299
306
307
+
There is also a helper method on the `User` model that checks if a user has a specific permission for a given organization. Its first argument must be a `ValidPermissions` enum value (from `utils/models.py`), and its second argument must be an `Organization` object or an `int` representing an organization ID:
You should create custom `ValidPermissions` enum values for your application and validate that users have the necessary permissions before allowing them to modify organization data resources.
317
+
300
318
#### Cascade deletes
301
319
302
320
Cascade deletes (in which deleting a record from one table deletes related records from another table) can be handled at either the ORM level or the database level. This template handles cascade deletes at the ORM level, via SQLModel relationships. Inside a SQLModel `Relationship`, we set:
Copy file name to clipboardExpand all lines: docs/installation.qmd
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ If you use VSCode with Docker to develop in a container, the following VSCode De
18
18
}
19
19
```
20
20
21
-
Simply create a `.devcontainer` folder in the root of the project and add a `devcontainer.json` file in the folder with the above content. VSCode may prompt you to install the Dev Container extension if you haven't already, and/or to open the project in a container. If not, you can manually select "Dev Containers: Reopen in Container" from View > Command Palette.
21
+
Simply create a `.devcontainer` folder in the root of the project and add a `devcontainer.json` file in the folder with the above content. VSCode may prompt you to install the Dev Container extension if you haven't already, and/or to open the project in a container. If not, you can manually select "Dev Containers: Reopen in Container" from `View > Command Palette`.
22
22
23
23
*IMPORTANT: If using this dev container configuration, you will need to set the `DB_HOST` environment variable to "host.docker.internal" in the `.env` file.*
24
24
@@ -69,6 +69,12 @@ poetry shell
69
69
70
70
(Note: You will need to activate the shell every time you open a new terminal session. Alternatively, you can use the `poetry run` prefix before other commands to run them without activating the shell.)
71
71
72
+
### Configure IDE
73
+
74
+
If you are using VSCode or Cursor as your IDE, you will need to select the Poetry-managed Python version as your interpreter for the project. To find the location of the Poetry-managed Python interpreter, run `poetry env info` and look for the `Path` field. Then, in VSCode, go to `View > Command Palette`, search for `Python: Select Interpreter`, and either select Poetry's Python version from the list (if it has been auto-detected) or "Enter interpreter path" manually.
75
+
76
+
It is also recommended to install the [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) and [Quarto](https://marketplace.visualstudio.com/items?itemName=quarto.quarto) IDE extensions.
Copy file name to clipboardExpand all lines: docs/static/documentation.txt
+39-11Lines changed: 39 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -192,9 +192,11 @@ with open(output_path, 'w', encoding='utf-8') as f:
192
192
f.write(final_content)
193
193
```
194
194
195
-
In line with the [llms.txt standard](https://llmstxt.org/), we have provided a Markdown-formatted prompt—designed to help LLM agents understand how to work with this template—as a [text file](docs/static/llms.txt). One use case for this file is to rename it to `.cursorrules` and place it in your project directory is using the Cursor IDE (see the [Cursor docs](https://docs.cursor.com/context/rules-for-ai) on this for more information).
195
+
In line with the [llms.txt standard](https://llmstxt.org/), we have provided a Markdown-formatted prompt—designed to help LLM agents understand how to work with this template—as a text file: [llms.txt](docs/static/llms.txt).
196
196
197
-
We have also exposed the full Markdown-formatted project documentation as a [single text file](docs/static/documentation.txt) for easy downloading and embedding.
197
+
One use case for this file, if using the Cursor IDE, is to rename it to `.cursorrules` and place it in your project directory (see the [Cursor docs](https://docs.cursor.com/context/rules-for-ai) on this for more information). Alternatively, you could use it as a custom system prompt in the web interface for ChatGPT, Claude, or the LLM of your choice.
198
+
199
+
We have also exposed the full Markdown-formatted project documentation as a [single text file](docs/static/documentation.txt) for easy downloading and embedding for RAG workflows.
198
200
199
201
## Contributing
200
202
@@ -517,7 +519,7 @@ If you use VSCode with Docker to develop in a container, the following VSCode De
517
519
}
518
520
```
519
521
520
-
Simply create a `.devcontainer` folder in the root of the project and add a `devcontainer.json` file in the folder with the above content. VSCode may prompt you to install the Dev Container extension if you haven't already, and/or to open the project in a container. If not, you can manually select "Dev Containers: Reopen in Container" from View > Command Palette.
522
+
Simply create a `.devcontainer` folder in the root of the project and add a `devcontainer.json` file in the folder with the above content. VSCode may prompt you to install the Dev Container extension if you haven't already, and/or to open the project in a container. If not, you can manually select "Dev Containers: Reopen in Container" from `View > Command Palette`.
521
523
522
524
*IMPORTANT: If using this dev container configuration, you will need to set the `DB_HOST` environment variable to "host.docker.internal" in the `.env` file.*
523
525
@@ -568,6 +570,12 @@ poetry shell
568
570
569
571
(Note: You will need to activate the shell every time you open a new terminal session. Alternatively, you can use the `poetry run` prefix before other commands to run them without activating the shell.)
570
572
573
+
### Configure IDE
574
+
575
+
If you are using VSCode or Cursor as your IDE, you will need to select the Poetry-managed Python version as your interpreter for the project. To find the location of the Poetry-managed Python interpreter, run `poetry env info` and look for the `Path` field. Then, in VSCode, go to `View > Command Palette`, search for `Python: Select Interpreter`, and either select Poetry's Python version from the list (if it has been auto-detected) or "Enter interpreter path" manually.
576
+
577
+
It is also recommended to install the [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) and [Quarto](https://marketplace.visualstudio.com/items?itemName=quarto.quarto) IDE extensions.
578
+
571
579
## Install documentation dependencies manually
572
580
573
581
### Quarto CLI
@@ -659,6 +667,8 @@ The project uses Poetry to manage dependencies:
659
667
- Install dependencies: `poetry install`
660
668
- Update all dependencies: `poetry update`
661
669
670
+
If you are using VSCode or Cursor as your IDE, you will need to select the Poetry-managed Python version as your interpreter for the project. To find the location of the Poetry-managed Python interpreter, run `poetry env info` and look for the `Path` field. Then, in VSCode, go to `View > Command Palette`, search for `Python: Select Interpreter`, and either select Poetry's Python version from the list (if it has been auto-detected) or "Enter interpreter path" manually.
671
+
662
672
### Testing
663
673
664
674
The project uses Pytest for unit testing. It's highly recommended to write and run tests before committing code to ensure nothing is broken!
@@ -692,9 +702,11 @@ We find that mypy is an enormous time-saver, catching many errors early and grea
692
702
693
703
### Developing with LLMs
694
704
695
-
In line with the [llms.txt standard](https://llmstxt.org/), we have provided a Markdown-formatted prompt—designed to help LLM agents understand how to work with this template—as a [text file](static/llms.txt). One use case for this file is to rename it to `.cursorrules` and place it in your project directory is using the Cursor IDE (see the [Cursor docs](https://docs.cursor.com/context/rules-for-ai) on this for more information).
705
+
In line with the [llms.txt standard](https://llmstxt.org/), we have provided a Markdown-formatted prompt—designed to help LLM agents understand how to work with this template—as a text file: [llms.txt](static/llms.txt).
706
+
707
+
One use case for this file, if using the Cursor IDE, is to rename it to `.cursorrules` and place it in your project directory (see the [Cursor docs](https://docs.cursor.com/context/rules-for-ai) on this for more information). Alternatively, you could use it as a custom system prompt in the web interface for ChatGPT, Claude, or the LLM of your choice.
696
708
697
-
We have also exposed the full Markdown-formatted project documentation as a [single text file](static/documentation.txt) for easy downloading and embedding.
709
+
We have also exposed the full Markdown-formatted project documentation as a [single text file](static/documentation.txt) for easy downloading and embedding for RAG workflows.
698
710
699
711
## Project structure
700
712
@@ -738,7 +750,7 @@ We name our GET routes using the convention `read_<name>`, where `<name>` is the
738
750
We divide our GET routes into authenticated and unauthenticated routes, using commented section headers in our code that look like this:
739
751
740
752
```python
741
-
# -- Authenticated Routes --
753
+
# --- Authenticated Routes ---
742
754
```
743
755
744
756
Some of our routes take request parameters, which we pass as keyword arguments to the route handler. These parameters should be type annotated for validation purposes.
@@ -885,11 +897,16 @@ SQLModel is an Object-Relational Mapping (ORM) library that allows us to interac
885
897
Our database models are defined in `utils/models.py`. Each model is a Python class that inherits from `SQLModel` and represents a database table. The key models are:
886
898
887
899
- `Organization`: Represents a company or team
888
-
- `User`: Represents a user account
889
-
- `Role`: Represents a discrete set of user permissions within an organization
890
-
- `Permission`: Represents specific actions a user can perform
891
-
- `RolePermissionLink`: Maps roles to their allowed permissions
The session automatically handles transaction management, ensuring that database operations are atomic and consistent.
941
958
959
+
There is also a helper method on the `User` model that checks if a user has a specific permission for a given organization. Its first argument must be a `ValidPermissions` enum value (from `utils/models.py`), and its second argument must be an `Organization` object or an `int` representing an organization ID:
You should create custom `ValidPermissions` enum values for your application and validate that users have the necessary permissions before allowing them to modify organization data resources.
969
+
942
970
#### Cascade deletes
943
971
944
972
Cascade deletes (in which deleting a record from one table deletes related records from another table) can be handled at either the ORM level or the database level. This template handles cascade deletes at the ORM level, via SQLModel relationships. Inside a SQLModel `Relationship`, we set:
0 commit comments