Skip to content

Commit c522004

Browse files
Merge pull request #94 from ivan-borovets/f/refactoring-02-2026
Refactor
2 parents 58ef7f6 + f7afe32 commit c522004

338 files changed

Lines changed: 5756 additions & 7567 deletions

File tree

Some content is hidden

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

.dockerignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
**
33

44
# Except
5+
!docker-entrypoint.sh
56
!pyproject.toml
6-
!uv.lock
77
!README.md
8-
!config/**
9-
!src/**
8+
!uv.lock
109
!alembic.ini
10+
!src/**
11+
!tests/**

.github/workflows/ci.yaml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,24 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v4
10+
- name: Checkout
11+
uses: actions/checkout@v6
1112

1213
- name: Set up Python
13-
uses: actions/setup-python@v5
14+
uses: actions/setup-python@v6
1415
with:
1516
python-version: "3.13"
1617

1718
- name: Install uv
18-
uses: astral-sh/setup-uv@v6
19+
uses: astral-sh/setup-uv@v7
1920

2021
- name: Install dependencies
2122
run: uv sync --locked --group dev
2223

2324
- name: Check code
24-
run: uv run make code.check
25+
run: uv run make check
2526

26-
- name: Test Docker Compose setup
27+
- name: Test with Docker
2728
env:
28-
APP_ENV: local
29-
run: |
30-
uv run config/toml_config_manager.py
31-
cd config/local
32-
docker compose --env-file .env.local up -d --build
33-
34-
- name: Verify Application Health
35-
run: |
36-
timeout 10s bash -s <<'BASH'
37-
while ! curl -sf http://127.0.0.1:9999/api/v1/health; do
38-
sleep 1
39-
done
40-
BASH
41-
42-
- name: Test Signup Handler
43-
run: |
44-
curl -f --json @- http://127.0.0.1:9999/api/v1/account/signup <<'JSON'
45-
{
46-
"username": "string",
47-
"password": "string"
48-
}
49-
JSON
29+
ALLOW_DESTRUCTIVE_TEST_CLEANUP: 1
30+
run: make test-docker

.gitignore

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,16 @@ cython_debug/
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
.idea/
161161

162-
# Config
163-
config/local/*
164-
!config/local/.gitkeep
165-
config/dev/*
166-
!config/dev/.gitkeep
167-
config/prod/*
168-
!config/prod/.gitkeep
169-
.secrets.*
170-
.env.*
171-
172-
# IgnoreToDo
162+
# other
163+
.claude/
164+
.import_linter_cache/
165+
.ruff_cache/
166+
.vscode/
167+
htmlcov-docker/
173168
todo/
174169

175-
# ImportLinter
176-
.import_linter_cache/
170+
.constraints.in
171+
.secrets
172+
AGENTS.md
173+
CLAUDE.md
174+
pylock.toml

.pre-commit-config.yaml

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,70 @@
1+
default_language_version:
2+
python: python3.13
3+
4+
default_stages: [pre-commit]
5+
16
repos:
27
- repo: local
38
hooks:
4-
- id: make-check
5-
name: source-code-check
6-
entry: make code.check
9+
- id: code-check
10+
name: code-check (local)
11+
entry: uv run make check
12+
language: system
13+
pass_filenames: false
14+
- id: pip-audit-local
15+
name: pip-audit (local)
16+
entry: uv run make pip-audit
17+
language: system
18+
pass_filenames: false
19+
verbose: true
20+
- id: test-docker
21+
name: test-docker (local)
22+
entry: make test-docker
723
language: system
24+
stages: [pre-push]
825
pass_filenames: false
9-
always_run: true
26+
verbose: true
27+
28+
- repo: https://github.com/pre-commit/pre-commit-hooks
29+
rev: v6.0.0
30+
hooks:
31+
- id: check-ast
32+
- id: check-case-conflict
33+
- id: trailing-whitespace
34+
- id: end-of-file-fixer
35+
exclude: ^docs/
36+
- id: check-added-large-files
37+
- id: check-docstring-first
38+
- id: check-json
39+
- id: check-toml
40+
- id: check-yaml
41+
exclude: docker-compose.test.yml
42+
- id: detect-private-key
43+
- id: debug-statements
44+
- id: check-merge-conflict
45+
- id: mixed-line-ending
46+
args: ["--fix=lf"]
47+
- id: no-commit-to-branch
48+
args: [--branch, develop, --branch, dev, --branch, master, --branch, main]
49+
50+
- repo: https://github.com/crate-ci/typos
51+
rev: v1.40.0
52+
hooks:
53+
- id: typos
54+
args: [--force-exclude]
1055

1156
- repo: https://github.com/google/yamlfmt
1257
rev: v0.20.0
1358
hooks:
1459
- id: yamlfmt
60+
name: YAML formatter
61+
files: (^|/).*\.ya?ml$
62+
args:
63+
- "--conf"
64+
- ".yamlfmt"
65+
66+
- repo: https://github.com/koalaman/shellcheck-precommit
67+
rev: v0.11.0
68+
hooks:
69+
- id: shellcheck
70+
args: ["--severity=warning"]

.yamlfmt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ formatter:
44
type: basic
55
line_ending: lf
66
retain_line_breaks: true
7-
scan_folded_as_literal: true
7+
scan_folded_as_literal: true

Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
ARG PYTHON_VERSION=3.13
2+
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-trixie-slim
3+
4+
ARG APP_VERSION=develop
5+
ARG ENVIRONMENT="prod"
6+
7+
ENV APP_VERSION=${APP_VERSION}
8+
ENV PYTHONDONTWRITEBYTECODE=1
9+
ENV PYTHONUNBUFFERED=1
10+
ENV UV_HTTP_TIMEOUT=300
11+
ENV UV_LINK_MODE=copy
12+
ENV UV_PROJECT_ENVIRONMENT=/usr/local
13+
14+
WORKDIR /code
15+
16+
COPY pyproject.toml uv.lock README.md ./
17+
18+
RUN if [ "${ENVIRONMENT}" = "prod" ]; then \
19+
uv sync --frozen --no-cache --no-dev --no-install-project; \
20+
else \
21+
uv sync --frozen --dev --no-install-project; \
22+
fi
23+
24+
COPY . .
25+
26+
RUN if [ "${ENVIRONMENT}" = "prod" ]; then \
27+
uv sync --frozen --no-cache --no-dev; \
28+
else \
29+
uv sync --frozen --dev; \
30+
fi
31+
32+
RUN groupadd -r runner
33+
RUN useradd -r -g runner -m -s /usr/sbin/nologin runner
34+
RUN chown -R runner:root /code
35+
RUN chmod -R g=u /code
36+
37+
USER runner
38+
39+
EXPOSE 8000
40+
41+
ENTRYPOINT [ "/code/docker-entrypoint.sh" ]

0 commit comments

Comments
 (0)