Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
- "mypy-py3.14"
- "mypy-py3.9"
- "mypy-test"
- "mypy-docs"
- "poetry-check"
- "pylint"
- "test-lazy-imports"
Expand Down
6 changes: 6 additions & 0 deletions changelog.d/20260814_174036_sirosen_final_mypy_docs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Documentation
-------------

- All example files in the globus-sdk documentation are now required to pass
type checking. Documentation examples will feature type annotations where they
are instructive and clarifying. (:pr:`NUMBER`)
14 changes: 14 additions & 0 deletions docs/mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[mypy]
# baseline at --strict, but then allow exemptions
strict = true
sqlite_cache = true
warn_unreachable = true
warn_no_return = true
allow_untyped_calls = true
allow_untyped_defs = true
explicit_package_bases = true

[mypy-docs.examples.token_storage.dynamodb_token_storage]
# example needs to be allowed to import boto3
ignore_missing_imports = true
disable_error_code = import-not-found
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys

import globus_sdk
from globus_sdk.token_storage import JSONTokenStorage
Expand Down Expand Up @@ -32,6 +33,10 @@

# load the tokens from the storage -- either freshly stored or loaded from disk
token_data = token_storage.get_token_data(globus_sdk.GroupsClient.resource_server)
if token_data is None or token_data.refresh_token is None:
print("error: token data was not present or was malformed")
print(f" try removing the token file at {token_storage.filepath!r}")
sys.exit(1)

# construct the RefreshTokenAuthorizer which writes back to storage on refresh
authorizer = globus_sdk.RefreshTokenAuthorizer(
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
envlist =
lint
mypy
mypy-docs
pylint
test-lazy-imports
coverage_clean
Expand Down
Loading