-
-
Notifications
You must be signed in to change notification settings - Fork 190
Release v0.2.3 #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vicchi
wants to merge
23
commits into
main
Choose a base branch
from
release-v0.2.3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+619
−579
Open
Release v0.2.3 #510
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
06f4a09
test #459: (hopefully temporarily) disable failing tests for the JSON…
vicchi b2e7bad
test #459: fix failing datetime and date logic tests
vicchi 7513c47
test #459: fix failing non HTTP GET tests which called unimplemented …
vicchi 0ced617
test #459: ensure CI/CD pipeline lint and test workflows pass when ru…
vicchi 73a51fb
test #459: allow GHA pipeline to run on release-* branches
vicchi 6ea931a
test #459: only run GHA pipeline build and publish jobs on main
vicchi f3293ad
fix #293: Bump actions/checkout from 2 to 4
vicchi 8356502
fix #358: Bump github/codeql-action from 2 to 3
vicchi 5651e50
fix #360: Bump actions/upload-artifact from 3 to 4
vicchi ce1ef73
fix #359: Bump actions/download-artifact from 2 to 4
vicchi b39792f
fix #378: Bump actions/cache from 3 to 4
vicchi 060d1da
fix #464: Bump dependabot/fetch-metadata from 1 to 2
vicchi 601a64c
fix #466: Bump tox from 4.20.0 to 4.23.2
vicchi e0eb1ac
fix #486: Bump fastapi from 0.115.0 to 0.115.6
vicchi 1185ac3
fix #490: Bump redis from 5.0.8 to 5.2.1
vicchi a7c47cf
fix #493: Bump uvicorn from 0.30.6 to 0.33.0
vicchi 7dade61
fix #507: Bump pyright from 1.1.381 to 1.1.392.post0
vicchi 6f4876f
fix #509: fix up linting and tests due to aiobotocore 2.18.0 changes
vicchi 20935c7
fix #469: Bump towncrier from 22.12.0 to 24.8.0
vicchi 5ca8663
build: bump version to 0.2.3
vicchi 6353cbb
docs: add more structure to Towncrier change log
vicchi 8058ed6
docs: add news files for all recent changes
vicchi 6af6dd3
docs: change log for 0.2.3
vicchi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import datetime | ||
| from typing import TYPE_CHECKING, Optional, Tuple | ||
| from typing import TYPE_CHECKING, Optional, Tuple, Union | ||
|
|
||
| from aiobotocore.client import AioBaseClient | ||
| from aiobotocore.session import AioSession, get_session | ||
|
|
@@ -30,7 +30,7 @@ class DynamoBackend(Backend): | |
| >> FastAPICache.init(dynamodb) | ||
| """ | ||
|
|
||
| client: DynamoDBClient | ||
| client: Union[DynamoDBClient, None] | ||
| session: AioSession | ||
| table_name: str | ||
| region: Optional[str] | ||
|
|
@@ -46,58 +46,63 @@ async def init(self) -> None: | |
| ).__aenter__() | ||
|
|
||
| async def close(self) -> None: | ||
| self.client = await self.client.__aexit__(None, None, None) | ||
| if self.client: | ||
| await self.client.__aexit__(None, None, None) | ||
| self.client = None | ||
|
|
||
| async def get_with_ttl(self, key: str) -> Tuple[int, Optional[bytes]]: | ||
| response = await self.client.get_item(TableName=self.table_name, Key={"key": {"S": key}}) | ||
| if self.client: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to have to avoid deeply nested ifs and changing the indention of everthing below. |
||
| response = await self.client.get_item(TableName=self.table_name, Key={"key": {"S": key}}) | ||
|
|
||
| if "Item" in response: | ||
| value = response["Item"].get("value", {}).get("B") | ||
| ttl = response["Item"].get("ttl", {}).get("N") | ||
| if "Item" in response: | ||
| value = response["Item"].get("value", {}).get("B") | ||
| ttl = response["Item"].get("ttl", {}).get("N") | ||
|
|
||
| if not ttl: | ||
| return -1, value | ||
| if not ttl: | ||
| return -1, value | ||
|
|
||
| # It's only eventually consistent so we need to check ourselves | ||
| expire = int(ttl) - int(datetime.datetime.now().timestamp()) | ||
| if expire > 0: | ||
| return expire, value | ||
| # It's only eventually consistent so we need to check ourselves | ||
| expire = int(ttl) - int(datetime.datetime.now().timestamp()) | ||
| if expire > 0: | ||
| return expire, value | ||
|
|
||
| return 0, None | ||
|
|
||
| async def get(self, key: str) -> Optional[bytes]: | ||
| response = await self.client.get_item(TableName=self.table_name, Key={"key": {"S": key}}) | ||
| if "Item" in response: | ||
| return response["Item"].get("value", {}).get("B") | ||
| if self.client: | ||
| response = await self.client.get_item(TableName=self.table_name, Key={"key": {"S": key}}) | ||
| if "Item" in response: | ||
| return response["Item"].get("value", {}).get("B") | ||
| return None | ||
|
|
||
| async def set(self, key: str, value: bytes, expire: Optional[int] = None) -> None: | ||
| ttl = ( | ||
| { | ||
| "ttl": { | ||
| "N": str( | ||
| int( | ||
| ( | ||
| datetime.datetime.now() + datetime.timedelta(seconds=expire) | ||
| ).timestamp() | ||
| if self.client: | ||
| ttl = ( | ||
| { | ||
| "ttl": { | ||
| "N": str( | ||
| int( | ||
| ( | ||
| datetime.datetime.now() + datetime.timedelta(seconds=expire) | ||
| ).timestamp() | ||
| ) | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| if expire | ||
| else {} | ||
| ) | ||
|
|
||
| await self.client.put_item( | ||
| TableName=self.table_name, | ||
| Item={ | ||
| **{ | ||
| "key": {"S": key}, | ||
| "value": {"B": value}, | ||
| if expire | ||
| else {} | ||
| ) | ||
|
|
||
| await self.client.put_item( | ||
| TableName=self.table_name, | ||
| Item={ | ||
| **{ | ||
| "key": {"S": key}, | ||
| "value": {"B": value}, | ||
| }, | ||
| **ttl, | ||
| }, | ||
| **ttl, | ||
| }, | ||
| ) | ||
| ) | ||
|
|
||
| async def clear(self, namespace: Optional[str] = None, key: Optional[str] = None) -> int: | ||
| raise NotImplementedError | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a dev dependency, users wouldn't care. Same about CI related updates (
actions/download-artifactetc). It might be better to exclude those from the changelog.