Commit Graph

42 Commits

Author SHA1 Message Date
Martijn Pieters
1d9e126037 Switch to ruff to handle linting and formatting
Ruff handles black, flake8 and isort in one package, and is way faster.
The isort rules had not been enforced, so this commit includes a lot
of import resorting changes.

I switched to flake8-bugbear and the standard black-compatible line
length of 80 + 10% (so max 88 characters), so some line reflowing is
included too.

Finally, because bugbear rightly points out that `setattr()` is less
performant, I've switched the `__signature__` assigment back to using
a direct assignment with type ignore comment.
2023-05-16 12:18:24 +01:00
Martijn Pieters
293a06467a Use poetry-core as the build system
Poetry core is the lighter-weight build system for poetry; this makes
installing the project faster.
2023-05-16 11:03:53 +01:00
Martijn Pieters
0e9a8baeb2 Add tox configuration
Tox manages test environments for all supported Python versions, as
well as linting and formatting tools. On GitHub, the test and lint
steps are kept as close as possible to the Makefile equivalents.
2023-05-16 10:49:17 +01:00
Martijn Pieters
31d0b007cd CI: use a separate step to run linters
This makes it easier to separate linter dependencies from older Python
releases.
2023-05-15 17:30:06 +01:00
Martijn Pieters
0763cd7b95 Add pyright strict type checking 2023-05-11 12:57:28 +01:00
Martijn Pieters
ad1eae2b4b Set python version for mypy
This lets you catch compatibility issues regardless of the current python version used for development.
2023-05-11 12:57:27 +01:00
Martijn Pieters
941cd044c7 Full mypy --strict type checking pass 2023-05-11 12:34:08 +01:00
Martijn Pieters
013be85f97 Typing cleanup
- Compatibility with older Python versions
  - use `Optional` and `Union` instead of `... | None` and `a | b`
  - use `typing_extensions.Protocol` instead of `typing.Protocol`
  - use `typing.Dict`, `typing.List`, etc. instead of the concrete types.

- Fix backend `.get()` annotations; not all were marked as `Optional[str]`
- Don't return anything from `Backend.set()` methods.
- The `Coder.decode_as_type()` type parameter must be a type to be
  compatible with `ModelField(..., type_=...)`.
- Clean up `Optional[]` use, remove where it is not needed.
- Clean up variable use in decorator, keeping the raw cached value
  separate from the return value from the wrapped endpoint.
- Annotate the wrapper as returning either the original type _or_ a
  Response (returning a 304 Not Modified response).
- Clean up small edge-case where `response` could be `None`.
- Correct type annotation on `JsonCoder.decode()` to match `Coder.decode()`.
2023-05-11 12:31:05 +01:00
long2ice
38ddd063c3 test: add httpx for test 2023-02-15 10:49:35 +08:00
long2ice
d04be274e9 feat: upgrade deps 2023-02-15 10:43:01 +08:00
long2ice
59a47b7fae chore: set version 0.2.0 2023-01-11 21:20:41 +08:00
mkdir700
5c776d20db build: update version of aiohttp 2022-11-05 22:21:35 +08:00
long2ice
566d30b790 Merge pull request #88 from vvanglro/feat/cache_html
feat: support cache jinja2 template response
2022-11-03 19:42:47 +08:00
squaresmile
f3f134a318 Added typing to the decorator 2022-10-25 08:58:44 +07:00
Charl P. Botha
d0c0885eae Add coverage 2022-10-14 21:59:51 +02:00
vvanglro
7e64cd6490 feat: support cache jinja2 template response 2022-09-28 17:37:05 +08:00
long2ice
3a481a36ed fix: test 2022-09-11 12:33:10 +08:00
long2ice
cb9259807e feat: make request and response optional 2022-09-10 20:06:37 +08:00
Jinlong Peng
f80bfdb18d upgrade deps 2022-08-07 21:11:47 +08:00
long2ice
8c92cc59ae Fix test 2022-06-26 19:18:34 +08:00
long2ice
824e2e145f Replace aioredis with redis-py 2022-06-17 11:01:47 +08:00
long2ice
81d2bf2cc6 update version and changelog 2021-11-12 09:37:02 +08:00
long2ice
70f53566aa Merge pull request #40 from jimtheyounger/feature/add-dynamodb-backend
Add dynamodb backend support
2021-10-29 10:45:28 +08:00
long2ice
4faa5b7101 update workflows 2021-10-19 11:56:51 +08:00
long2ice
c3be2eca19 Fix default json coder for datetime. 2021-10-09 16:51:05 +08:00
Jimmy
d67797a1d5 Add DynamoDB backend 2021-09-29 16:14:28 +02:00
long2ice
37a2fa85db update CONVERTERS 2021-09-17 10:19:56 +08:00
long2ice
6888c10d6c update deps 2021-08-29 22:33:50 +08:00
long2ice
767241be41 - Fix redis cache.
- Encode key builder.
2021-07-26 16:33:22 +08:00
long2ice
de1bde39fd update version 2021-07-23 09:38:47 +08:00
David Velez
3dc2b53e41 Updated changelog and version for the project. 2021-07-22 10:47:02 -05:00
long2ice
7c7aa26a88 update deps 2021-07-15 10:00:27 +08:00
long2ice
1d0c245a70 - Fix default expire for memcached. (#13)
- Update default key builder. (#12)
2021-03-20 14:42:29 +08:00
Rushil Srivastava
a9b0b9d913 add min dependencies 2021-01-10 03:53:26 -08:00
long2ice
fec3c78291 bug fix 2021-01-06 20:00:58 +08:00
long2ice
361a25857b bug fix 2021-01-06 19:57:16 +08:00
long2ice
6f5d4900a9 bug fix 2021-01-06 14:41:46 +08:00
long2ice
7f7252d151 bug fix 2021-01-06 10:44:22 +08:00
long2ice
a42fdaf632 Fix cache key builder. 2021-01-06 10:34:30 +08:00
long2ice
dc2ac9cc90 Add default config when init
update JsonEncoder
2020-10-16 16:55:33 +08:00
long2ice
c0259bc699 Add in-memory support. 2020-10-08 15:10:34 +08:00
long2ice
c20bb73f27 first commit 2020-08-26 18:04:57 +08:00