Skip to content

Commit 75d6f89

Browse files
committed
chore: initial commit
0 parents  commit 75d6f89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+8065
-0
lines changed

.dockerignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
**/__pycache__/
2+
**/*.py[cod]
3+
[!__]_*.py
4+
**/*.ipynb
5+
6+
.git/
7+
.github/
8+
.venv/
9+
.vscode/
10+
.gitignore
11+
.gitmodules
12+
.env
13+
14+
logs/
15+
docker-compose.yaml
16+
Dockerfile
17+
secrets/
18+
config/

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
10+
[*.py]
11+
max_line_length = 90
12+
13+
[*.pyi]
14+
max_line_length = 90
15+
16+
[*.md]
17+
indent_size = 2
18+
19+
[*.toml]
20+
indent_size = 2
21+
22+
[*.yaml]
23+
indent_size = 2

.github/CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contribution Guide
2+
3+
First off, thanks for taking the time to contribute. It makes the repository substantially better. :+1:
4+
5+
## Setting up the environment
6+
7+
1. Install Astral's [UV](http://docs.astral.sh/uv/), if you haven't already.
8+
2. Run `uv sync --all-groups` to create a [virtual environment](https://docs.python.org/3/tutorial/venv.html) and install dependencies.
9+
10+
## Good Bug Reports
11+
12+
Please be aware of the following things when filing bug reports.
13+
14+
1. Don't open duplicate issues. Please search your issue to see if it has been asked already. Duplicate issues will be closed.
15+
2. When filing a bug about exceptions or tracebacks, please include the _complete_ traceback. Without the complete traceback the issue might be **unsolvable** and you will be asked to provide more information.
16+
3. Make sure to provide enough information to make the issue workable. The issue template will generally walk you through the process, but they are enumerated here as well:
17+
- A **summary** of your bug report. This is generally a quick sentence or two to describe the issue in human terms.
18+
- Guidance on **how to reproduce the issue**. Ideally, this should have a small code sample that allows us to run and see the issue for ourselves to debug. **Please make sure that the token is not displayed**. If you cannot provide a code snippet, then let us know what the steps were, how often it happens, etc.
19+
- Tell us **what you expected to happen**. That way we can meet that expectation.
20+
- Tell us **what actually happens**. What ends up happening in reality? It's not helpful to say "it fails" or "it doesn't work". Say _how_ it failed, do you get an exception? Does it hang? How are the expectations different from reality?
21+
- Tell us **information about your environment**. What operating system are you running on?
22+
23+
If the bug report is missing this information then it'll take us longer to fix the issue. We will probably ask for clarification, and barring that if no response was given then the issue will be closed.
24+
25+
## Submitting a Pull Request
26+
27+
Submitting a pull request is fairly simple, just make sure it focuses on a single aspect and doesn't manage to have scope creep, and it's probably good to go. It would be incredibly lovely if the style is consistent to that found in the project. This project follows PEP-8 guidelines (mostly) with a column limit of 90.
28+
There are provided tool rules in `pyproject.toml` for `ruff` and `pyright` when committing here.
29+
There are actions that run on new PRs and if those checks fail then the PR will not be accepted.
30+
Pull requests and commits all need to follow the [Conventional Commit format](https://www.conventionalcommits.org)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Bug Report
2+
description: Report broken or incorrect behaviour
3+
labels: unconfirmed bug
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: >
8+
Thanks for taking the time to fill out a bug.
9+
10+
Please note that this form is for bugs only!
11+
- type: input
12+
attributes:
13+
label: Summary
14+
description: A simple summary of your bug report
15+
validations:
16+
required: true
17+
- type: textarea
18+
attributes:
19+
label: Reproduction Steps
20+
description: >
21+
What you did to make it happen.
22+
validations:
23+
required: true
24+
- type: textarea
25+
attributes:
26+
label: Minimal Reproducible Code
27+
description: >
28+
A short snippet of code that showcases the bug.
29+
render: python
30+
- type: textarea
31+
attributes:
32+
label: Expected Results
33+
description: >
34+
What did you expect to happen?
35+
validations:
36+
required: true
37+
- type: textarea
38+
attributes:
39+
label: Actual Results
40+
description: >
41+
What actually happened?
42+
validations:
43+
required: true
44+
- type: checkboxes
45+
attributes:
46+
label: Checklist
47+
description: >
48+
Let's make sure you've properly done due diligence when reporting this issue!
49+
options:
50+
- label: I have searched the open issues for duplicates.
51+
required: true
52+
- label: I have shown the entire traceback, if possible.
53+
required: true
54+
- type: textarea
55+
attributes:
56+
label: Additional Context
57+
description: If there is anything else to say, please do so here.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Feature Request
2+
description: Suggest a feature for this library
3+
labels: feature request
4+
body:
5+
- type: input
6+
attributes:
7+
label: Summary
8+
description: >
9+
A short summary of what your feature request is.
10+
validations:
11+
required: true
12+
- type: textarea
13+
attributes:
14+
label: The Problem
15+
description: >
16+
What problem is your feature trying to solve?
17+
What becomes easier or possible when this feature is implemented?
18+
validations:
19+
required: true
20+
- type: textarea
21+
attributes:
22+
label: The Ideal Solution
23+
description: >
24+
What is your ideal solution to the problem?
25+
What would you like this feature to do?
26+
validations:
27+
required: true
28+
- type: textarea
29+
attributes:
30+
label: The Current Solution
31+
description: >
32+
What is the current solution to the problem, if any?
33+
validations:
34+
required: false
35+
- type: textarea
36+
attributes:
37+
label: Additional Context
38+
description: If there is anything else to say, please do so here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Summary
2+
3+
<!-- What is this pull request for? Does it fix any issues? -->
4+
5+
## Checklist
6+
7+
<!-- Put an x inside [ ] to check it, like so: [x] -->
8+
9+
- [ ] If code changes were made then they have been tested.
10+
- [ ] I have updated the documentation to reflect the changes.
11+
- [ ] This PR fixes a submitted GitHub issue.
12+
- [ ] This PR adds something new (e.g. new method or parameters).
13+
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
14+
- [ ] This PR is **not** a code change (e.g. documentation, README, ...)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Credit: https://github.com/AbstractUmbra/Hondana/blob/main/.github/workflows/coverage_and_lint.yaml
2+
3+
name: Type Coverage and Linting
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
types: [opened, reopened, synchronize]
13+
14+
jobs:
15+
check:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version: ["3.13", "3.x"]
21+
22+
name: "Type Coverage and Linting @ ${{ matrix.python-version }}"
23+
steps:
24+
- name: "Checkout Repository"
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v6
31+
with:
32+
enable-cache: true
33+
activate-environment: true
34+
35+
- name: Install deps @ ${{ matrix.python-version }}
36+
run: |
37+
uv sync --locked --all-extras --all-groups
38+
39+
- name: "Run Pyright @ ${{ matrix.python-version }}"
40+
uses: jakebailey/pyright-action@v2
41+
with:
42+
warnings: false
43+
verify-types: "sonyflake"
44+
ignore-external: true
45+
annotate: ${{ matrix.python-version != '3.x' && 'all' || 'none' }}
46+
47+
- uses: astral-sh/ruff-action@v3
48+
49+
- name: Lint
50+
run: ruff check .
51+
52+
- name: Format check
53+
run: ruff format --check .

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Python-generated files
2+
__pycache__/
3+
*.py[oc]
4+
build/
5+
dist/
6+
wheels/
7+
*.egg-info
8+
9+
# Environments
10+
.venv
11+
.env
12+
13+
# Secrets
14+
/secrets/postgres_password.txt
15+
/secrets/csrf_token.txt
16+
/secrets/access_token_secret.txt
17+
/secrets/rate_limit_bucket_encryption_key.txt
18+
/secrets/rate_limit_bucket_encryption_nonce.txt
19+
20+
# Config
21+
/config/app.toml
22+
23+
# Logs
24+
/logs

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
ARG PYTHON_BASE=3.13-slim-bookworm
2+
ARG UV_BASE=python3.13-bookworm-slim
3+
4+
FROM ghcr.io/astral-sh/uv:${UV_BASE} AS builder
5+
6+
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0
7+
8+
WORKDIR /project
9+
10+
RUN --mount=type=cache,target=/root/.cache/uv \
11+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
12+
--mount=type=bind,source=uv.lock,target=uv.lock \
13+
uv sync --frozen --no-install-project --no-dev
14+
15+
COPY --chown=65532:65532 . /project
16+
17+
RUN --mount=type=cache,target=/root/.cache/uv \
18+
uv sync --frozen --no-dev
19+
20+
FROM python:${PYTHON_BASE}
21+
22+
LABEL org.opencontainers.image.title="litestar-backend-template" \
23+
org.opencontainers.image.version="0.1.0" \
24+
org.opencontainers.image.description="A backend template application built with Litestar" \
25+
org.opencontainers.image.source="https://github.com/iyad-f/litestar-backend-template" \
26+
org.opencontainers.image.licenses="Apache-2.0" \
27+
org.opencontainers.image.authors="Iyad"
28+
29+
RUN addgroup --system --gid 65532 nonroot \
30+
&& adduser --no-create-home --system --uid 65532 --gid 65532 nonroot
31+
32+
USER nonroot:nonroot
33+
34+
WORKDIR /app
35+
36+
COPY --from=builder --chown=nonroot:nonroot /project /app
37+
38+
ENV PATH=/app/.venv/bin:$PATH PYTHONPATH=/app/src
39+
40+
EXPOSE 8000
41+
42+
ENTRYPOINT ["python", "-O", "-m", "app"]
43+
CMD ["run"]

0 commit comments

Comments
 (0)