graphql-http 2.0.6__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. graphql_http-2.1.0/.github/workflows/pages.yml +85 -0
  2. graphql_http-2.1.0/.gitmodules +3 -0
  3. {graphql_http-2.0.6 → graphql_http-2.1.0}/PKG-INFO +30 -3
  4. {graphql_http-2.0.6 → graphql_http-2.1.0}/README.md +29 -2
  5. graphql_http-2.1.0/VERSION +1 -0
  6. graphql_http-2.1.0/docs/.gitmodules +3 -0
  7. graphql_http-2.1.0/docs/content/_index.md +103 -0
  8. graphql_http-2.1.0/docs/content/docs/_index.md +30 -0
  9. graphql_http-2.1.0/docs/content/docs/api-reference.md +447 -0
  10. graphql_http-2.1.0/docs/content/docs/authentication.md +388 -0
  11. graphql_http-2.1.0/docs/content/docs/configuration.md +291 -0
  12. graphql_http-2.1.0/docs/content/docs/examples.md +612 -0
  13. graphql_http-2.1.0/docs/content/docs/getting-started.md +189 -0
  14. graphql_http-2.1.0/docs/content/docs/testing.md +464 -0
  15. graphql_http-2.1.0/docs/hugo.toml +74 -0
  16. graphql_http-2.1.0/docs/index.md +3 -0
  17. {graphql_http-2.0.6 → graphql_http-2.1.0}/examples/README.md +1 -1
  18. graphql_http-2.1.0/examples/__init__.py +1 -0
  19. {graphql_http-2.0.6 → graphql_http-2.1.0}/examples/advanced_server.py +32 -23
  20. {graphql_http-2.0.6 → graphql_http-2.1.0}/examples/auth_server.py +8 -5
  21. {graphql_http-2.0.6 → graphql_http-2.1.0}/examples/basic_server.py +8 -4
  22. graphql_http-2.1.0/examples/graphql_api_server.py +329 -0
  23. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http/error.py +5 -2
  24. graphql_http-2.1.0/graphql_http/introspection.py +219 -0
  25. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http/server.py +93 -277
  26. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http.egg-info/PKG-INFO +30 -3
  27. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http.egg-info/SOURCES.txt +18 -0
  28. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/app.py +2 -2
  29. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/app_federation.py +1 -1
  30. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/test_auth.py +0 -12
  31. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/test_cors.py +3 -3
  32. graphql_http-2.1.0/tests/test_examples.py +570 -0
  33. graphql_http-2.1.0/tests/test_introspection.py +335 -0
  34. graphql_http-2.1.0/tests/test_linting.py +120 -0
  35. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/test_server.py +175 -5
  36. graphql_http-2.0.6/VERSION +0 -1
  37. graphql_http-2.0.6/examples/graphql_api_server.py +0 -366
  38. {graphql_http-2.0.6 → graphql_http-2.1.0}/.coverage +0 -0
  39. {graphql_http-2.0.6 → graphql_http-2.1.0}/.github/workflows/python-package.yml +0 -0
  40. {graphql_http-2.0.6 → graphql_http-2.1.0}/.gitignore +0 -0
  41. {graphql_http-2.0.6 → graphql_http-2.1.0}/LICENSE +0 -0
  42. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http/__init__.py +0 -0
  43. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http/graphiql/index.html +0 -0
  44. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http/helpers.py +0 -0
  45. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http.egg-info/dependency_links.txt +0 -0
  46. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http.egg-info/requires.txt +0 -0
  47. {graphql_http-2.0.6 → graphql_http-2.1.0}/graphql_http.egg-info/top_level.txt +0 -0
  48. {graphql_http-2.0.6 → graphql_http-2.1.0}/pyproject.toml +0 -0
  49. {graphql_http-2.0.6 → graphql_http-2.1.0}/setup.cfg +0 -0
  50. {graphql_http-2.0.6 → graphql_http-2.1.0}/test_server.py +0 -0
  51. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/__init__.py +0 -0
  52. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/conftest.py +0 -0
  53. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/test_federation.py +0 -0
  54. {graphql_http-2.0.6 → graphql_http-2.1.0}/tests/test_graphql_api.py +0 -0
  55. {graphql_http-2.0.6 → graphql_http-2.1.0}/uv.lock +0 -0
