django-fga-data-sync 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.
Files changed (57) hide show
  1. django_fga_data_sync-0.1.0/.github/workflows/publish.yml +51 -0
  2. django_fga_data_sync-0.1.0/.gitignore +216 -0
  3. django_fga_data_sync-0.1.0/.justfile +38 -0
  4. django_fga_data_sync-0.1.0/.pre-commit-config.yaml +121 -0
  5. django_fga_data_sync-0.1.0/LICENSE +674 -0
  6. django_fga_data_sync-0.1.0/PKG-INFO +135 -0
  7. django_fga_data_sync-0.1.0/README.md +103 -0
  8. django_fga_data_sync-0.1.0/docs/api/configs.md +43 -0
  9. django_fga_data_sync-0.1.0/docs/api/mixins.md +8 -0
  10. django_fga_data_sync-0.1.0/docs/api/permissions.md +5 -0
  11. django_fga_data_sync-0.1.0/docs/api/settings.md +69 -0
  12. django_fga_data_sync-0.1.0/docs/architecture/philosophy.md +37 -0
  13. django_fga_data_sync-0.1.0/docs/assets/css/extra.css +38 -0
  14. django_fga_data_sync-0.1.0/docs/assets/js/mermaid.core.mjs +1389 -0
  15. django_fga_data_sync-0.1.0/docs/assets/js/mermaid.min.js +3022 -0
  16. django_fga_data_sync-0.1.0/docs/examples/advanced-trees.md +181 -0
  17. django_fga_data_sync-0.1.0/docs/examples/models.md +292 -0
  18. django_fga_data_sync-0.1.0/docs/examples/stateless-views.md +219 -0
  19. django_fga_data_sync-0.1.0/docs/examples/views.md +323 -0
  20. django_fga_data_sync-0.1.0/docs/getting-started/authz-flow.md +14 -0
  21. django_fga_data_sync-0.1.0/docs/getting-started/docker-traefik.md +67 -0
  22. django_fga_data_sync-0.1.0/docs/getting-started/installation.md +77 -0
  23. django_fga_data_sync-0.1.0/docs/getting-started/zanzibar-model.md +20 -0
  24. django_fga_data_sync-0.1.0/docs/index.md +56 -0
  25. django_fga_data_sync-0.1.0/docs/schema/design-guide.md +220 -0
  26. django_fga_data_sync-0.1.0/docs/schema/local-db-fields.md +143 -0
  27. django_fga_data_sync-0.1.0/docs/schema/role-assignments.md +131 -0
  28. django_fga_data_sync-0.1.0/mkdocs.yml +160 -0
  29. django_fga_data_sync-0.1.0/mypy-pre-commit.ini +11 -0
  30. django_fga_data_sync-0.1.0/pyproject.toml +129 -0
  31. django_fga_data_sync-0.1.0/src/fga_data_sync/__init__.py +24 -0
  32. django_fga_data_sync-0.1.0/src/fga_data_sync/adapters.py +90 -0
  33. django_fga_data_sync-0.1.0/src/fga_data_sync/apps.py +14 -0
  34. django_fga_data_sync-0.1.0/src/fga_data_sync/conf.py +64 -0
  35. django_fga_data_sync-0.1.0/src/fga_data_sync/exceptions.py +8 -0
  36. django_fga_data_sync-0.1.0/src/fga_data_sync/middleware.py +55 -0
  37. django_fga_data_sync-0.1.0/src/fga_data_sync/migrations/__init__.py +0 -0
  38. django_fga_data_sync-0.1.0/src/fga_data_sync/mixins.py +348 -0
  39. django_fga_data_sync-0.1.0/src/fga_data_sync/models.py +40 -0
  40. django_fga_data_sync-0.1.0/src/fga_data_sync/permissions.py +192 -0
  41. django_fga_data_sync-0.1.0/src/fga_data_sync/services.py +17 -0
  42. django_fga_data_sync-0.1.0/src/fga_data_sync/structs.py +437 -0
  43. django_fga_data_sync-0.1.0/src/fga_data_sync/tasks.py +144 -0
  44. django_fga_data_sync-0.1.0/src/fga_data_sync/utils.py +43 -0
  45. django_fga_data_sync-0.1.0/tests/__init__.py +0 -0
  46. django_fga_data_sync-0.1.0/tests/conftest.py +33 -0
  47. django_fga_data_sync-0.1.0/tests/models.py +70 -0
  48. django_fga_data_sync-0.1.0/tests/test_behavioral_parity.py +144 -0
  49. django_fga_data_sync-0.1.0/tests/test_middleware.py +32 -0
  50. django_fga_data_sync-0.1.0/tests/test_mixins.py +108 -0
  51. django_fga_data_sync-0.1.0/tests/test_permissions.py +389 -0
  52. django_fga_data_sync-0.1.0/tests/test_settings.py +38 -0
  53. django_fga_data_sync-0.1.0/tests/test_tasks.py +95 -0
  54. django_fga_data_sync-0.1.0/tests/test_utils.py +33 -0
  55. django_fga_data_sync-0.1.0/tests/test_views_and_mixins.py +240 -0
  56. django_fga_data_sync-0.1.0/tests/views.py +47 -0
  57. django_fga_data_sync-0.1.0/uv.lock +2207 -0
