drf-subscription 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_subscription-0.1.0/.dockerignore +13 -0
- drf_subscription-0.1.0/.github/workflows/bump.yml +50 -0
- drf_subscription-0.1.0/.github/workflows/ci.yml +31 -0
- drf_subscription-0.1.0/.github/workflows/publish.yml +49 -0
- drf_subscription-0.1.0/.gitignore +135 -0
- drf_subscription-0.1.0/.python-version +1 -0
- drf_subscription-0.1.0/CHANGELOG.md +12 -0
- drf_subscription-0.1.0/Dockerfile +22 -0
- drf_subscription-0.1.0/LICENSE.md +674 -0
- drf_subscription-0.1.0/PKG-INFO +76 -0
- drf_subscription-0.1.0/README.md +51 -0
- drf_subscription-0.1.0/docker-compose.yml +44 -0
- drf_subscription-0.1.0/docs/index.md +1 -0
- drf_subscription-0.1.0/entrypoint.sh +8 -0
- drf_subscription-0.1.0/manage.py +22 -0
- drf_subscription-0.1.0/mkdocs.sh +12 -0
- drf_subscription-0.1.0/mkdocs.yml +7 -0
- drf_subscription-0.1.0/pyproject.toml +47 -0
- drf_subscription-0.1.0/sample/__init__.py +3 -0
- drf_subscription-0.1.0/sample/asgi.py +16 -0
- drf_subscription-0.1.0/sample/celery.py +10 -0
- drf_subscription-0.1.0/sample/settings.py +138 -0
- drf_subscription-0.1.0/sample/tasks.py +6 -0
- drf_subscription-0.1.0/sample/urls.py +22 -0
- drf_subscription-0.1.0/sample/wsgi.py +16 -0
- drf_subscription-0.1.0/scripts/bump_version.py +133 -0
- drf_subscription-0.1.0/subscription/__init__.py +3 -0
- drf_subscription-0.1.0/subscription/admin.py +181 -0
- drf_subscription-0.1.0/subscription/api.py +48 -0
- drf_subscription-0.1.0/subscription/apps.py +8 -0
- drf_subscription-0.1.0/subscription/fixtures/auth.json +30 -0
- drf_subscription-0.1.0/subscription/fixtures/contenttypes.json +18 -0
- drf_subscription-0.1.0/subscription/fixtures/subscription.json +93 -0
- drf_subscription-0.1.0/subscription/managers.py +194 -0
- drf_subscription-0.1.0/subscription/middleware.py +23 -0
- drf_subscription-0.1.0/subscription/migrations/0001_initial.py +72 -0
- drf_subscription-0.1.0/subscription/migrations/__init__.py +0 -0
- drf_subscription-0.1.0/subscription/models/__init__.py +10 -0
- drf_subscription-0.1.0/subscription/models/abstract.py +173 -0
- drf_subscription-0.1.0/subscription/models/decorators.py +35 -0
- drf_subscription-0.1.0/subscription/models/mixins.py +51 -0
- drf_subscription-0.1.0/subscription/models/resource.py +135 -0
- drf_subscription-0.1.0/subscription/models/subscription.py +119 -0
- drf_subscription-0.1.0/subscription/serializers.py +37 -0
- drf_subscription-0.1.0/subscription/signals.py +46 -0
- drf_subscription-0.1.0/subscription/tests/__init__.py +0 -0
- drf_subscription-0.1.0/subscription/tests/models/__init__.py +0 -0
- drf_subscription-0.1.0/subscription/tests/models/test_mixins.py +66 -0
- drf_subscription-0.1.0/subscription/tests/models/test_resource.py +8 -0
- drf_subscription-0.1.0/subscription/tests/models/test_subscription.py +159 -0
- drf_subscription-0.1.0/subscription/tests/test_api.py +44 -0
- drf_subscription-0.1.0/subscription/tests/test_integration.py +0 -0
- drf_subscription-0.1.0/subscription/tests/test_managers.py +21 -0
- drf_subscription-0.1.0/subscription/tests/test_middleware.py +56 -0
- drf_subscription-0.1.0/subscription/tests/test_serializers.py +32 -0
- drf_subscription-0.1.0/subscription/tests/test_signals.py +11 -0
- drf_subscription-0.1.0/subscription/tests/test_validators.py +36 -0
- drf_subscription-0.1.0/subscription/tests/test_views.py +0 -0
- drf_subscription-0.1.0/subscription/tests/utils.py +33 -0
- drf_subscription-0.1.0/subscription/validators.py +24 -0
- drf_subscription-0.1.0/subscription/views.py +3 -0
- drf_subscription-0.1.0/uv.lock +363 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Bump version
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
part:
|
|
7
|
+
description: 'Semver bump type'
|
|
8
|
+
required: true
|
|
9
|
+
type: choice
|
|
10
|
+
default: 'patch'
|
|
11
|
+
options:
|
|
12
|
+
- patch
|
|
13
|
+
- minor
|
|
14
|
+
- major
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
id-token: write
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
release:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
|
|
28
|
+
- name: Install uv
|
|
29
|
+
uses: astral-sh/setup-uv@v5
|
|
30
|
+
with:
|
|
31
|
+
enable-cache: true
|
|
32
|
+
|
|
33
|
+
- name: Set up Python
|
|
34
|
+
uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version-file: .python-version
|
|
37
|
+
|
|
38
|
+
- name: Configure git
|
|
39
|
+
run: |
|
|
40
|
+
git config user.name "github-actions[bot]"
|
|
41
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
42
|
+
|
|
43
|
+
- name: Bump, commit, tag and push
|
|
44
|
+
run: uv run python scripts/bump_version.py ${{ inputs.part }} --commit --tag --push
|
|
45
|
+
|
|
46
|
+
- name: Build package
|
|
47
|
+
run: uv build
|
|
48
|
+
|
|
49
|
+
- name: Publish to PyPI
|
|
50
|
+
run: uv publish
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install uv
|
|
15
|
+
uses: astral-sh/setup-uv@v5
|
|
16
|
+
with:
|
|
17
|
+
enable-cache: true
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version-file: .python-version
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: uv sync
|
|
26
|
+
|
|
27
|
+
- name: Run system checks
|
|
28
|
+
run: uv run python manage.py check
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: uv run python manage.py test
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
paths:
|
|
7
|
+
- 'subscription/__init__.py'
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
publish:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
with:
|
|
24
|
+
enable-cache: true
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version-file: .python-version
|
|
30
|
+
|
|
31
|
+
- name: Detect version change
|
|
32
|
+
id: version
|
|
33
|
+
run: |
|
|
34
|
+
current="$(sed -n 's/^__version__ = "\([^"]*\)"/\1/p' subscription/__init__.py)"
|
|
35
|
+
previous="$(git show HEAD~1:subscription/__init__.py 2>/dev/null | sed -n 's/^__version__ = "\([^"]*\)"/\1/p' || true)"
|
|
36
|
+
echo "current=${current} previous=${previous}"
|
|
37
|
+
if [ -n "${current}" ] && [ "${current}" != "${previous}" ]; then
|
|
38
|
+
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
39
|
+
else
|
|
40
|
+
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
- name: Build package
|
|
44
|
+
if: steps.version.outputs.changed == 'true'
|
|
45
|
+
run: uv build
|
|
46
|
+
|
|
47
|
+
- name: Publish to PyPI
|
|
48
|
+
if: steps.version.outputs.changed == 'true'
|
|
49
|
+
run: uv publish
|
|
@@ -0,0 +1,135 @@
|
|
|
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 / uv (uv uses .python-version to pin the Python version; keep it in VCS)
|
|
85
|
+
|
|
86
|
+
# pipenv
|
|
87
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
88
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
89
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
90
|
+
# install all needed dependencies.
|
|
91
|
+
#Pipfile.lock
|
|
92
|
+
|
|
93
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
94
|
+
__pypackages__/
|
|
95
|
+
|
|
96
|
+
# Celery stuff
|
|
97
|
+
celerybeat-schedule
|
|
98
|
+
celerybeat.pid
|
|
99
|
+
|
|
100
|
+
# SageMath parsed files
|
|
101
|
+
*.sage.py
|
|
102
|
+
|
|
103
|
+
# Environments
|
|
104
|
+
.env
|
|
105
|
+
.venv
|
|
106
|
+
env/
|
|
107
|
+
venv/
|
|
108
|
+
ENV/
|
|
109
|
+
env.bak/
|
|
110
|
+
venv.bak/
|
|
111
|
+
|
|
112
|
+
# Spyder project settings
|
|
113
|
+
.spyderproject
|
|
114
|
+
.spyproject
|
|
115
|
+
|
|
116
|
+
# Rope project settings
|
|
117
|
+
.ropeproject
|
|
118
|
+
|
|
119
|
+
# mkdocs documentation
|
|
120
|
+
/site
|
|
121
|
+
|
|
122
|
+
# mypy
|
|
123
|
+
.mypy_cache/
|
|
124
|
+
.dmypy.json
|
|
125
|
+
dmypy.json
|
|
126
|
+
|
|
127
|
+
# Pyre type checker
|
|
128
|
+
.pyre/
|
|
129
|
+
|
|
130
|
+
# Eclipse
|
|
131
|
+
.project
|
|
132
|
+
.pydevproject
|
|
133
|
+
|
|
134
|
+
# PyCharm
|
|
135
|
+
.idea/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- REST API router (admin-only) exposing subscriptions, lines, events and resources.
|
|
12
|
+
- Semantic Versioning via `scripts/bump_version.py`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
4
|
+
ENV PYTHONUNBUFFERED=1
|
|
5
|
+
|
|
6
|
+
# Install uv (the only package manager)
|
|
7
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
8
|
+
|
|
9
|
+
WORKDIR /usr/src/app
|
|
10
|
+
|
|
11
|
+
# Install dependencies first for better layer caching
|
|
12
|
+
COPY pyproject.toml uv.lock README.md ./
|
|
13
|
+
COPY subscription ./subscription
|
|
14
|
+
COPY sample ./sample
|
|
15
|
+
COPY manage.py ./
|
|
16
|
+
|
|
17
|
+
RUN uv sync --frozen
|
|
18
|
+
|
|
19
|
+
COPY entrypoint.sh /usr/src/app/entrypoint.sh
|
|
20
|
+
RUN chmod +x /usr/src/app/entrypoint.sh
|
|
21
|
+
|
|
22
|
+
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]
|