Skip to content

Commit 3d32b40

Browse files
committed
Initial Commit
1 parent 87d1a00 commit 3d32b40

34 files changed

Lines changed: 800 additions & 11 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
21
.idea/
2+
3+
!django/{{ cookiecutter.project_slug }}/.env.local

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# To update the versions:
22
# pre-commit autoupdate
3+
exclude: "django/"
34
repos:
45
- repo: https://github.com/astral-sh/uv-pre-commit
56
rev: 0.8.5

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Cookiecutter templates for python projects at singularIT
2+
3+
## Prerequisites
4+
5+
- [cookiecutter](https://cookiecutter.readthedocs.io/en/latest/installation.html) installed
6+
7+
## Django template
8+
9+
```shell
10+
# cd into the top-level directory where you want to create the project
11+
cd /path/to/your/top-level-directory
12+
cookiecutter https://github.com/singularit-de/cc-python.git --directory django
13+
```
14+
15+
## Why we are using templates
16+
17+
## Contribute to this repository
18+
19+
### Tech stack of this repository
20+
21+
- Python 3.12
22+
- uv
23+
- ruff
24+
- pre-commit
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"project_name": "My Awesome Project",
33
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_')|replace('.', '_')|trim() }}",
4-
"customer": "",
5-
"username_type": [
6-
"username",
7-
"email"
4+
"customer": "internal",
5+
"python_version": [
6+
"3.12",
7+
"3.13"
88
],
99
"postgresql_version": [
10-
"17",
1110
"16",
12-
"15"
11+
"17"
1312
],
14-
"mail_smtp": "n",
15-
"_extensions": ["jinja2_time.TimeExtension"]
13+
"username_type": [
14+
"email",
15+
"username"
16+
]
1617
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
POSTGRES_DB=
2+
POSTGRES_USER=
3+
POSTGRES_PASSWORD=
4+
POSTGRES_HOST=
5+
POSTGRES_PORT=
6+
DJANGO_SECRET_KEY=
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea/
2+
.env.*
3+
!.env.example
4+
.venv
5+
**/__pycache__/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
stages:
2+
- lint
3+
- test
4+
- deploy
5+
6+
include:
7+
- local: .gitlab/ci/*.gitlab-ci.yml
8+
- component: singular-code.de/singularit/ci-components/utilities/size/all@1.2.0
9+
10+
variables:
11+
POSTGRES_HOST_AUTH_METHOD: trust
12+
POSTGRES_DB: {{ cookiecutter.project_slug }}
13+
POSTGRES_USER: {{ cookiecutter.project_slug }}
14+
POSTGRES_PASSWORD: {{ cookiecutter.project_slug }}
15+
16+
workflow:
17+
rules:
18+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_SOURCE_BRANCH_PROTECTED == 'false'
19+
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_REF_PROTECTED == 'true'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM python:{{ cookiecutter.python_version }}-slim-bookworm as base
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
3+
4+
ADD pyproject.toml uv.lock /app/
5+
6+
WORKDIR /app
7+
8+
# set environment variables
9+
ENV PYTHONDONTWRITEBYTECODE 1
10+
ENV PYTHONUNBUFFERED 1
11+
ENV DEBIAN_FRONTEND noninteractive
12+
13+
RUN uv sync
14+
15+
COPY . .
16+
17+
FROM base as app
18+
19+
RUN uv run manage.py collectstatic --no-input
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include:
2+
- component: singular-code.de/singularit/ci-components/deployment/deploy-docker-compose/deployment@feat/major-update
3+
inputs:
4+
http: app
5+
auth: "*>public>*"
6+
compose-file: .gitlab/docker-compose.staging.yml
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
pre-commit:
2+
stage: lint
3+
interruptible: true
4+
extends:
5+
- .size:medium
6+
image: astral/uv:python{{ cookiecutter.python_version }}-bookworm
7+
variables:
8+
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
9+
cache:
10+
paths:
11+
- ${PRE_COMMIT_HOME}
12+
- ${UV_CACHE_DIR}
13+
key:
14+
files:
15+
- uv.lock
16+
- .pre-commit-config.yaml
17+
script:
18+
- uvx pre-commit run --show-diff-on-failure --color=always --all-files
19+
after_script:
20+
- uv cache prune --ci

0 commit comments

Comments
 (0)