Skip to content

Commit

Permalink
Python 3.12 support, dependency update (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp authored Nov 8, 2023
1 parent 5596eca commit 010f551
Show file tree
Hide file tree
Showing 36 changed files with 1,241 additions and 1,238 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
max-parallel: 1
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
fail-fast: false
matrix:
library: ["fastapi", "starlette", "flask"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 0.22 (UNRELEASED)

- Added Python 3.12 to tested versions.
- Updated integration tests to run against FastAPI 0.104, Flask 3.0 and Starlette 0.32.


## 0.21 (2023-06-27)

- Updated the GraphiQL template with working explorer plugin URL.
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "ariadne"
version = "0.20.1"
version = "0.21"
description = "Ariadne is a Python library for implementing GraphQL servers."
authors = [{ name = "Mirumee Software", email = "[email protected]" }]
readme = "README.md"
Expand All @@ -19,6 +19,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
Expand All @@ -36,7 +37,7 @@ test = [
"pytest-cov",
"pytest-mock",
"freezegun",
"snapshottest",
"syrupy",
"werkzeug",
"httpx",
"opentracing",
Expand Down
296 changes: 296 additions & 0 deletions tests/asgi/__snapshots__/test_explorer.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
# serializer version: 1
# name: test_405_bad_method_is_served_on_get_request_for_disabled_explorer
''
# ---
# name: test_apollo_html_is_served_on_get_request
'''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
<title>Ariadne GraphQL</title>
<style>
html, body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}
</style>
</head>
<body>
<div style="width: 100%; height: 100%;" id='embedded-sandbox'></div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js"></script>
<script>
new window.EmbeddedSandbox({
target: '#embedded-sandbox',
initialEndpoint: window.location.href,
initialState: {
document: '# Write your query or mutation here',
variables: {},
headers: {},
},
includeCookies: false,
});
</script>
</body>
</html>

'''
# ---
# name: test_default_explorer_html_is_served_on_get_request
'''
<!--
* Copyright (c) 2021 GraphQL Contributors
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
<title>Ariadne GraphQL</title>
<style>
body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}

#graphiql {
height: 100vh;
}

#graphiql-loading {
height: 100%;
display: flex;
align-items: center;
justify-content: center;

color: #545454;
font-size: 1.5em;
font-family: sans-serif;
font-weight: bold;
}
</style>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/graphiql.min.css" />

</head>

<body>
<div id="graphiql">
<div id="graphiql-loading">Loading Ariadne GraphQL...</div>
</div>

<script
crossorigin
src="https://unpkg.com/react@17/umd/react.production.min.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"
></script>

<script
crossorigin
src="https://unpkg.com/[email protected]/graphiql.min.js"
></script>



<script>
var fetcher = GraphiQL.createFetcher({
url: window.location.href,

subscriptionUrl: (window.location.protocol === "https:" ? "wss" : "ws") + "://" + window.location.host + window.location.pathname,

});

function AriadneGraphiQL() {
var [query, setQuery] = React.useState(
'#\n# GraphiQL is an in -browser tool for writing, validating, and\n# testing GraphQL queries.\n#\n# Type queries into this side of the screen, and you will see intelligent\n# typeaheads aware of the current GraphQL type schema and live syntax and\n# validation errors highlighted within the text.\n#\n# GraphQL queries typically start with a "{" character. Lines that start\n# with a # are ignored.\n#\n# An example GraphQL query might look like:\n#\n# {\n# field(arg: "value") {\n# subField\n#\n# }\n#\n# }\n#\n# Keyboard shortcuts:\n#\n# Prettify query: Shift - Ctrl - P(or press the prettify button)\n#\n# Merge fragments: Shift - Ctrl - M(or press the merge button)\n#\n# Run Query: Ctrl - Enter(or press the play button)\n#\n# Auto Complete: Ctrl - Space(or just start typing)\n#',
);

return React.createElement(GraphiQL, {
fetcher: fetcher,
defaultEditorToolsVisibility: true,

query: query,
onEditQuery: setQuery,
});
}

ReactDOM.render(
React.createElement(AriadneGraphiQL),
document.getElementById('graphiql'),
);
</script>
</body>
</html>

'''
# ---
# name: test_graphiql_html_is_served_on_get_request
'''
<!--
* Copyright (c) 2021 GraphQL Contributors
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
<title>Ariadne GraphQL</title>
<style>
body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
}

#graphiql {
height: 100vh;
}

#graphiql-loading {
height: 100%;
display: flex;
align-items: center;
justify-content: center;

color: #545454;
font-size: 1.5em;
font-family: sans-serif;
font-weight: bold;
}
</style>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/graphiql.min.css" />

</head>

<body>
<div id="graphiql">
<div id="graphiql-loading">Loading Ariadne GraphQL...</div>
</div>

<script
crossorigin
src="https://unpkg.com/react@17/umd/react.production.min.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"
></script>

<script
crossorigin
src="https://unpkg.com/[email protected]/graphiql.min.js"
></script>



<script>
var fetcher = GraphiQL.createFetcher({
url: window.location.href,

subscriptionUrl: (window.location.protocol === "https:" ? "wss" : "ws") + "://" + window.location.host + window.location.pathname,

});

function AriadneGraphiQL() {
var [query, setQuery] = React.useState(
'#\n# GraphiQL is an in -browser tool for writing, validating, and\n# testing GraphQL queries.\n#\n# Type queries into this side of the screen, and you will see intelligent\n# typeaheads aware of the current GraphQL type schema and live syntax and\n# validation errors highlighted within the text.\n#\n# GraphQL queries typically start with a "{" character. Lines that start\n# with a # are ignored.\n#\n# An example GraphQL query might look like:\n#\n# {\n# field(arg: "value") {\n# subField\n#\n# }\n#\n# }\n#\n# Keyboard shortcuts:\n#\n# Prettify query: Shift - Ctrl - P(or press the prettify button)\n#\n# Merge fragments: Shift - Ctrl - M(or press the merge button)\n#\n# Run Query: Ctrl - Enter(or press the play button)\n#\n# Auto Complete: Ctrl - Space(or just start typing)\n#',
);

return React.createElement(GraphiQL, {
fetcher: fetcher,
defaultEditorToolsVisibility: true,

query: query,
onEditQuery: setQuery,
});
}

ReactDOM.render(
React.createElement(AriadneGraphiQL),
document.getElementById('graphiql'),
);
</script>
</body>
</html>

'''
# ---
# name: test_playground_html_is_served_on_get_request
'''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
<title>Ariadne GraphQL</title>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/css/index.css" />
<link rel="shortcut icon" href="//cdn.jsdelivr.net/npm/graphql-playground-react/build/favicon.png" />
<script src="//cdn.jsdelivr.net/npm/graphql-playground-react/build/static/js/middleware.js"></script>
</head>
<body>
<div id="root">
<style>
body {
background-color: rgb(23, 42, 58);
font-family: Open Sans, sans-serif;
height: 90vh;
}

#root {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}

.loading {
font-size: 32px;
font-weight: 200;
color: rgba(255, 255, 255, .6);
margin-left: 20px;
}

img {
width: 78px;
height: 78px;
}

.title {
font-weight: 400;
}
</style>
<img src='//cdn.jsdelivr.net/npm/graphql-playground-react/build/logo.png' alt=''>
<div class="loading"> Loading
<span class="title">Ariadne GraphQL</span>
</div>
</div>
<script>
window.addEventListener('load', function (event) {
GraphQLPlayground.init(document.getElementById('root'), {
// options as 'endpoint' belong here

})
})
</script>
</body>
</html>

'''
# ---
Loading

0 comments on commit 010f551

Please sign in to comment.