mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 13:07:53 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9928f4cda0 | ||
|
|
4faa5b7101 | ||
|
|
c3be2eca19 | ||
|
|
8a8eb395ec | ||
|
|
e397dcb16b | ||
|
|
37a2fa85db | ||
|
|
6888c10d6c | ||
|
|
943935870d | ||
|
|
46c7ada364 | ||
|
|
767241be41 | ||
|
|
de1bde39fd | ||
|
|
8490ad36f0 | ||
|
|
57fe4ce24b | ||
|
|
3dc2b53e41 | ||
|
|
2dd37b09ab | ||
|
|
0bc8c6c20e | ||
|
|
9e3c9816c5 | ||
|
|
7c7aa26a88 | ||
|
|
1edb0ba1fe | ||
|
|
7c2007847f | ||
|
|
80de421a2a | ||
|
|
eb55b01be9 | ||
|
|
8573eeace6 | ||
|
|
1d0c245a70 | ||
|
|
c665189d90 | ||
|
|
ba7276ba98 | ||
|
|
30e5246cf5 | ||
|
|
cdae610432 | ||
|
|
9157412d6a | ||
|
|
a9b0b9d913 | ||
|
|
fec3c78291 | ||
|
|
361a25857b | ||
|
|
6f5d4900a9 | ||
|
|
7f7252d151 | ||
|
|
c9e03ed9af | ||
|
|
7f2ebfc494 | ||
|
|
a42fdaf632 | ||
|
|
9ca5b0fa9a | ||
|
|
75b4547963 | ||
|
|
3134e5f67c |
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
custom: ["https://sponsor.long2ice.io"]
|
||||||
|
|
||||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -8,6 +8,8 @@ jobs:
|
|||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- uses: dschep/install-poetry-action@v1.3
|
- uses: abatilo/actions-poetry@v2.1.3
|
||||||
|
- name: Config poetry
|
||||||
|
run: poetry config experimental.new-installer false
|
||||||
- name: CI
|
- name: CI
|
||||||
run: make ci
|
run: make ci
|
||||||
|
|||||||
4
.github/workflows/pypi.yml
vendored
4
.github/workflows/pypi.yml
vendored
@@ -11,7 +11,9 @@ jobs:
|
|||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- uses: dschep/install-poetry-action@v1.3
|
- uses: abatilo/actions-poetry@v2.1.3
|
||||||
|
- name: Config poetry
|
||||||
|
run: poetry config experimental.new-installer false
|
||||||
- name: Build dists
|
- name: Build dists
|
||||||
run: make build
|
run: make build
|
||||||
- name: Pypi Publish
|
- name: Pypi Publish
|
||||||
|
|||||||
24
CHANGELOG.md
24
CHANGELOG.md
@@ -2,6 +2,30 @@
|
|||||||
|
|
||||||
## 0.1
|
## 0.1
|
||||||
|
|
||||||
|
### 0.1.7
|
||||||
|
|
||||||
|
- Fix default json coder for datetime.
|
||||||
|
- Add `enable` param to `init`.
|
||||||
|
|
||||||
|
### 0.1.6
|
||||||
|
|
||||||
|
- Fix redis cache.
|
||||||
|
- Encode key builder.
|
||||||
|
|
||||||
|
### 0.1.5
|
||||||
|
|
||||||
|
- Fix setting expire for redis (#24)
|
||||||
|
- Update expire key
|
||||||
|
|
||||||
|
### 0.1.4
|
||||||
|
|
||||||
|
- Fix default expire for memcached. (#13)
|
||||||
|
- Update default key builder. (#12)
|
||||||
|
|
||||||
|
### 0.1.3
|
||||||
|
|
||||||
|
- Fix cache key builder.
|
||||||
|
|
||||||
### 0.1.2
|
### 0.1.2
|
||||||
|
|
||||||
- Add default config when init.
|
- Add default config when init.
|
||||||
|
|||||||
30
Makefile
30
Makefile
@@ -1,19 +1,6 @@
|
|||||||
checkfiles = fastapi_cache/ examples/ tests/
|
checkfiles = fastapi_cache/ examples/ tests/
|
||||||
black_opts = -l 100 -t py38
|
|
||||||
py_warn = PYTHONDEVMODE=1
|
py_warn = PYTHONDEVMODE=1
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "FastAPI-Cache development makefile"
|
|
||||||
@echo
|
|
||||||
@echo "usage: make <target>"
|
|
||||||
@echo "Targets:"
|
|
||||||
@echo " up Ensure dev/test dependencies are updated"
|
|
||||||
@echo " deps Ensure dev/test dependencies are installed"
|
|
||||||
@echo " check Checks that build is sane"
|
|
||||||
@echo " test Runs all tests"
|
|
||||||
@echo " style Auto-formats the code"
|
|
||||||
@echo " build Build package"
|
|
||||||
|
|
||||||
up:
|
up:
|
||||||
@poetry update
|
@poetry update
|
||||||
|
|
||||||
@@ -21,18 +8,21 @@ deps:
|
|||||||
@poetry install --no-root -E all
|
@poetry install --no-root -E all
|
||||||
|
|
||||||
style: deps
|
style: deps
|
||||||
@isort -src $(checkfiles)
|
@poetry run isort -src $(checkfiles)
|
||||||
@black $(black_opts) $(checkfiles)
|
@poetry run black $(checkfiles)
|
||||||
|
|
||||||
check: deps
|
check: deps
|
||||||
@black --check $(black_opts) $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)
|
@poetry run black $(checkfiles) || (echo "Please run 'make style' to auto-fix style issues" && false)
|
||||||
@flake8 $(checkfiles)
|
@poetry run flake8 $(checkfiles)
|
||||||
@bandit -r $(checkfiles)
|
@poetry run bandit -r $(checkfiles)
|
||||||
|
|
||||||
test: deps
|
test: deps
|
||||||
$(py_warn) pytest
|
$(py_warn) poetry run pytest
|
||||||
|
|
||||||
build: deps
|
build: clean deps
|
||||||
@poetry build
|
@poetry build
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -rf ./dist
|
||||||
|
|
||||||
ci: check test
|
ci: check test
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -30,13 +30,13 @@
|
|||||||
or
|
or
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> pip install fastapi-cache2[redis]
|
> pip install "fastapi-cache2[redis]"
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
> pip install fastapi-cache2[memcache]
|
> pip install "fastapi-cache2[memcache]"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -69,15 +69,27 @@ async def index(request: Request, response: Response):
|
|||||||
|
|
||||||
@app.on_event("startup")
|
@app.on_event("startup")
|
||||||
async def startup():
|
async def startup():
|
||||||
redis = await aioredis.create_redis_pool("redis://localhost", encoding="utf8")
|
redis = aioredis.from_url("redis://localhost", encoding="utf8", decode_responses=True)
|
||||||
FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
|
FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Initialization
|
||||||
|
|
||||||
|
Firstly you must call `FastAPICache.init` on startup event of `fastapi`, there are some global config you can pass in.
|
||||||
|
|
||||||
### Use `cache` decorator
|
### Use `cache` decorator
|
||||||
|
|
||||||
If you want cache `fastapi` response transparently, you can use `cache` as decorator between router decorator and view function and must pass `request` as param of view function.
|
If you want cache `fastapi` response transparently, you can use `cache` as decorator between router decorator and view function and must pass `request` as param of view function.
|
||||||
|
|
||||||
|
Parameter | type, description
|
||||||
|
------------ | -------------
|
||||||
|
expire | int, states a caching time in seconds
|
||||||
|
namespace | str, namespace to use to store certain cache items
|
||||||
|
coder | which coder to use, e.g. JsonCoder
|
||||||
|
key_builder | which key builder to use, default to builtin
|
||||||
|
|
||||||
|
|
||||||
And if you want use `ETag` and `Cache-Control` features, you must pass `response` param also.
|
And if you want use `ETag` and `Cache-Control` features, you must pass `response` param also.
|
||||||
|
|
||||||
You can also use `cache` as decorator like other cache tools to cache common function result.
|
You can also use `cache` as decorator like other cache tools to cache common function result.
|
||||||
@@ -95,6 +107,8 @@ async def index(request: Request, response: Response):
|
|||||||
|
|
||||||
### Custom key builder
|
### Custom key builder
|
||||||
|
|
||||||
|
By default use builtin key builder, if you need, you can override this and pass in `cache` or `FastAPICache.init` to take effect globally.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def my_key_builder(
|
def my_key_builder(
|
||||||
func,
|
func,
|
||||||
@@ -116,7 +130,7 @@ async def index(request: Request, response: Response):
|
|||||||
|
|
||||||
### InMemoryBackend
|
### InMemoryBackend
|
||||||
|
|
||||||
`InMemoryBackend` only support in single node instead of distributed environment.
|
`InMemoryBackend` store cache data in memory and use lazy delete, which mean if you don't access it after cached, it will not delete automatically.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
|
from datetime import date, datetime
|
||||||
|
|
||||||
|
import aioredis
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
from starlette.responses import Response
|
from starlette.responses import Response
|
||||||
|
|
||||||
from fastapi_cache import FastAPICache
|
from fastapi_cache import FastAPICache
|
||||||
from fastapi_cache.backends.inmemory import InMemoryBackend
|
from fastapi_cache.backends.redis import RedisBackend
|
||||||
from fastapi_cache.decorator import cache
|
from fastapi_cache.decorator import cache
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
@@ -20,7 +23,7 @@ async def get_ret():
|
|||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
@cache(namespace="test", expire=2)
|
@cache(namespace="test", expire=20)
|
||||||
async def index(request: Request, response: Response):
|
async def index(request: Request, response: Response):
|
||||||
return dict(ret=await get_ret())
|
return dict(ret=await get_ret())
|
||||||
|
|
||||||
@@ -30,9 +33,22 @@ async def clear():
|
|||||||
return await FastAPICache.clear(namespace="test")
|
return await FastAPICache.clear(namespace="test")
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/date")
|
||||||
|
@cache(namespace="test", expire=20)
|
||||||
|
async def get_data(request: Request, response: Response):
|
||||||
|
return date.today()
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/datetime")
|
||||||
|
@cache(namespace="test", expire=20)
|
||||||
|
async def get_datetime(request: Request, response: Response):
|
||||||
|
return datetime.now()
|
||||||
|
|
||||||
|
|
||||||
@app.on_event("startup")
|
@app.on_event("startup")
|
||||||
async def startup():
|
async def startup():
|
||||||
FastAPICache.init(InMemoryBackend(), prefix="fastapi-cache")
|
redis = aioredis.from_url(url="redis://localhost")
|
||||||
|
FastAPICache.init(RedisBackend(redis), prefix="fastapi-cache")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class FastAPICache:
|
|||||||
_init = False
|
_init = False
|
||||||
_coder = None
|
_coder = None
|
||||||
_key_builder = None
|
_key_builder = None
|
||||||
|
_enable = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def init(
|
def init(
|
||||||
@@ -20,6 +21,7 @@ class FastAPICache:
|
|||||||
expire: int = None,
|
expire: int = None,
|
||||||
coder: Coder = JsonCoder,
|
coder: Coder = JsonCoder,
|
||||||
key_builder: Callable = default_key_builder,
|
key_builder: Callable = default_key_builder,
|
||||||
|
enable: bool = True,
|
||||||
):
|
):
|
||||||
if cls._init:
|
if cls._init:
|
||||||
return
|
return
|
||||||
@@ -29,6 +31,7 @@ class FastAPICache:
|
|||||||
cls._expire = expire
|
cls._expire = expire
|
||||||
cls._coder = coder
|
cls._coder = coder
|
||||||
cls._key_builder = key_builder
|
cls._key_builder = key_builder
|
||||||
|
cls._enable = enable
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_backend(cls):
|
def get_backend(cls):
|
||||||
@@ -51,6 +54,10 @@ class FastAPICache:
|
|||||||
def get_key_builder(cls):
|
def get_key_builder(cls):
|
||||||
return cls._key_builder
|
return cls._key_builder
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_enable(cls):
|
||||||
|
return cls._enable
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def clear(cls, namespace: str = None, key: str = None):
|
async def clear(cls, namespace: str = None, key: str = None):
|
||||||
namespace = cls._prefix + ":" + namespace if namespace else None
|
namespace = cls._prefix + ":" + namespace if namespace else None
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class MemcachedBackend(Backend):
|
|||||||
return await self.mcache.get(key, key.encode())
|
return await self.mcache.get(key, key.encode())
|
||||||
|
|
||||||
async def set(self, key: str, value: str, expire: int = None):
|
async def set(self, key: str, value: str, expire: int = None):
|
||||||
return await self.mcache.set(key.encode(), value.encode(), exptime=expire)
|
return await self.mcache.set(key.encode(), value.encode(), exptime=expire or 0)
|
||||||
|
|
||||||
async def clear(self, namespace: str = None, key: str = None):
|
async def clear(self, namespace: str = None, key: str = None):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|||||||
@@ -10,20 +10,18 @@ class RedisBackend(Backend):
|
|||||||
self.redis = redis
|
self.redis = redis
|
||||||
|
|
||||||
async def get_with_ttl(self, key: str) -> Tuple[int, str]:
|
async def get_with_ttl(self, key: str) -> Tuple[int, str]:
|
||||||
p = self.redis.pipeline()
|
async with self.redis.pipeline(transaction=True) as pipe:
|
||||||
p.ttl(key)
|
return await (pipe.ttl(key).get(key).execute())
|
||||||
p.get(key)
|
|
||||||
return await p.execute()
|
|
||||||
|
|
||||||
async def get(self, key) -> str:
|
async def get(self, key) -> str:
|
||||||
return await self.redis.get(key)
|
return await self.redis.get(key)
|
||||||
|
|
||||||
async def set(self, key: str, value: str, expire: int = None):
|
async def set(self, key: str, value: str, expire: int = None):
|
||||||
return await self.redis.set(key, value, expire=expire)
|
return await self.redis.set(key, value, ex=expire)
|
||||||
|
|
||||||
async def clear(self, namespace: str = None, key: str = None) -> int:
|
async def clear(self, namespace: str = None, key: str = None) -> int:
|
||||||
if namespace:
|
if namespace:
|
||||||
lua = f"for i, name in ipairs(redis.call('KEYS', '{namespace}:*')) do redis.call('DEL', name); end"
|
lua = f"for i, name in ipairs(redis.call('KEYS', '{namespace}:*')) do redis.call('DEL', name); end"
|
||||||
return await self.redis.eval(lua)
|
return await self.redis.eval(lua, numkeys=0)
|
||||||
elif key:
|
elif key:
|
||||||
return await self.redis.delete(key)
|
return await self.redis.delete(key)
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ import pickle # nosec:B403
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import dateutil.parser
|
import pendulum
|
||||||
|
from fastapi.encoders import jsonable_encoder
|
||||||
|
|
||||||
CONVERTERS = {
|
CONVERTERS = {
|
||||||
"date": dateutil.parser.parse,
|
"date": lambda x: pendulum.parse(x, exact=True),
|
||||||
"datetime": dateutil.parser.parse,
|
"datetime": lambda x: pendulum.parse(x, exact=True),
|
||||||
"decimal": Decimal,
|
"decimal": Decimal,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,13 +17,13 @@ CONVERTERS = {
|
|||||||
class JsonEncoder(json.JSONEncoder):
|
class JsonEncoder(json.JSONEncoder):
|
||||||
def default(self, obj):
|
def default(self, obj):
|
||||||
if isinstance(obj, datetime.datetime):
|
if isinstance(obj, datetime.datetime):
|
||||||
return {"val": obj.strftime("%Y-%m-%d %H:%M:%S"), "_spec_type": "datetime"}
|
return {"val": str(obj), "_spec_type": "datetime"}
|
||||||
elif isinstance(obj, datetime.date):
|
elif isinstance(obj, datetime.date):
|
||||||
return {"val": obj.strftime("%Y-%m-%d"), "_spec_type": "date"}
|
return {"val": str(obj), "_spec_type": "date"}
|
||||||
elif isinstance(obj, Decimal):
|
elif isinstance(obj, Decimal):
|
||||||
return {"val": str(obj), "_spec_type": "decimal"}
|
return {"val": str(obj), "_spec_type": "decimal"}
|
||||||
else:
|
else:
|
||||||
return super().default(obj)
|
return jsonable_encoder(obj)
|
||||||
|
|
||||||
|
|
||||||
def object_hook(obj):
|
def object_hook(obj):
|
||||||
|
|||||||
@@ -26,13 +26,22 @@ def cache(
|
|||||||
nonlocal coder
|
nonlocal coder
|
||||||
nonlocal expire
|
nonlocal expire
|
||||||
nonlocal key_builder
|
nonlocal key_builder
|
||||||
|
copy_kwargs = kwargs.copy()
|
||||||
|
request = copy_kwargs.pop("request", None)
|
||||||
|
response = copy_kwargs.pop("response", None)
|
||||||
|
if (
|
||||||
|
request and request.headers.get("Cache-Control") == "no-store"
|
||||||
|
) or not FastAPICache.get_enable():
|
||||||
|
return await func(*args, **kwargs)
|
||||||
|
|
||||||
coder = coder or FastAPICache.get_coder()
|
coder = coder or FastAPICache.get_coder()
|
||||||
expire = expire or FastAPICache.get_expire()
|
expire = expire or FastAPICache.get_expire()
|
||||||
key_builder = key_builder or FastAPICache.get_key_builder()
|
key_builder = key_builder or FastAPICache.get_key_builder()
|
||||||
request = kwargs.get("request")
|
|
||||||
backend = FastAPICache.get_backend()
|
backend = FastAPICache.get_backend()
|
||||||
cache_key = key_builder(func, namespace, *args, **kwargs)
|
|
||||||
|
cache_key = key_builder(
|
||||||
|
func, namespace, request=request, response=response, args=args, kwargs=copy_kwargs
|
||||||
|
)
|
||||||
ttl, ret = await backend.get_with_ttl(cache_key)
|
ttl, ret = await backend.get_with_ttl(cache_key)
|
||||||
if not request:
|
if not request:
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
@@ -45,7 +54,6 @@ def cache(
|
|||||||
return await func(request, *args, **kwargs)
|
return await func(request, *args, **kwargs)
|
||||||
if_none_match = request.headers.get("if-none-match")
|
if_none_match = request.headers.get("if-none-match")
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
response = kwargs.get("response")
|
|
||||||
if response:
|
if response:
|
||||||
response.headers["Cache-Control"] = f"max-age={ttl}"
|
response.headers["Cache-Control"] = f"max-age={ttl}"
|
||||||
etag = f"W/{hash(ret)}"
|
etag = f"W/{hash(ret)}"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import hashlib
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
@@ -7,13 +8,18 @@ from starlette.responses import Response
|
|||||||
def default_key_builder(
|
def default_key_builder(
|
||||||
func,
|
func,
|
||||||
namespace: Optional[str] = "",
|
namespace: Optional[str] = "",
|
||||||
request: Request = None,
|
request: Optional[Request] = None,
|
||||||
response: Response = None,
|
response: Optional[Response] = None,
|
||||||
*args,
|
args: Optional[tuple] = None,
|
||||||
**kwargs,
|
kwargs: Optional[dict] = None,
|
||||||
):
|
):
|
||||||
from fastapi_cache import FastAPICache
|
from fastapi_cache import FastAPICache
|
||||||
|
|
||||||
prefix = FastAPICache.get_prefix()
|
prefix = f"{FastAPICache.get_prefix()}:{namespace}:"
|
||||||
cache_key = f"{prefix}:{namespace}:{func.__module__}:{func.__name__}:{args}:{kwargs}"
|
cache_key = (
|
||||||
|
prefix
|
||||||
|
+ hashlib.md5( # nosec:B303
|
||||||
|
f"{func.__module__}:{func.__name__}:{args}:{kwargs}".encode()
|
||||||
|
).hexdigest()
|
||||||
|
)
|
||||||
return cache_key
|
return cache_key
|
||||||
|
|||||||
687
poetry.lock
generated
687
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "fastapi-cache2"
|
name = "fastapi-cache2"
|
||||||
version = "0.1.2"
|
version = "0.1.7"
|
||||||
description = "Cache for FastAPI"
|
description = "Cache for FastAPI"
|
||||||
authors = ["long2ice <long2ice@gmail.com>"]
|
authors = ["long2ice <long2ice@gmail.com>"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
@@ -18,14 +18,14 @@ include = ["LICENSE", "README.md"]
|
|||||||
python = "^3.7"
|
python = "^3.7"
|
||||||
fastapi = "*"
|
fastapi = "*"
|
||||||
uvicorn = "*"
|
uvicorn = "*"
|
||||||
aioredis = {version = "*", optional = true}
|
aioredis = {version = "^2.0", optional = true}
|
||||||
aiomcache = {version = "*", optional = true}
|
aiomcache = {version = "*", optional = true}
|
||||||
python-dateutil = "*"
|
pendulum = "*"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
flake8 = "*"
|
flake8 = "*"
|
||||||
isort = "*"
|
isort = "*"
|
||||||
black = "^19.10b0"
|
black = "*"
|
||||||
pytest = "*"
|
pytest = "*"
|
||||||
bandit = "*"
|
bandit = "*"
|
||||||
|
|
||||||
@@ -37,3 +37,7 @@ build-backend = "poetry.masonry.api"
|
|||||||
redis = ["aioredis"]
|
redis = ["aioredis"]
|
||||||
memcache = ["aiomcache"]
|
memcache = ["aiomcache"]
|
||||||
all = ["aioredis","aiomcache"]
|
all = ["aioredis","aiomcache"]
|
||||||
|
|
||||||
|
[tool.black]
|
||||||
|
line-length = 100
|
||||||
|
target-version = ['py36', 'py37', 'py38', 'py39']
|
||||||
|
|||||||
Reference in New Issue
Block a user