Skip to content

Commit e999263

Browse files
authored
Merge pull request #1 from sensoris/cache-client
Implement cache-aside client
2 parents 908fe59 + cda5acb commit e999263

File tree

15 files changed

+835
-6
lines changed

15 files changed

+835
-6
lines changed

.github/workflows/tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Tests
2+
3+
on:
4+
push
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e ".[dev]"
25+
26+
- name: Format check with black
27+
run: |
28+
black --check src tests
29+
30+
- name: Type check with mypy
31+
run: |
32+
mypy src
33+
34+
- name: Run unit tests
35+
run: |
36+
pytest tests/test_client.py -v --cov=semcache --cov-report=xml
37+
38+
39+
# todo run integration tests pointing at real docker image of semcache

.gitignore

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.nox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
*.py,cover
48+
.hypothesis/
49+
.pytest_cache/
50+
cover/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
db.sqlite3-journal
61+
62+
# Flask stuff:
63+
instance/
64+
.webassets-cache
65+
66+
# Scrapy stuff:
67+
.scrapy
68+
69+
# Sphinx documentation
70+
docs/_build/
71+
72+
# PyBuilder
73+
.pybuilder/
74+
target/
75+
76+
# Jupyter Notebook
77+
.ipynb_checkpoints
78+
79+
# IPython
80+
profile_default/
81+
ipython_config.py
82+
83+
84+
# Celery stuff
85+
celerybeat-schedule
86+
celerybeat.pid
87+
88+
# SageMath parsed files
89+
*.sage.py
90+
91+
# Environments
92+
.env
93+
.venv
94+
env/
95+
venv/
96+
ENV/
97+
env.bak/
98+
venv.bak/
99+
100+
# Spyder project settings
101+
.spyderproject
102+
.spyproject
103+
104+
# Rope project settings
105+
.ropeproject
106+
107+
# mkdocs documentation
108+
/site
109+
110+
# mypy
111+
.mypy_cache/
112+
.dmypy.json
113+
dmypy.json
114+
115+
# Pyre type checker
116+
.pyre/
117+
118+
# pytype static type analyzer
119+
.pytype/
120+
121+
# Cython debug symbols
122+
cython_debug/
123+
124+
# PyCharm
125+
.idea/
126+
127+
# VSCode
128+
.vscode/
129+
130+
# macOS
131+
.DS_Store
132+
133+
# Windows
134+
Thumbs.db
135+
ehthumbs.db
136+
Desktop.ini
137+
138+
# Project specific
139+
*.log
140+
.cache/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Sensoris
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.

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
include LICENSE
2+
include README.md
3+
include pyproject.toml
4+
include src/semcache/py.typed
5+
recursive-exclude * __pycache__
6+
recursive-exclude * *.py[co]

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.PHONY: install install-dev test test-integration test-all coverage format type-check clean build upload upload-test
2+
3+
install:
4+
pip install -e .
5+
6+
install-dev:
7+
pip install -e ".[dev]"
8+
9+
test:
10+
PYTHONPATH=src pytest tests/test_client.py -v
11+
12+
test-integration:
13+
PYTHONPATH=src pytest tests/test_integration.py
14+
15+
format:
16+
black src tests
17+
18+
type-check:
19+
mypy src
20+
21+
clean:
22+
rm -rf build/
23+
rm -rf dist/
24+
rm -rf *.egg-info
25+
rm -rf src/*.egg-info
26+
find . -type d -name __pycache__ -exec rm -rf {} +
27+
find . -type f -name "*.pyc" -delete
28+
29+
build: clean
30+
python -m build
31+
32+
upload-test: build
33+
twine upload --repository testpypi dist/*
34+
35+
upload: build
36+
twine upload dist/*

0 commit comments

Comments
 (0)