graphql-api 1.4.17__tar.gz → 1.4.19__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 (80) hide show
  1. graphql_api-1.4.19/.github/workflows/python-package.yml +78 -0
  2. graphql_api-1.4.19/.gitignore +23 -0
  3. graphql_api-1.4.19/.vscode/settings.json +7 -0
  4. {graphql_api-1.4.17/graphql_api.egg-info → graphql_api-1.4.19}/PKG-INFO +11 -28
  5. graphql_api-1.4.19/VERSION +1 -0
  6. graphql_api-1.4.19/docs/_static/favicon.ico +0 -0
  7. graphql_api-1.4.19/docs/_static/logo.png +0 -0
  8. graphql_api-1.4.19/docs/_templates/sidebarlogo.html +7 -0
  9. graphql_api-1.4.19/docs/conf.py +39 -0
  10. graphql_api-1.4.19/docs/images/python_to_graphql.png +0 -0
  11. graphql_api-1.4.19/docs/images/schema_structure.png +0 -0
  12. graphql_api-1.4.19/docs/index.rst +107 -0
  13. graphql_api-1.4.19/docs/installation.rst +25 -0
  14. graphql_api-1.4.19/docs/quickstart.rst +431 -0
  15. graphql_api-1.4.19/docs/schemas.rst +405 -0
  16. graphql_api-1.4.19/docs/types.rst +140 -0
  17. graphql_api-1.4.19/docs_md/advanced.md +190 -0
  18. graphql_api-1.4.19/docs_md/async-and-subscriptions.md +93 -0
  19. graphql_api-1.4.19/docs_md/defining-schemas.md +257 -0
  20. graphql_api-1.4.19/docs_md/federation.md +139 -0
  21. graphql_api-1.4.19/docs_md/getting-started.md +135 -0
  22. graphql_api-1.4.19/docs_md/index.md +14 -0
  23. graphql_api-1.4.19/docs_md/pydantic-and-dataclasses.md +176 -0
  24. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/api.py +71 -23
  25. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/dataclass_mapping.py +8 -4
  26. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/directives.py +18 -4
  27. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/executor.py +31 -3
  28. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/federation/directives.py +4 -2
  29. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/federation/federation.py +4 -2
  30. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/mapper.py +69 -29
  31. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/pydantic.py +4 -2
  32. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/reduce.py +28 -14
  33. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/remote.py +18 -9
  34. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/schema.py +37 -4
  35. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/types.py +4 -2
  36. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/utils.py +4 -2
  37. {graphql_api-1.4.17 → graphql_api-1.4.19/graphql_api.egg-info}/PKG-INFO +11 -28
  38. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api.egg-info/SOURCES.txt +24 -3
  39. graphql_api-1.4.19/graphql_api.egg-info/requires.txt +6 -0
  40. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api.egg-info/top_level.txt +0 -1
  41. graphql_api-1.4.19/pyproject.toml +80 -0
  42. graphql_api-1.4.19/setup.cfg +4 -0
  43. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_custom_types.py +4 -2
  44. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_dataclass.py +59 -26
  45. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_directives.py +50 -27
  46. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_docstrings.py +23 -11
  47. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_federation.py +6 -3
  48. graphql_api-1.4.19/tests/test_federation_example.graphql +83 -0
  49. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_filtering.py +70 -33
  50. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_graphql.py +74 -19
  51. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_pydantic.py +22 -11
  52. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_remote.py +76 -33
  53. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_schema.py +4 -2
  54. graphql_api-1.4.19/tests/test_subscriptions.py +403 -0
  55. graphql_api-1.4.19/uv.lock +948 -0
  56. graphql_api-1.4.17/MANIFEST.in +0 -3
  57. graphql_api-1.4.17/VERSION +0 -1
  58. graphql_api-1.4.17/graphql_api.egg-info/requires.txt +0 -12
  59. graphql_api-1.4.17/setup.cfg +0 -15
  60. graphql_api-1.4.17/setup.py +0 -46
  61. graphql_api-1.4.17/tests/test_subscriptions.py +0 -134
  62. {graphql_api-1.4.17 → graphql_api-1.4.19}/LICENSE +0 -0
  63. {graphql_api-1.4.17 → graphql_api-1.4.19}/README.md +0 -0
  64. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/__init__.py +0 -0
  65. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/context.py +0 -0
  66. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/decorators.py +0 -0
  67. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/error.py +0 -0
  68. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/exception.py +0 -0
  69. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/federation/__init__.py +0 -0
  70. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/federation/types.py +0 -0
  71. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/middleware.py +0 -0
  72. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api/relay.py +0 -0
  73. {graphql_api-1.4.17 → graphql_api-1.4.19}/graphql_api.egg-info/dependency_links.txt +0 -0
  74. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/__init__.py +0 -0
  75. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_async.py +0 -0
  76. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_calculator.py +0 -0
  77. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_error.py +0 -0
  78. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_federation_example.py +0 -0
  79. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_middleware.py +0 -0
  80. {graphql_api-1.4.17 → graphql_api-1.4.19}/tests/test_relay.py +0 -0