@@ -0,0 +1,85 @@
1
+ name: Deploy Hugo site to Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'docs/**'
9
+ - '.github/workflows/pages.yml'
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+ pages: write
15
+ id-token: write
16
+
17
+ concurrency:
18
+ group: "pages"
19
+ cancel-in-progress: false
20
+
21
+ defaults:
22
+ run:
23
+ shell: bash
24
+
25
+ jobs:
26
+ build:
27
+ runs-on: ubuntu-latest
28
+ env:
29
+ HUGO_VERSION: 0.146.0
30
+ steps:
31
+ - name: Install Hugo CLI
32
+ run: |
33
+ wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
34
+ && sudo dpkg -i ${{ runner.temp }}/hugo.deb
35
+
36
+ - name: Install Dart Sass
37
+ run: sudo snap install dart-sass
38
+
39
+ - name: Checkout
40
+ uses: actions/checkout@v4
41
+ with:
42
+ submodules: recursive
43
+ fetch-depth: 0
44
+
45
+ - name: Setup Pages
46
+ id: pages
47
+ uses: actions/configure-pages@v5
48
+
49
+ - name: Install Node.js dependencies
50
+ run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
51
+ working-directory: ./docs
52
+
53
+ - name: Install Hugo Book theme
54
+ run: |
55
+ git submodule add https://github.com/alex-shpak/hugo-book themes/hugo-book || true
56
+ git submodule update --init --recursive
57
+ working-directory: ./docs
58
+
59
+ - name: Build with Hugo
60
+ env:
61
+ HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
62
+ HUGO_ENVIRONMENT: production
63
+ TZ: America/Los_Angeles
64
+ run: |
65
+ hugo \
66
+ --gc \
67
+ --minify \
68
+ --baseURL "${{ steps.pages.outputs.base_url }}/"
69
+ working-directory: ./docs
70
+
71
+ - name: Upload artifact
72
+ uses: actions/upload-pages-artifact@v3
73
+ with:
74
+ path: ./docs/public
75
+
76
+ deploy:
77
+ environment:
78
+ name: github-pages
79
+ url: ${{ steps.deployment.outputs.page_url }}
80
+ runs-on: ubuntu-latest
81
+ needs: build
82
+ steps:
83
+ - name: Deploy to GitHub Pages
84
+ id: deployment
85
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,3 @@
1
+ [submodule "docs/themes/hugo-book"]
2
+ path = docs/themes/hugo-book
3
+ url = https://github.com/alex-shpak/hugo-book
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphql_http
3
- Version: 2.0.6
3
+ Version: 2.1.0
4
4
  Summary: HTTP Server for GraphQL.
5
5
  Author-email: Robert Parker <rob@parob.com>
6
6
  License: MIT
@@ -110,7 +110,7 @@ server.run()
110
110
  app = GraphQLHTTP(
111
111
  schema=schema,
112
112
  serve_graphiql=True, # Enable GraphiQL interface
113
- graphiql_default_query="{ hello }", # Default query in GraphiQL
113
+ graphiql_example_query="{ hello }", # Example query in GraphiQL
114
114
  allow_cors=True, # Enable CORS
115
115
  health_path="/health" # Health check endpoint
116
116
  )
@@ -147,6 +147,32 @@ app = GraphQLHTTP(
147
147
  )
