Skip to content
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

add an aws chalice integration #923

Merged
merged 43 commits into from Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9a41fee
added chalice to the project requirements
mcsheehan May 8, 2021
6e0f6dd
added a chalice compatible GraphQLView
mcsheehan May 8, 2021
d3085ad
added to the chalice view and added unit tests for chalice
mcsheehan May 9, 2021
1339aba
Updated the poetry lock file
mcsheehan May 9, 2021
bb993cb
Update strawberry/chalice/views.py
mcsheehan May 9, 2021
aafe389
used pathlib to import the graphiql file
mcsheehan May 9, 2021
ac49dd0
Update strawberry/chalice/views.py
mcsheehan May 9, 2021
7b9cfce
Added the return type and simplified get and post methods
mcsheehan May 9, 2021
5c2c935
Merge pull request #1 from strawberry-graphql/main
mcsheehan Jul 8, 2021
19c5f5d
added chalice to the project requirements
mcsheehan May 8, 2021
387a497
added a chalice compatible GraphQLView
mcsheehan May 8, 2021
997be85
added to the chalice view and added unit tests for chalice
mcsheehan May 9, 2021
23bba74
Updated the poetry lock file
mcsheehan May 9, 2021
c0e19d9
Update strawberry/chalice/views.py
mcsheehan May 9, 2021
203c335
used pathlib to import the graphiql file
mcsheehan May 9, 2021
94a5e7a
Update strawberry/chalice/views.py
mcsheehan May 9, 2021
24355f8
Added the return type and simplified get and post methods
mcsheehan May 9, 2021
bf5485d
Merge remote-tracking branch 'origin/feature/chalice' into feature/ch…
Jul 8, 2021
5c360a5
Added a chalice integration, documentation and tests
mcsheehan Jul 14, 2021
ea7fbc7
Merge branch 'main' into feature/chalice
patrick91 Aug 15, 2021
71e64ba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 15, 2021
942b924
Update release notes
patrick91 Aug 15, 2021
dc15c4c
Remove useless file
patrick91 Aug 15, 2021
ecba735
Ignore typing issue
patrick91 Aug 15, 2021
2810918
Rename test folder
patrick91 Aug 15, 2021
ad88643
Disable MyPy cache
patrick91 Aug 15, 2021
ab5de9a
Added a line to the documentation and removed the unneeded lru_cache
mcsheehan Nov 23, 2021
8b5edcc
Added many unit tests to improve test coverage
mcsheehan Nov 23, 2021
3e1d468
Merge branch 'strawberry-graphql:main' into main
Nov 23, 2021
f4361da
Merge branch 'main' into feature/chalice
mcsheehan Nov 23, 2021
07f00df
ran poetry lock --no-update
mcsheehan Nov 23, 2021
5d6027d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 23, 2021
00b979f
Updated the release notes
mcsheehan Nov 23, 2021
8000682
Merge remote-tracking branch 'origin/feature/chalice' into feature/ch…
mcsheehan Nov 23, 2021
a0df66b
Move release to minor
patrick91 Nov 23, 2021
9818374
Merge branch 'main' into feature/chalice
patrick91 Nov 23, 2021
6a508fb
Run MyPy on 3.10
patrick91 Nov 23, 2021
a2bd8c5
Add type ignore to prevent mypy from failing
patrick91 Nov 23, 2021
781daf6
Move mypy to its own workflow and add cache
patrick91 Nov 23, 2021
c007d4d
Fix mypy
patrick91 Nov 23, 2021
5cb5f78
Test removing cache
patrick91 Nov 23, 2021
3bf7b2c
Only check mypy on main codebase
patrick91 Nov 23, 2021
c844376
Rename pipeline
patrick91 Nov 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
173 changes: 166 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Expand Up @@ -29,6 +29,7 @@ django = {version = ">=2,<4", optional = true}
graphql-core = {version = "^3.1.0"}
asgiref = {version = "^3.2", optional = true}
flask = {version = "^1.1", optional = true}
chalice = {version = "^1.22", optional = true}
typing_extensions = "^3.7.4"
opentelemetry-api = {version = "^0.17b0", optional = true}
opentelemetry-sdk = {version = "^0.17b0", optional = true}
Expand Down Expand Up @@ -80,6 +81,7 @@ flask = ["flask", "pytest-flask"]
opentelemetry = ["opentelemetry-api", "opentelemetry-sdk"]
pydantic = ["pydantic"]
sanic = ["sanic"]
chalice = ["chalice"]

[tool.poetry.scripts]
strawberry = "strawberry.cli:run"
Expand Down
Empty file added strawberry/chalice/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions strawberry/chalice/graphiql.py
@@ -0,0 +1,23 @@
import functools
from os.path import abspath, dirname, join


@functools.lru_cache()
mcsheehan marked this conversation as resolved.
Show resolved Hide resolved
def render_graphiql_page() -> str:
"""
Loads the graphiql html file into a string and returns it. Replacing subscription
enabled as false, this is because this chalice integration does not currently support
subscriptions. This function returns a static result, so cache it in ram, saving us
from loading the file from disk each time.
Returns:
A cached string containing a static graphiql page.
"""
dir_path = abspath(join(dirname(__file__), ".."))
graphiql_html_file = f"{dir_path}/static/graphiql.html"

html_string = None

with open(graphiql_html_file, "r") as f:
html_string = f.read()
mcsheehan marked this conversation as resolved.
Show resolved Hide resolved

return html_string.replace("{{ SUBSCRIPTION_ENABLED }}", "false")