fastapi-redis-utils 1.0.2__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.
- fastapi_redis_utils-1.0.2/.github/workflows/ci.yml +80 -0
- fastapi_redis_utils-1.0.2/.gitignore +162 -0
- fastapi_redis_utils-1.0.2/LICENSE +21 -0
- fastapi_redis_utils-1.0.2/Makefile +77 -0
- fastapi_redis_utils-1.0.2/PKG-INFO +394 -0
- fastapi_redis_utils-1.0.2/README.md +366 -0
- fastapi_redis_utils-1.0.2/USAGE.md +183 -0
- fastapi_redis_utils-1.0.2/examples/fastapi_integration.py +217 -0
- fastapi_redis_utils-1.0.2/fastapi_redis_utils/__init__.py +14 -0
- fastapi_redis_utils-1.0.2/fastapi_redis_utils/dependency.py +24 -0
- fastapi_redis_utils-1.0.2/fastapi_redis_utils/manager.py +137 -0
- fastapi_redis_utils-1.0.2/fastapi_redis_utils/models.py +11 -0
- fastapi_redis_utils-1.0.2/fastapi_redis_utils/repository.py +180 -0
- fastapi_redis_utils-1.0.2/pyproject.toml +180 -0
- fastapi_redis_utils-1.0.2/tests/__init__.py +0 -0
- fastapi_redis_utils-1.0.2/tests/conftest.py +64 -0
- fastapi_redis_utils-1.0.2/tests/test_dependency.py +88 -0
- fastapi_redis_utils-1.0.2/tests/test_manager.py +245 -0
- fastapi_redis_utils-1.0.2/tests/test_repository.py +402 -0
- fastapi_redis_utils-1.0.2/uv.lock +1290 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
name: CI/CD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v4
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v1
|
|
28
|
+
with:
|
|
29
|
+
version: latest
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: uv sync --dev
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: uv run pytest
|
|
36
|
+
|
|
37
|
+
- name: Run linting
|
|
38
|
+
run: |
|
|
39
|
+
uv run ruff check .
|
|
40
|
+
|
|
41
|
+
- name: Run type checking
|
|
42
|
+
run: uv run mypy .
|
|
43
|
+
|
|
44
|
+
- name: Upload coverage to Codecov
|
|
45
|
+
uses: codecov/codecov-action@v3
|
|
46
|
+
with:
|
|
47
|
+
file: ./coverage.xml
|
|
48
|
+
flags: unittests
|
|
49
|
+
name: codecov-umbrella
|
|
50
|
+
fail_ci_if_error: false
|
|
51
|
+
|
|
52
|
+
build:
|
|
53
|
+
needs: test
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
56
|
+
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
|
|
60
|
+
- name: Set up Python
|
|
61
|
+
uses: actions/setup-python@v4
|
|
62
|
+
with:
|
|
63
|
+
python-version: "3.11"
|
|
64
|
+
|
|
65
|
+
- name: Install uv
|
|
66
|
+
uses: astral-sh/setup-uv@v1
|
|
67
|
+
with:
|
|
68
|
+
version: latest
|
|
69
|
+
|
|
70
|
+
- name: Install dependencies
|
|
71
|
+
run: uv sync --dev
|
|
72
|
+
|
|
73
|
+
- name: Build package
|
|
74
|
+
run: uv build
|
|
75
|
+
|
|
76
|
+
- name: Publish to PyPI
|
|
77
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
78
|
+
with:
|
|
79
|
+
user: __token__
|
|
80
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
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
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
*.iml
|
|
156
|
+
*.ipr
|
|
157
|
+
*.iws
|
|
158
|
+
.vscode/
|
|
159
|
+
.uv/
|
|
160
|
+
.history/
|
|
161
|
+
.idea/
|
|
162
|
+
site/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 FastAPI Redis Connection
|
|
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.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.PHONY: help install test lint format clean build publish docs
|
|
2
|
+
|
|
3
|
+
help: ## Show help
|
|
4
|
+
@echo "Available commands:"
|
|
5
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
|
6
|
+
|
|
7
|
+
install: ## Install development dependencies
|
|
8
|
+
uv sync --dev
|
|
9
|
+
|
|
10
|
+
test: ## Run tests
|
|
11
|
+
uv run pytest
|
|
12
|
+
|
|
13
|
+
test-cov: ## Run tests with coverage
|
|
14
|
+
uv run pytest --cov=fastapi_redis_utils --cov-report=html --cov-report=term-missing
|
|
15
|
+
|
|
16
|
+
lint: ## Check code with linters
|
|
17
|
+
uv run ruff check .
|
|
18
|
+
uv run ruff format .
|
|
19
|
+
uv run mypy .
|
|
20
|
+
|
|
21
|
+
format: ## Format code
|
|
22
|
+
uv run ruff format .
|
|
23
|
+
uv run ruff check --fix .
|
|
24
|
+
|
|
25
|
+
clean: ## Clean temporary files
|
|
26
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
27
|
+
find . -type f -name "*.pyc" -delete
|
|
28
|
+
find . -type f -name "*.pyo" -delete
|
|
29
|
+
find . -type f -name "*.pyd" -delete
|
|
30
|
+
find . -type d -name "*.egg-info" -exec rm -rf {} +
|
|
31
|
+
find . -type d -name "*.egg" -exec rm -rf {} +
|
|
32
|
+
find . -type d -name ".pytest_cache" -exec rm -rf {} +
|
|
33
|
+
find . -type d -name ".coverage" -delete
|
|
34
|
+
find . -type d -name "htmlcov" -exec rm -rf {} +
|
|
35
|
+
find . -type d -name ".mypy_cache" -exec rm -rf {} +
|
|
36
|
+
find . -type d -name "dist" -exec rm -rf {} +
|
|
37
|
+
find . -type d -name "build" -exec rm -rf {} +
|
|
38
|
+
|
|
39
|
+
build: ## Build package
|
|
40
|
+
uv build
|
|
41
|
+
|
|
42
|
+
check: ## Full pre-commit check
|
|
43
|
+
uv run ruff check .
|
|
44
|
+
uv run mypy fastapi_redis_utils tests/
|
|
45
|
+
uv run pytest
|
|
46
|
+
|
|
47
|
+
example-fastapi: ## Run FastAPI example
|
|
48
|
+
uv run python examples/fastapi_integration.py
|
|
49
|
+
|
|
50
|
+
dev-setup: ## Setup development environment
|
|
51
|
+
uv sync --dev
|
|
52
|
+
|
|
53
|
+
version: ## Show current version
|
|
54
|
+
@uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)"
|
|
55
|
+
|
|
56
|
+
tags: ## List all git tags
|
|
57
|
+
@git tag --sort=-version:refname
|
|
58
|
+
|
|
59
|
+
release: ## Create release: build, test, tag and push
|
|
60
|
+
@echo "Creating release for version $(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)")"
|
|
61
|
+
@make clean
|
|
62
|
+
@make test
|
|
63
|
+
@make build
|
|
64
|
+
@make publish
|
|
65
|
+
@echo "Release v$(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)") completed successfully"
|
|
66
|
+
|
|
67
|
+
publish: ## Create and push git tag with current version
|
|
68
|
+
@echo "Creating git tag for version $(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)")"
|
|
69
|
+
@git tag -a v$(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)") -m "Release version $(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)")"
|
|
70
|
+
@git push origin v$(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)")
|
|
71
|
+
@echo "Tag v$(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)") created and pushed successfully"
|
|
72
|
+
|
|
73
|
+
publish-dry-run: ## Show what would be done without creating tag
|
|
74
|
+
@echo "Would create git tag: v$(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)")"
|
|
75
|
+
@echo "Would push tag to origin"
|
|
76
|
+
@echo "Current version: $(shell uv run python -c "import fastapi_redis_utils; print(fastapi_redis_utils.__version__)")"
|
|
77
|
+
|