@@ -0,0 +1,78 @@
1
+ name: Python Package CI/CD
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main # Or your default branch
7
+ tags:
8
+ - '*.*.*' # For publishing to PyPI
9
+ pull_request:
10
+ branches:
11
+ - main # Or your default branch
12
+
13
+ jobs:
14
+ build_and_test:
15
+ name: Build and Test (Python ${{ matrix.python-version }})
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python-version: ["3.11", "3.12"] # graphql-api requires Python 3.11+
21
+
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Set up Python ${{ matrix.python-version }}
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: ${{ matrix.python-version }}
30
+
31
+ - name: Install UV
32
+ uses: astral-sh/setup-uv@v3
33
+
34
+ - name: Install dependencies
35
+ run: uv sync --dev
36
+
37
+ - name: Lint with Flake8
38
+ run: uv run flake8 graphql_api tests
39
+
40
+ - name: Test with Pytest
41
+ run: uv run pytest
42
+
43
+ publish:
44
+ name: Publish to PyPI
45
+ needs: build_and_test # Ensure tests pass before publishing
46
+ runs-on: ubuntu-latest
47
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
48
+ permissions:
49
+ id-token: write
50
+
51
+ steps:
52
+ - name: Validate tag format (e.g., 1.0.0)
53
+ run: |
54
+ TAG_NAME="${{ github.ref_name }}"
55
+ if ! [[ "$TAG_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
56
+ echo "Error: Tag '$TAG_NAME' is not in the required X.Y.Z numeric format (e.g., 1.0.0)."
57
+ exit 1
58
+ fi
59
+ echo "Tag '$TAG_NAME' is valid."
60
+ shell: bash
61
+
62
+ - name: Checkout repository
63
+ uses: actions/checkout@v4
64
+
65
+ - name: Set up Python
66
+ uses: actions/setup-python@v5
67
+ with:
68
+ python-version: '3.12' # Use compatible Python version
69
+
70
+ - name: Install UV
71
+ uses: astral-sh/setup-uv@v3
72
+
73
+ - name: Update VERSION file
74
+ run: echo "${{ github.ref_name }}" > VERSION
75
+ shell: bash
76
+
77
+ - name: Build and publish package to PyPI
78
+ run: uv build && uv publish
@@ -0,0 +1,23 @@
1
+ .idea
2
+ .DS_Store
3
+ .coverage
4
+ .pytest_cache
5
+
6
+ # Virtual environments
7
+ .venv/
8
+ env/
9
+ venv/
10
+
11
+ # Build artifacts
12
+ build/
13
+ dist/
14
+ *.egg-info/
15
+
16
+ # Testing
17
+ tests/logs/
18
+ tests/htmlcov/
19
+ htmlcov/
20
+
21
+ # Python
22
+ *.pyc
23
+ __pycache__/
@@ -0,0 +1,7 @@
1
+ {
2
+ "python.testing.pytestArgs": [
3
+ "tests"
4
+ ],
5
+ "python.testing.unittestEnabled": false,
6
+ "python.testing.pytestEnabled": true
7
+ }
@@ -1,44 +1,27 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphql_api
3
- Version: 1.4.17
3
+ Version: 1.4.19
4
4
  Summary: A framework for building Python GraphQL APIs.
5
- Home-page: https://gitlab.com/parob/graphql-api
6
- Download-URL: https://gitlab.com/parob/graphql/-/archive/v1.4.17/graphql_api-v1.4.17.tar.gz
7
- Author: Robert Parker
8
- Author-email: rob@parob.com
5
+ Author-email: Robert Parker <rob@parob.com>
9
6
  License: MIT
7
+ Project-URL: Homepage, https://gitlab.com/parob/graphql-api
8
+ Project-URL: Repository, https://gitlab.com/parob/graphql-api
10
9
  Keywords: GraphQL,GraphQL-API,GraphQLAPI,Server
11
10
  Classifier: Development Status :: 3 - Alpha
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: Programming Language :: Python :: 3
14
13
  Classifier: License :: OSI Approved :: MIT License
15
14
  Classifier: Operating System :: OS Independent
15
+ Requires-Python: <3.13,>=3.11
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: graphql-core~=3.1
19
- Requires-Dist: requests~=2.24
20
- Requires-Dist: typing-inspect~=0.6
21
- Requires-Dist: aiohttp~=3.8
22
- Requires-Dist: docstring-parser~=0.15
23
- Requires-Dist: pydantic~=2.0
24
- Provides-Extra: dev
25
- Requires-Dist: pytest~=5.4; extra == "dev"
26
- Requires-Dist: pytest-cov~=2.10; extra == "dev"
27
- Requires-Dist: coverage~=5.2; extra == "dev"
28
- Requires-Dist: faker~=4.1; extra == "dev"
29
- Dynamic: author
30
- Dynamic: author-email
31
- Dynamic: classifier
32
- Dynamic: description
33
- Dynamic: description-content-type
34
- Dynamic: download-url
35
- Dynamic: home-page
36
- Dynamic: keywords
37
- Dynamic: license
18
+ Requires-Dist: graphql-core
19
+ Requires-Dist: requests
20
+ Requires-Dist: typing-inspect
21
+ Requires-Dist: aiohttp
22
+ Requires-Dist: docstring-parser
23
+ Requires-Dist: pydantic
38
24
  Dynamic: license-file
39
- Dynamic: provides-extra
40
- Dynamic: requires-dist
41
- Dynamic: summary
42
25
 
43
26
  # GraphQL API for Python
44
27
 
@@ -0,0 +1 @@
1
+ 1.4.19
Binary file
@@ -0,0 +1,7 @@
1
+ <center>
2
+ <p class="logo">
3
+ <a href="{{ pathto(master_doc) }}">
4
+ <img class="logo" src="{{ pathto('_static/logo.png', 1) }}" alt="Logo" style="margin-left: -10px; margin-bottom: 20px"/>
5
+ </a>
6
+ </p>
7
+ </center>
@@ -0,0 +1,39 @@
1
+ import guzzle_sphinx_theme
2
+
3
+ # -*- coding: utf-8 -*-
4
+ #
5
+ # Configuration file for the Sphinx documentation builder.
6
+ #
7
+ # This file does only contain a selection of the most common options. For a
8
+ # full list see the documentation:
9
+ # http://www.sphinx-doc.org/en/stable/config
10
+
11
+ project = "GraphQL-API"
12
+ copyright = "2018, Robert Parker"
13
+ author = "Robert Parker"
14
+
15
+ version = "0.1"
16
+ release = "0.1.0"
17
+
18
+ extensions = ["sphinx.ext.autodoc", "sphinxcontrib.fulltoc", "guzzle_sphinx_theme"]
19
+
20
+ templates_path = ["_templates"]
21
+ source_suffix = ".rst"
22
+ master_doc = "index"
23
+ language = None
24
+ exclude_patterns = ["_build"]
25
+ pygments_style = "sphinx"
26
+
27
+
28
+ # -- Options for HTML output -------------------------------------------------
29
+
30
+ html_theme = "guzzle_sphinx_theme"
31
+ html_theme_path = guzzle_sphinx_theme.html_theme_path()
32
+ html_theme_options = {
33
+ "project_nav_name": project,
34
+ }
35
+ html_static_path = ["_static"]
36
+ html_favicon = "_static/favicon.ico"
37
+ html_sidebars = {
38
+ "**": ["logo-text.html", "sidebarlogo.html", "globaltoc.html", "searchbox.html"]
39
+ }
@@ -0,0 +1,107 @@
1
+ .. _index:
2
+
3
+ .. highlight:: python
4
+
5
+ .. toctree::
6
+ :hidden:
7
+
8
+ Overview <self>
9
+ quickstart
10
+ installation
11
+ schemas
12
+ types
13
+ execution
14
+ remote
15
+ models
16
+ http
17
+ examples
18
+ api
19
+
20
+ GraphQL-API: A GraphQL server for Python
21
+ =====================================
22
+
23
+ **GraphQL-API** is a library for creating a GraphQL server with Python.
24
+
25
+ .. image:: https://gitlab.com/parob/graphql-api/badges/master/coverage.svg
26
+ :target: https://gitlab.com/parob/graphql-api/commits/master
27
+
28
+ .. image:: https://gitlab.com/parob/graphql-api/badges/master/pipeline.svg
29
+ :target: https://gitlab.com/parob/graphql-api/commits/master
30
+
31
+
32
+ GraphQL-API requires **Python 3.5** or newer.
33
+
34
+ -------------------
35
+
36
+ GraphQL-API uses Python **classes**, **methods** and **typehints** to create the **schemas** and **resolvers** for a GraphQL engine.
37
+
38
+ With GraphQL-API, the following Python class::
39
+
40
+ api = GraphQLAPI()
41
+
42
+ @api.type(is_root_type=True)
43
+ class Calculator:
44
+
45
+ @api.field
46
+ def add(self, number_one: float, number_two: float) -> float:
47
+ return number_1 + number_2
48
+
49
+ can be automatically mapped into a GraphQL schema that would look something like::
50
+
51
+ type Calculator {
52
+ add(numberOne: Float!, numberTwo: Float!): Float!
53
+ }
54
+
55
+ and like any normal GraphQL server it can be queried::
56
+
57
+ executor = schema.executor()
58
+
59
+ executor.execute("
60
+ query {
61
+ add(numberOne: 4.3, numberTwo: 7.1)
62
+ }
63
+ ")
64
+
65
+ >>> {
66
+ "add": 11.4
67
+ }
68
+
69
+
70
+ Getting Started
71
+ ---------------
72
+
73
+ Install GraphQL-API::
74
+
75
+ pip install graphql-api
76
+
77
+ Simple Example:
78
+
79
+ .. code-block:: python
80
+
81
+ from graphql_api import GraphQLAPI
82
+
83
+ api = GraphQLAPI()
84
+
85
+ @api.type(is_root_type=True)
86
+ class Math:
87
+
88
+ @api.field
89
+ def square_number(self, number: int) -> int:
90
+ return number * number
91
+
92
+
93
+ gql_query = '''
94
+ query SquareNumberFive {
95
+ fiveSquaredIs: squareNumber(number: 5)
96
+ }
97
+ '''
98
+
99
+ result = schema.executor().execute(gql_query)
100
+
101
+ print(result.data)
102
+
103
+
104
+ ...run in terminal::
105
+
106
+ $ python example.py
107
+ >>> {'fiveSquaredIs': 25}
@@ -0,0 +1,25 @@
1
+ .. _installation:
2
+
3
+ .. highlight:: python
4
+
5
+ Installation
6
+ ============
7
+
8
+ GraphQL-API requires **Python 3.5** or newer.
9
+
10
+ Install GraphQL-API with pip::
11
+
12
+ pip install graphql-api
13
+
14
+ Install GraphQL-API with pipenv::
15
+
16
+ pipenv install graphql-api
17
+
18
+ Dependencies
19
+ ------------
20
+
21
+ GraphQL-API has a few lightweight dependencies that will automatically be installed.
22
+
23
+ - **graphql-core** the core GraphQL base implementation in Python.
24
+ - **requests** a lightweight HTTP request library
25
+ - **typing-inspect** introspection on type defintions in Python.