Update DynamoDB TokenStorage example + mypy config - #1421
Merged
Conversation
In order to make the DynamoDB token storage example pass mypy linting and use the current paradigm for TokenStorage, it needs: - missing annotations (easy) - retrofitting of existing functions (easy) - mypy overrides to ignore `boto3` types (easy, but note below) - an implementation of `get_token_data_by_resource_server` (see note!) For mypy, I have decided to move to a dedicated `mypy.ini` config in the `docs/` directory. With the config growing, it didn't make sense to keep it embedded in the repo root pyproject.toml . That also lets us set different top-level behavioral flags in the config. For `get_token_data_by_resource_server`, I decided to implement it, in the simplest possible way using a sequential scan, but no pagination. It also prints a very annoying warning (printing, not emitting a warning, so that warning filters are not applicable), to make sure that anyone who picks it up and runs it verbatim gets some signal that they ought to think about it and possibly make some changes. The associated doc notes that you _could_ make this method raise an error and it would mostly work, but that some SDK features would fail if you do so.
sirosen
requested review from
MaxTueckeGlobus,
ada-globus,
derek-globus,
kurtmckee and
m1yag1
as code owners
August 14, 2026 18:29
derek-globus
requested changes
Aug 14, 2026
derek-globus
left a comment
Contributor
There was a problem hiding this comment.
My only real note is around the term Adapter.
The old interface was called StorageAdapater, the new one is called TokenStorage. In my opinion, child classes shouldn't be referred to as "adapaters" in class name or text references to avoid confusion between the two versions.
Comment on lines
+12
to
+13
| Unlike the builtin adapters for JSON and sqlite, enumerating tokens in storage | ||
| is not a desirable operation. |
Contributor
There was a problem hiding this comment.
Suggested change
| Unlike the builtin adapters for JSON and sqlite, enumerating tokens in storage | |
| is not a desirable operation. | |
| Unlike the builtin ones, enumerating tokens in a DynamoDB table-backed storage | |
| is not desirable. |
Mostly a recommendation to avoid the word "adapter" here & in the rest of the document.
Member
Author
There was a problem hiding this comment.
I made a slight alteration in this when I applied, but spiritually it's the same. LMK if you want it tweaked more. 👍
Avoid "Adapter", which echoes the legacy "StorageAdapter" interfaces. Co-authored-by: derek-globus <113056046+derek-globus@users.noreply.github.com>
derek-globus
approved these changes
Aug 14, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In order to make the DynamoDB token storage example pass mypy linting and
use the current paradigm for TokenStorage, it needs:
boto3types (easy, but note below)get_token_data_by_resource_server(see note!)For mypy, I have decided to move to a dedicated
mypy.iniconfig in thedocs/directory. With the config growing, it didn't make sense to keepit embedded in the repo root pyproject.toml . That also lets us set
different top-level behavioral flags in the config.
For
get_token_data_by_resource_server, I decided to implement it, inthe simplest possible way using a sequential scan, but no pagination.
It also prints a very annoying warning (printing, not emitting a warning,
so that warning filters are not applicable), to make sure that anyone
who picks it up and runs it verbatim gets some signal that they ought to
think about it and possibly make some changes.
The associated doc notes that you could make this method raise an error
and it would mostly work, but that some SDK features would fail if you
do so.