@@ -0,0 +1,51 @@
1
+ name: Publish to PyPI
2
+
3
+ # Trigger the workflow only when a semantic version tag is pushed.
4
+ # This strictly prevents accidental publishes from the main branch.
5
+ on:
6
+ push:
7
+ tags:
8
+ - 'v*.*.*' # e.g., v0.1.0, v1.0.0-beta
9
+
10
+ jobs:
11
+ build-and-publish:
12
+ name: Build and Publish Python Package
13
+ runs-on: ubuntu-latest
14
+
15
+ # Specify the GitHub environment (helpful for deployment protection rules)
16
+ environment:
17
+ name: pypi
18
+ url: https://pypi.org/p/django-fga-data-sync
19
+
20
+ # Mandatory permissions for OIDC authentication with PyPI
21
+ permissions:
22
+ id-token: write # Required to request the OIDC JWT token
23
+ contents: read # Required to perform actions/checkout
24
+
25
+ steps:
26
+ - name: Checkout repository
27
+ uses: actions/checkout@v4
28
+ with:
29
+ fetch-depth: 0 # Useful if hatchling or other tools need git history for dynamic versioning
30
+
31
+ - name: Set up Python 3.12
32
+ uses: actions/setup-python@v5
33
+ with:
34
+ python-version: '3.12'
35
+
36
+ - name: Install build dependencies
37
+ # Upgrading pip and installing the standard PyPA build tool
38
+ run: |
39
+ python -m pip install --upgrade pip
40
+ python -m pip install build
41
+
42
+ - name: Build a binary wheel and a source tarball
43
+ # This will automatically use 'hatchling' as defined in pyproject.toml
44
+ run: python -m build
45
+
46
+ - name: Publish package distributions to PyPI
47
+ uses: pypa/gh-action-pypi-publish@release/v1
48
+ with:
49
+ # Optional: Prevents the workflow from failing if you restart a job
50
+ # for a version that is already uploaded.
51
+ skip-existing: true
@@ -0,0 +1,216 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
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
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
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
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
@@ -0,0 +1,38 @@
1
+ # justfile
2
+
3
+ # Enable automatic loading of .env file
4
+ set dotenv-load := true
5
+
6
+ # Shell configurations
7
+ set shell := ["bash", "-c"]
8
+ set windows-shell := ["pwsh", "-NoLogo", "-Command"]
9
+
10
+ # Default recipe: show help
11
+ default:
12
+ @just --list
13
+
14
+ # 🤠 1. The Ultimate Install Command
15
+ # This reads pyproject.toml, creates the venv, installs the package,
16
+ # and installs both the 'dev' and 'docs' dependency groups instantly.
17
+ install:
18
+ uv sync --group dev --group docs
19
+
20
+ # 🤠 2. Run linting and formatting
21
+ lint:
22
+ uv run ruff check src/
23
+ uv run ruff format src/
24
+ lint-fix:
25
+ uv run ruff check --fix src/
26
+ uv run ruff format src/
27
+
28
+ # 🤠 3. Serve docs (Safely inside the uv venv!)
29
+ docs-serve:
30
+ uv run mkdocs serve --livereload -a 0.0.0.0:80 -w .\docs\ -w .\mkdocs.yml -w .\src\
31
+
32
+ # 🤠 4. Build docs
33
+ docs-build:
34
+ uv run mkdocs build
35
+
36
+ # Cross-platform clean (uses Python instead of rm)
37
+ docs-clean:
38
+ uv run python -c "import shutil, pathlib; shutil.rmtree('site', ignore_errors=True)"
@@ -0,0 +1,121 @@
1
+ # .pre-commit-config.yaml
2
+ # Install: pip install pre-commit && pre-commit install
3
+ # Run manually: pre-commit run --all-files
4
+ # Update hooks: pre-commit autoupdate
5
+
6
+ default_stages: [pre-commit]
7
+
8
+ # Global excludes for Django projects
9
+ exclude: |
10
+ (?x)^(
11
+ .*/migrations/.*|
12
+ .*/static/.*|
13
+ .*/media/.*|
14
+ .*/.venv/.*|
15
+ .*\.pyc$
16
+ )$
17
+
18
+ repos:
19
+ # =============================================================================
20
+ # General File Checks
21
+ # =============================================================================
22
+ - repo: https://github.com/pre-commit/pre-commit-hooks
23
+ rev: v6.0.0
24
+ hooks:
25
+ - id: trailing-whitespace
26
+ - id: end-of-file-fixer
27
+ - id: check-yaml
28
+ exclude: ^mkdocs\.yml$
29
+ - id: check-json
30
+ exclude: ^\.vscode/.*\.json$
31
+ - id: check-toml
32
+ - id: check-added-large-files
33
+ args: ["--maxkb=500"]
34
+ - id: detect-private-key
35
+ - id: fix-byte-order-marker
36
+ - id: mixed-line-ending
37
+ args: ["--fix=lf"]
38
+ - id: check-merge-conflict
39
+ - id: check-case-conflict
40
+ - id: check-docstring-first
41
+ - id: debug-statements # Catches breakpoint(), pdb, etc.
42
+ # Prevent direct commits to main (allow version tags)
43
+ - id: no-commit-to-branch
44
+ args: [--branch, main, --pattern, '^v\d+\.\d+\.\d+.*$']
45
+
46
+ # =============================================================================
47
+ # Python Linting & Formatting (Ruff)
48
+ # Replaces: Black, isort, flake8, pyupgrade
49
+ # =============================================================================
50
+ - repo: https://github.com/astral-sh/ruff-pre-commit
51
+ rev: v0.15.4
52
+ hooks:
53
+ - id: ruff
54
+ args: [--fix, --exit-non-zero-on-fix]
55
+ types_or: [python, pyi, jupyter]
56
+ - id: ruff-format
57
+ types_or: [python, pyi, jupyter]
58
+
59
+ # =============================================================================
60
+ # Django Template Linting
61
+ # =============================================================================
62
+ - repo: https://github.com/djlint/djLint
63
+ rev: v1.36.4
64
+ hooks:
65
+ - id: djlint-reformat-django
66
+ - id: djlint-django
67
+
68
+ # =============================================================================
69
+ # Django Syntax Upgrades
70
+ # =============================================================================
71
+ - repo: https://github.com/adamchainz/django-upgrade
72
+ rev: '1.30.0'
73
+ hooks:
74
+ - id: django-upgrade
75
+ args: [--target-version, "5.2"] # Set to your Django version
76
+
77
+ # =============================================================================
78
+ # Type Checking (Mypy)
79
+ # =============================================================================
80
+ - repo: https://github.com/pre-commit/mirrors-mypy
81
+ rev: v1.19.1
82
+ hooks:
83
+ - id: mypy
84
+ # Adjust 'files' to match your project source directory
85
+ files: ^src/
86
+ # Migrations are auto-generated; exclude them to save time
87
+ exclude: ^src/.*/migrations/
88
+ args: [
89
+ "--no-error-summary",
90
+ "--show-error-codes",
91
+ "--namespace-packages",
92
+ "--explicit-package-bases",
93
+ "--config-file=mypy-pre-commit.ini",
94
+ "--no-error-summary",
95
+ "--show-error-codes"
96
+ ]
97
+ additional_dependencies:
98
+ - "types-requests"
99
+ - "django-environ>=0.11.0"
100
+ - "types-PyYAML"
101
+ - "python-dotenv>=1.0.0"
102
+ - "pytest"
103
+
104
+ # =============================================================================
105
+ # Security Scanning
106
+ # =============================================================================
107
+ - repo: https://github.com/PyCQA/bandit
108
+ rev: 1.9.4
109
+ hooks:
110
+ - id: bandit
111
+ args: ["-c", "pyproject.toml"]
112
+ additional_dependencies: ["bandit[toml]"]
113
+
114
+ # =============================================================================
115
+ # Commit Message Linting
116
+ # =============================================================================
117
+ - repo: https://github.com/commitizen-tools/commitizen
118
+ rev: v4.13.9
119
+ hooks:
120
+ - id: commitizen
121
+ stages: [commit-msg]