drf-hierarchy 0.1.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.
- drf_hierarchy-0.1.0/.env.example +15 -0
- drf_hierarchy-0.1.0/.github/workflows/ci.yml +80 -0
- drf_hierarchy-0.1.0/.github/workflows/release.yml +38 -0
- drf_hierarchy-0.1.0/.gitignore +138 -0
- drf_hierarchy-0.1.0/Dockerfile +7 -0
- drf_hierarchy-0.1.0/LICENSE +674 -0
- drf_hierarchy-0.1.0/PKG-INFO +223 -0
- drf_hierarchy-0.1.0/README.md +212 -0
- drf_hierarchy-0.1.0/docker-compose.yml +15 -0
- drf_hierarchy-0.1.0/docs/index.md +1 -0
- drf_hierarchy-0.1.0/hierarchy/__init__.py +5 -0
- drf_hierarchy-0.1.0/hierarchy/admin.py +61 -0
- drf_hierarchy-0.1.0/hierarchy/apps.py +6 -0
- drf_hierarchy-0.1.0/hierarchy/backends.py +15 -0
- drf_hierarchy-0.1.0/hierarchy/migrations/0001_initial.py +42 -0
- drf_hierarchy-0.1.0/hierarchy/migrations/__init__.py +0 -0
- drf_hierarchy-0.1.0/hierarchy/models.py +129 -0
- drf_hierarchy-0.1.0/hierarchy/serializers.py +39 -0
- drf_hierarchy-0.1.0/hierarchy/services.py +47 -0
- drf_hierarchy-0.1.0/hierarchy/settings.py +16 -0
- drf_hierarchy-0.1.0/hierarchy/tests/__init__.py +0 -0
- drf_hierarchy-0.1.0/hierarchy/tests/fixtures/auth.json +32 -0
- drf_hierarchy-0.1.0/hierarchy/tests/test_backends.py +108 -0
- drf_hierarchy-0.1.0/hierarchy/tests/test_integration.py +6 -0
- drf_hierarchy-0.1.0/hierarchy/tests/test_models.py +87 -0
- drf_hierarchy-0.1.0/hierarchy/tests/test_serializers.py +38 -0
- drf_hierarchy-0.1.0/hierarchy/validators.py +54 -0
- drf_hierarchy-0.1.0/hierarchy/views.py +18 -0
- drf_hierarchy-0.1.0/manage.py +21 -0
- drf_hierarchy-0.1.0/mkdocs.sh +12 -0
- drf_hierarchy-0.1.0/mkdocs.yml +8 -0
- drf_hierarchy-0.1.0/pyproject.toml +42 -0
- drf_hierarchy-0.1.0/requirements.txt +3 -0
- drf_hierarchy-0.1.0/sample/__init__.py +0 -0
- drf_hierarchy-0.1.0/sample/asgi.py +16 -0
- drf_hierarchy-0.1.0/sample/settings.py +163 -0
- drf_hierarchy-0.1.0/sample/urls.py +14 -0
- drf_hierarchy-0.1.0/sample/wsgi.py +16 -0
- drf_hierarchy-0.1.0/scripts/check_semver.py +66 -0
- drf_hierarchy-0.1.0/uv.lock +259 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
DEBUG=True
|
|
2
|
+
SECRET_KEY=change-me-to-a-long-random-secret-key
|
|
3
|
+
ALLOWED_HOSTS=localhost,127.0.0.1,[::1]
|
|
4
|
+
CSRF_COOKIE_SECURE=False
|
|
5
|
+
SESSION_COOKIE_SECURE=False
|
|
6
|
+
SECURE_SSL_REDIRECT=False
|
|
7
|
+
SECURE_HSTS_SECONDS=0
|
|
8
|
+
SECURE_HSTS_PRELOAD=False
|
|
9
|
+
SECURE_HSTS_INCLUDE_SUBDOMAINS=False
|
|
10
|
+
DB_ENGINE=sqlite
|
|
11
|
+
DB_NAME=db.sqlite3
|
|
12
|
+
DB_USER=
|
|
13
|
+
DB_PASSWORD=
|
|
14
|
+
DB_HOST=
|
|
15
|
+
DB_PORT=
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
quality:
|
|
10
|
+
name: Quality checks (default stack)
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
|
|
22
|
+
- name: Set up uv
|
|
23
|
+
uses: astral-sh/setup-uv@v3
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: uv sync --group dev
|
|
27
|
+
|
|
28
|
+
- name: Validate SemVer project version
|
|
29
|
+
run: uv run python scripts/check_semver.py
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: uv run ruff check .
|
|
33
|
+
|
|
34
|
+
- name: Django checks
|
|
35
|
+
run: uv run python manage.py check --settings=sample.settings
|
|
36
|
+
|
|
37
|
+
- name: Test
|
|
38
|
+
run: uv run pytest -q
|
|
39
|
+
|
|
40
|
+
compatibility:
|
|
41
|
+
name: Compatibility (Py${{ matrix.python }} / ${{ matrix.django_label }})
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
strategy:
|
|
44
|
+
fail-fast: false
|
|
45
|
+
matrix:
|
|
46
|
+
include:
|
|
47
|
+
- python: "3.10"
|
|
48
|
+
django_label: "Django 4.2"
|
|
49
|
+
django_spec: "Django>=4.2,<5.0"
|
|
50
|
+
drf_spec: "djangorestframework>=3.15,<3.16"
|
|
51
|
+
- python: "3.11"
|
|
52
|
+
django_label: "Django 5.x"
|
|
53
|
+
django_spec: "Django>=5.0,<6.0"
|
|
54
|
+
drf_spec: "djangorestframework>=3.15,<3.17"
|
|
55
|
+
- python: "3.12"
|
|
56
|
+
django_label: "Django 6.x"
|
|
57
|
+
django_spec: "Django>=6.0,<7.0"
|
|
58
|
+
drf_spec: "djangorestframework>=3.16,<3.17"
|
|
59
|
+
|
|
60
|
+
steps:
|
|
61
|
+
- name: Checkout
|
|
62
|
+
uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- name: Set up Python
|
|
65
|
+
uses: actions/setup-python@v5
|
|
66
|
+
with:
|
|
67
|
+
python-version: ${{ matrix.python }}
|
|
68
|
+
|
|
69
|
+
- name: Set up uv
|
|
70
|
+
uses: astral-sh/setup-uv@v3
|
|
71
|
+
|
|
72
|
+
- name: Install dependencies
|
|
73
|
+
run: uv sync --group dev
|
|
74
|
+
|
|
75
|
+
- name: Run tests against matrix dependencies
|
|
76
|
+
run: |
|
|
77
|
+
uv run \
|
|
78
|
+
--with "${{ matrix.django_spec }}" \
|
|
79
|
+
--with "${{ matrix.drf_spec }}" \
|
|
80
|
+
pytest -q
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: Build and publish package
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Set up uv
|
|
26
|
+
uses: astral-sh/setup-uv@v3
|
|
27
|
+
|
|
28
|
+
- name: Validate SemVer tag and package version
|
|
29
|
+
run: uv run python scripts/check_semver.py --check-tag-match --tag "${{ github.event.release.tag_name }}"
|
|
30
|
+
|
|
31
|
+
- name: Build distributions
|
|
32
|
+
run: uv build
|
|
33
|
+
|
|
34
|
+
- name: Check distributions
|
|
35
|
+
run: uv run --with twine python -m twine check dist/*
|
|
36
|
+
|
|
37
|
+
- name: Publish to PyPI
|
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# Eclipse
|
|
132
|
+
.project
|
|
133
|
+
.pydevproject
|
|
134
|
+
|
|
135
|
+
# PyCharm
|
|
136
|
+
.idea/
|
|
137
|
+
|
|
138
|
+
|