pyms-django-chassis 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyms_django_chassis-1.0.0/.coveragerc +14 -0
- pyms_django_chassis-1.0.0/.github/workflows/ci.yml +99 -0
- pyms_django_chassis-1.0.0/.github/workflows/release.yml +89 -0
- pyms_django_chassis-1.0.0/.gitignore +52 -0
- pyms_django_chassis-1.0.0/.pre-commit-config.yaml +15 -0
- pyms_django_chassis-1.0.0/LICENSE +21 -0
- pyms_django_chassis-1.0.0/PKG-INFO +663 -0
- pyms_django_chassis-1.0.0/README.md +577 -0
- pyms_django_chassis-1.0.0/mypy.ini +54 -0
- pyms_django_chassis-1.0.0/pyms_django/__init__.py +5 -0
- pyms_django_chassis-1.0.0/pyms_django/admin.py +116 -0
- pyms_django_chassis-1.0.0/pyms_django/asgi.py +11 -0
- pyms_django_chassis-1.0.0/pyms_django/base/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/base/apps.py +13 -0
- pyms_django_chassis-1.0.0/pyms_django/base/management/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/base/management/commands/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/base/management/commands/folderddd.py +178 -0
- pyms_django_chassis-1.0.0/pyms_django/cli/__init__.py +37 -0
- pyms_django_chassis-1.0.0/pyms_django/cli/startproject.py +545 -0
- pyms_django_chassis-1.0.0/pyms_django/cli/tui.py +478 -0
- pyms_django_chassis-1.0.0/pyms_django/cli/types.py +19 -0
- pyms_django_chassis-1.0.0/pyms_django/cloud/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/cloud/aws/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/cloud/aws/secret_manager.py +103 -0
- pyms_django_chassis-1.0.0/pyms_django/cloud/resources.py +24 -0
- pyms_django_chassis-1.0.0/pyms_django/data_type/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/data_type/custom_router.py +35 -0
- pyms_django_chassis-1.0.0/pyms_django/data_type/settings_type.py +33 -0
- pyms_django_chassis-1.0.0/pyms_django/db/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/db/backends/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/db/backends/fix_spatial/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/db/backends/fix_spatial/base.py +36 -0
- pyms_django_chassis-1.0.0/pyms_django/db/database_routers.py +67 -0
- pyms_django_chassis-1.0.0/pyms_django/db/functions.py +25 -0
- pyms_django_chassis-1.0.0/pyms_django/db/migrations.py +30 -0
- pyms_django_chassis-1.0.0/pyms_django/db/set_tenant_utils.py +31 -0
- pyms_django_chassis-1.0.0/pyms_django/db/utils.py +22 -0
- pyms_django_chassis-1.0.0/pyms_django/decorators.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/exceptions/__init__.py +7 -0
- pyms_django_chassis-1.0.0/pyms_django/exceptions/domain.py +127 -0
- pyms_django_chassis-1.0.0/pyms_django/fields.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/filters.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/filtersets.py +12 -0
- pyms_django_chassis-1.0.0/pyms_django/formatters/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/formatters/logging.py +59 -0
- pyms_django_chassis-1.0.0/pyms_django/forms.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/handlers/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/handlers/errors.py +203 -0
- pyms_django_chassis-1.0.0/pyms_django/handlers/version.py +31 -0
- pyms_django_chassis-1.0.0/pyms_django/hooks.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/middlewares/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/middlewares/logging.py +183 -0
- pyms_django_chassis-1.0.0/pyms_django/middlewares/tracing.py +68 -0
- pyms_django_chassis-1.0.0/pyms_django/models.py +196 -0
- pyms_django_chassis-1.0.0/pyms_django/oas/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/oas/parameters.py +13 -0
- pyms_django_chassis-1.0.0/pyms_django/oas/responses.py +66 -0
- pyms_django_chassis-1.0.0/pyms_django/py.typed +0 -0
- pyms_django_chassis-1.0.0/pyms_django/pydantic/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/pydantic/models.py +32 -0
- pyms_django_chassis-1.0.0/pyms_django/routers.py +170 -0
- pyms_django_chassis-1.0.0/pyms_django/serializers.py +161 -0
- pyms_django_chassis-1.0.0/pyms_django/settings/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/settings/apps.py +17 -0
- pyms_django_chassis-1.0.0/pyms_django/settings/config_vars.py +61 -0
- pyms_django_chassis-1.0.0/pyms_django/settings/main.py +284 -0
- pyms_django_chassis-1.0.0/pyms_django/settings/metrics.py +81 -0
- pyms_django_chassis-1.0.0/pyms_django/settings/middlewares.py +19 -0
- pyms_django_chassis-1.0.0/pyms_django/settings/unit_tests.py +25 -0
- pyms_django_chassis-1.0.0/pyms_django/templates/admin/migrate_data_to_other_tenant.html +17 -0
- pyms_django_chassis-1.0.0/pyms_django/tenants/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/tenants/admin.py +27 -0
- pyms_django_chassis-1.0.0/pyms_django/tenants/apps.py +13 -0
- pyms_django_chassis-1.0.0/pyms_django/tenants/migrations/0001_initial.py +55 -0
- pyms_django_chassis-1.0.0/pyms_django/tenants/migrations/__init__.py +3 -0
- pyms_django_chassis-1.0.0/pyms_django/tenants/models.py +36 -0
- pyms_django_chassis-1.0.0/pyms_django/trace_context.py +8 -0
- pyms_django_chassis-1.0.0/pyms_django/urls.py +88 -0
- pyms_django_chassis-1.0.0/pyms_django/utils.py +38 -0
- pyms_django_chassis-1.0.0/pyms_django/views.py +104 -0
- pyms_django_chassis-1.0.0/pyms_django/wsgi.py +11 -0
- pyms_django_chassis-1.0.0/pyproject.toml +140 -0
- pyms_django_chassis-1.0.0/pytest.ini +6 -0
- pyms_django_chassis-1.0.0/ruff.toml +5 -0
- pyms_django_chassis-1.0.0/tests/__init__.py +6 -0
- pyms_django_chassis-1.0.0/tests/cli/__init__.py +0 -0
- pyms_django_chassis-1.0.0/tests/cli/test_startproject.py +43 -0
- pyms_django_chassis-1.0.0/tests/conftest.py +24 -0
- pyms_django_chassis-1.0.0/tests/db/__init__.py +0 -0
- pyms_django_chassis-1.0.0/tests/db/test_database_routers.py +39 -0
- pyms_django_chassis-1.0.0/tests/db/test_utils.py +21 -0
- pyms_django_chassis-1.0.0/tests/exceptions/__init__.py +0 -0
- pyms_django_chassis-1.0.0/tests/exceptions/test_domain.py +131 -0
- pyms_django_chassis-1.0.0/tests/formatters/__init__.py +0 -0
- pyms_django_chassis-1.0.0/tests/formatters/test_logging.py +76 -0
- pyms_django_chassis-1.0.0/tests/handlers/__init__.py +0 -0
- pyms_django_chassis-1.0.0/tests/handlers/test_errors.py +166 -0
- pyms_django_chassis-1.0.0/tests/middlewares/__init__.py +0 -0
- pyms_django_chassis-1.0.0/tests/middlewares/test_logging.py +52 -0
- pyms_django_chassis-1.0.0/tests/middlewares/test_tracing.py +74 -0
- pyms_django_chassis-1.0.0/tests/oas/__init__.py +0 -0
- pyms_django_chassis-1.0.0/tests/oas/test_parameters.py +20 -0
- pyms_django_chassis-1.0.0/tests/oas/test_responses.py +32 -0
- pyms_django_chassis-1.0.0/tests/settings.py +50 -0
- pyms_django_chassis-1.0.0/tests/test_models.py +102 -0
- pyms_django_chassis-1.0.0/tests/test_serializers.py +95 -0
- pyms_django_chassis-1.0.0/tests/test_utils.py +49 -0
- pyms_django_chassis-1.0.0/tests/test_views.py +94 -0
- pyms_django_chassis-1.0.0/tox.ini +12 -0
- pyms_django_chassis-1.0.0/uv.lock +1788 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: Lint
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: astral-sh/setup-uv@v4
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.13"
|
|
19
|
+
enable-cache: true
|
|
20
|
+
|
|
21
|
+
- run: uv sync --group dev
|
|
22
|
+
|
|
23
|
+
- name: Ruff check
|
|
24
|
+
run: uv run ruff check pyms_django tests
|
|
25
|
+
|
|
26
|
+
- name: Ruff format
|
|
27
|
+
run: uv run ruff format --check pyms_django tests
|
|
28
|
+
|
|
29
|
+
test:
|
|
30
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- uses: astral-sh/setup-uv@v4
|
|
41
|
+
with:
|
|
42
|
+
python-version: ${{ matrix.python-version }}
|
|
43
|
+
enable-cache: true
|
|
44
|
+
|
|
45
|
+
- run: uv sync --group dev
|
|
46
|
+
|
|
47
|
+
- name: Run tests
|
|
48
|
+
run: uv run pytest tests/ --tb=short -q --no-cov
|
|
49
|
+
|
|
50
|
+
# ─── Only on Pull Requests: ensure the version is not already released ──────
|
|
51
|
+
version-check:
|
|
52
|
+
name: Version is new
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
if: github.event_name == 'pull_request'
|
|
55
|
+
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v4
|
|
58
|
+
|
|
59
|
+
- name: Extract version from pyproject.toml
|
|
60
|
+
id: ver
|
|
61
|
+
run: |
|
|
62
|
+
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
|
63
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
64
|
+
echo "Detected version: $VERSION"
|
|
65
|
+
|
|
66
|
+
- name: Version must be bumped from main
|
|
67
|
+
run: |
|
|
68
|
+
VERSION="${{ steps.ver.outputs.version }}"
|
|
69
|
+
MAIN_VERSION=$(git show origin/main:pyproject.toml 2>/dev/null | grep '^version = ' | sed 's/version = "\(.*\)"/\1/' || echo "0.0.0")
|
|
70
|
+
|
|
71
|
+
echo "PR version : $VERSION"
|
|
72
|
+
echo "main version : $MAIN_VERSION"
|
|
73
|
+
|
|
74
|
+
if [ "$VERSION" = "$MAIN_VERSION" ]; then
|
|
75
|
+
echo "::error::Version $VERSION is the same as main. Bump the version in pyproject.toml before merging."
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
- name: Version must not exist on PyPI
|
|
80
|
+
run: |
|
|
81
|
+
VERSION="${{ steps.ver.outputs.version }}"
|
|
82
|
+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/pyms-django-chassis/$VERSION/json")
|
|
83
|
+
|
|
84
|
+
if [ "$HTTP_STATUS" = "200" ]; then
|
|
85
|
+
echo "::error::Version $VERSION already exists on PyPI. Choose a higher version."
|
|
86
|
+
exit 1
|
|
87
|
+
else
|
|
88
|
+
echo "Version $VERSION is not yet on PyPI."
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
- name: Version tag must not exist in the repository
|
|
92
|
+
run: |
|
|
93
|
+
VERSION="${{ steps.ver.outputs.version }}"
|
|
94
|
+
if git ls-remote --tags origin "refs/tags/v$VERSION" | grep -q "v$VERSION"; then
|
|
95
|
+
echo "::error::Tag v$VERSION already exists. Choose a higher version."
|
|
96
|
+
exit 1
|
|
97
|
+
else
|
|
98
|
+
echo "Tag v$VERSION does not exist yet."
|
|
99
|
+
fi
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
run-name: "Release — ${{ github.event_name == 'workflow_dispatch' && 'manual trigger' || 'merge to main' }} by @${{ github.actor }}"
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
workflow_run:
|
|
6
|
+
workflows: ["CI"]
|
|
7
|
+
types: [completed]
|
|
8
|
+
branches: [main]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
# ─── Detect if the version in pyproject.toml changed in this push ──────────
|
|
13
|
+
check-version:
|
|
14
|
+
name: Detect version bump
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
# On workflow_run: only proceed if CI passed
|
|
17
|
+
if: >
|
|
18
|
+
github.event_name == 'workflow_dispatch' ||
|
|
19
|
+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
|
|
20
|
+
outputs:
|
|
21
|
+
version: ${{ steps.check.outputs.version }}
|
|
22
|
+
changed: ${{ steps.check.outputs.changed }}
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 2
|
|
28
|
+
|
|
29
|
+
- name: Compare version with previous commit
|
|
30
|
+
id: check
|
|
31
|
+
run: |
|
|
32
|
+
CURRENT=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
|
|
33
|
+
echo "version=$CURRENT" >> "$GITHUB_OUTPUT"
|
|
34
|
+
|
|
35
|
+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
36
|
+
echo "Manual trigger — forcing release of v$CURRENT."
|
|
37
|
+
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
38
|
+
else
|
|
39
|
+
PREVIOUS=$(git show HEAD~1:pyproject.toml 2>/dev/null | grep '^version = ' | sed 's/version = "\(.*\)"/\1/' || echo "0.0.0")
|
|
40
|
+
echo "Current version : $CURRENT"
|
|
41
|
+
echo "Previous version: $PREVIOUS"
|
|
42
|
+
|
|
43
|
+
if [ "$CURRENT" != "$PREVIOUS" ]; then
|
|
44
|
+
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
45
|
+
else
|
|
46
|
+
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
47
|
+
echo "Version unchanged — skipping release."
|
|
48
|
+
fi
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
# ─── Build, publish to PyPI and create GitHub Release ──────────────────────
|
|
52
|
+
publish:
|
|
53
|
+
name: Publish v${{ needs.check-version.outputs.version }}
|
|
54
|
+
needs: check-version
|
|
55
|
+
if: needs.check-version.outputs.changed == 'true'
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
permissions:
|
|
58
|
+
contents: write # needed to push tags and create releases
|
|
59
|
+
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v4
|
|
62
|
+
|
|
63
|
+
- uses: astral-sh/setup-uv@v4
|
|
64
|
+
with:
|
|
65
|
+
python-version: "3.13"
|
|
66
|
+
enable-cache: true
|
|
67
|
+
|
|
68
|
+
- name: Build distributions
|
|
69
|
+
run: uv build
|
|
70
|
+
|
|
71
|
+
- name: Publish to PyPI
|
|
72
|
+
run: uv publish
|
|
73
|
+
env:
|
|
74
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
75
|
+
|
|
76
|
+
- name: Create git tag
|
|
77
|
+
run: |
|
|
78
|
+
git config user.name "github-actions[bot]"
|
|
79
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
80
|
+
git tag "v${{ needs.check-version.outputs.version }}"
|
|
81
|
+
git push origin "v${{ needs.check-version.outputs.version }}"
|
|
82
|
+
|
|
83
|
+
- name: Create GitHub Release
|
|
84
|
+
env:
|
|
85
|
+
GH_TOKEN: ${{ github.token }}
|
|
86
|
+
run: |
|
|
87
|
+
gh release create "v${{ needs.check-version.outputs.version }}" dist/* \
|
|
88
|
+
--title "v${{ needs.check-version.outputs.version }}" \
|
|
89
|
+
--generate-notes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
# Virtual environments
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
env/
|
|
12
|
+
|
|
13
|
+
# Distribution / build
|
|
14
|
+
dist/
|
|
15
|
+
build/
|
|
16
|
+
*.egg-info/
|
|
17
|
+
*.egg
|
|
18
|
+
MANIFEST
|
|
19
|
+
|
|
20
|
+
# pytest / coverage
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
.coverage
|
|
23
|
+
.coverage.*
|
|
24
|
+
htmlcov/
|
|
25
|
+
coverage.xml
|
|
26
|
+
|
|
27
|
+
# mypy
|
|
28
|
+
.mypy_cache/
|
|
29
|
+
|
|
30
|
+
# ruff
|
|
31
|
+
.ruff_cache/
|
|
32
|
+
|
|
33
|
+
# Django
|
|
34
|
+
*.log
|
|
35
|
+
db.sqlite3
|
|
36
|
+
staticfiles/
|
|
37
|
+
media/
|
|
38
|
+
|
|
39
|
+
# Environment variables
|
|
40
|
+
.env
|
|
41
|
+
.env.*
|
|
42
|
+
!.env.example
|
|
43
|
+
|
|
44
|
+
# IDE
|
|
45
|
+
.vscode/
|
|
46
|
+
.idea/
|
|
47
|
+
*.swp
|
|
48
|
+
*.swo
|
|
49
|
+
|
|
50
|
+
# OS
|
|
51
|
+
.DS_Store
|
|
52
|
+
Thumbs.db
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.8.4
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
10
|
+
rev: v1.7.1
|
|
11
|
+
hooks:
|
|
12
|
+
- id: mypy
|
|
13
|
+
additional_dependencies:
|
|
14
|
+
- django-stubs
|
|
15
|
+
- djangorestframework-stubs
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 PyMS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|