148
148
  ```
149
149
 
150
+ ## GraphiQL Example Queries
151
+
152
+ You can provide an example query for GraphiQL to show users how your API works. There are 3 ways to do this:
153
+
154
+ **1. Pass a string directly:**
155
+ ```python
156
+ app = GraphQLHTTP(
157
+ schema=schema,
158
+ graphiql_example_query="{ users { id name } }"
159
+ )
160
+ ```
161
+
162
+ **2. Load from a file:**
163
+ ```python
164
+ app = GraphQLHTTP(
165
+ schema=schema,
166
+ graphiql_example_query_path="./queries/example.graphql"
167
+ )
168
+ ```
169
+
170
+ **3. Auto-discovery (no config needed):**
171
+
172
+ Just create a `graphiql_example.graphql` or `example.graphql` file in your working directory and the server will automatically find and use it.
173
+
174
+ If you provide multiple sources, the string parameter takes priority, then the file path, then auto-discovery.
175
+
150
176
  ## API Reference
151
177
 
152
178
  ### GraphQLHTTP Class
@@ -158,7 +184,8 @@ app = GraphQLHTTP(
158
184
  - `middleware` (List[Callable], optional): List of middleware functions
159
185
  - `context_value` (Any, optional): Context passed to resolvers
160
186
  - `serve_graphiql` (bool, default: True): Whether to serve GraphiQL interface
161
- - `graphiql_default_query` (str, optional): Default query for GraphiQL
187
+ - `graphiql_example_query` (str, optional): Example query for GraphiQL interface
188
+ - `graphiql_example_query_path` (str, optional): Path to file containing example query for GraphiQL
162
189
  - `allow_cors` (bool, default: False): Enable CORS middleware
163
190
  - `health_path` (str, optional): Path for health check endpoint
164
191
  - `execution_context_class` (Type[ExecutionContext], optional): Custom execution context
@@ -82,7 +82,7 @@ server.run()
82
82
  app = GraphQLHTTP(
83
83
  schema=schema,
84
84
  serve_graphiql=True, # Enable GraphiQL interface
85
- graphiql_default_query="{ hello }", # Default query in GraphiQL
85
+ graphiql_example_query="{ hello }", # Example query in GraphiQL
86
86
  allow_cors=True, # Enable CORS
87
87
  health_path="/health" # Health check endpoint
88
88
  )
@@ -119,6 +119,32 @@ app = GraphQLHTTP(
119
119
  )
120
120
  ```
121
121
 
122
+ ## GraphiQL Example Queries
123
+
124
+ You can provide an example query for GraphiQL to show users how your API works. There are 3 ways to do this:
125
+
126
+ **1. Pass a string directly:**
127
+ ```python
128
+ app = GraphQLHTTP(
129
+ schema=schema,
130
+ graphiql_example_query="{ users { id name } }"
131
+ )
132
+ ```
133
+
134
+ **2. Load from a file:**
135
+ ```python
136
+ app = GraphQLHTTP(
137
+ schema=schema,
138
+ graphiql_example_query_path="./queries/example.graphql"
139
+ )
140
+ ```
141
+
142
+ **3. Auto-discovery (no config needed):**
143
+
144
+ Just create a `graphiql_example.graphql` or `example.graphql` file in your working directory and the server will automatically find and use it.
145
+
146
+ If you provide multiple sources, the string parameter takes priority, then the file path, then auto-discovery.
147
+
122
148
  ## API Reference
123
149
 
124
150
  ### GraphQLHTTP Class
@@ -130,7 +156,8 @@ app = GraphQLHTTP(
130
156
  - `middleware` (List[Callable], optional): List of middleware functions
131
157
  - `context_value` (Any, optional): Context passed to resolvers
132
158
  - `serve_graphiql` (bool, default: True): Whether to serve GraphiQL interface
133
- - `graphiql_default_query` (str, optional): Default query for GraphiQL
159
+ - `graphiql_example_query` (str, optional): Example query for GraphiQL interface
160
+ - `graphiql_example_query_path` (str, optional): Path to file containing example query for GraphiQL
134
161
  - `allow_cors` (bool, default: False): Enable CORS middleware
135
162
  - `health_path` (str, optional): Path for health check endpoint
136
163
  - `execution_context_class` (Type[ExecutionContext], optional): Custom execution context
@@ -0,0 +1 @@
1
+ 2.1.0
@@ -0,0 +1,3 @@
1
+ [submodule "themes/hugo-book"]
2
+ path = themes/hugo-book
3
+ url = https://github.com/alex-shpak/hugo-book
@@ -0,0 +1,103 @@
1
+ ---
2
+ title: GraphQL HTTP Server
3
+ type: docs
4
+ ---
5
+
6
+ # GraphQL HTTP Server
7
+
8
+ {{< columns >}}
9
+
10
+ ## High Performance
11
+
12
+ Built on Starlette/ASGI for excellent async performance, handling thousands of concurrent requests efficiently.
13
+
14
+ <--->
15
+
16
+ ## Authentication Ready
17
+
18
+ Built-in JWT authentication with JWKS support for secure GraphQL APIs in production environments.
19
+
20
+ <--->
21
+
22
+ ## Developer Friendly
23
+
24
+ Integrated GraphiQL interface, comprehensive error handling, and easy testing capabilities.
25
+
26
+ {{< /columns >}}
27
+
28
+ ---
29
+
30
+ ## Features
31
+
32
+ - 🚀 **High Performance**: Built on Starlette/ASGI for excellent async performance
33
+ - 🔐 **JWT Authentication**: Built-in JWT authentication with JWKS support
34
+ - 🌐 **CORS Support**: Configurable CORS middleware for cross-origin requests
35
+ - 🎨 **GraphiQL Integration**: Interactive GraphQL IDE for development
36
+ - 📊 **Health Checks**: Built-in health check endpoints
37
+ - 🔄 **Batch Queries**: Support for batched GraphQL operations
38
+ - 🛡️ **Error Handling**: Comprehensive error handling and formatting
39
+ - 📝 **Type Safety**: Full TypeScript-style type hints for Python
40
+
41
+ ## Quick Start
42
+
43
+ ### Installation
44
+
45
+ ```bash
46
+ pip install graphql-http
47
+ ```
48
+
49
+ ### Basic Usage
50
+
51
+ ```python
52
+ from graphql import GraphQLSchema, GraphQLObjectType, GraphQLField, GraphQLString
53
+ from graphql_http import GraphQLHTTP
54
+
55
+ # Define your GraphQL schema
56
+ schema = GraphQLSchema(
57
+ query=GraphQLObjectType(
58
+ name="Query",
59
+ fields={
60
+ "hello": GraphQLField(
61
+ GraphQLString,
62
+ resolve=lambda obj, info: "Hello, World!"
63
+ )
64
+ }
65
+ )
66
+ )
67
+
68
+ # Create the HTTP server
69
+ app = GraphQLHTTP(schema=schema)
70
+
71
+ # Run the server
72
+ if __name__ == "__main__":
73
+ app.run(host="0.0.0.0", port=8000)
74
+ ```
75
+
76
+ Visit [http://localhost:8000/graphql](http://localhost:8000/graphql) to access the GraphiQL interface.
77
+
78
+ ## Integration with GraphQL-API
79
+
80
+ For advanced schema definition with automatic type inference:
81
+
82
+ ```python
83
+ from graphql_api import GraphQLAPI
84
+ from graphql_http import GraphQLHTTP
85
+
86
+ api = GraphQLAPI()
87
+
88
+ @api.type(is_root_type=True)
89
+ class Query:
90
+ @api.field
91
+ def hello(self, name: str = "World") -> str:
92
+ return f"Hello, {name}!"
93
+
94
+ # Create server from API
95
+ server = GraphQLHTTP.from_api(api)
96
+ server.run()
97
+ ```
98
+
99
+ ## Next Steps
100
+
101
+ {{< button relref="/docs/getting-started" >}}Get Started{{< /button >}}
102
+ {{< button relref="/docs/examples" >}}Examples{{< /button >}}
103
+ {{< button relref="/docs/api-reference" >}}API Reference{{< /button >}}
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: Documentation
3
+ type: docs
4
+ bookCollapseSection: true
5
+ weight: 1
6
+ ---
7
+
8
+ # GraphQL HTTP Server Documentation
9
+
10
+ Welcome to the GraphQL HTTP Server documentation. This server provides a production-ready solution for serving GraphQL APIs over HTTP with extensive features for authentication, CORS, and development tools.
11
+
12
+ ## Core Concepts
13
+
14
+ - **HTTP Server**: ASGI-based server built on Starlette for high performance
15
+ - **GraphQL Integration**: Seamless integration with any GraphQL schema
16
+ - **Authentication**: Built-in JWT authentication with JWKS support
17
+ - **Development Tools**: Integrated GraphiQL interface and testing utilities
18
+
19
+ ## Getting Started
20
+
21
+ New to GraphQL HTTP Server? Start with our [Getting Started](./getting-started) guide.
22
+
23
+ ## Documentation Structure
24
+
25
+ - **[Getting Started](./getting-started)**: Installation and basic setup
26
+ - **[Configuration](./configuration)**: Server configuration options
27
+ - **[Authentication](./authentication)**: JWT authentication setup
28
+ - **[Examples](./examples)**: Practical usage examples
29
+ - **[API Reference](./api-reference)**: Complete API documentation
30
+ - **[Testing](./testing)**: Testing your GraphQL server