python-graphql-core-rs 0.1.1__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.
@@ -0,0 +1,29 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: cargo
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ groups:
8
+ cargo-minor-patch:
9
+ update-types:
10
+ - minor
11
+ - patch
12
+ - package-ecosystem: pip
13
+ directory: /
14
+ schedule:
15
+ interval: weekly
16
+ groups:
17
+ pip-minor-patch:
18
+ update-types:
19
+ - minor
20
+ - patch
21
+ - package-ecosystem: github-actions
22
+ directory: /
23
+ schedule:
24
+ interval: weekly
25
+ groups:
26
+ github-actions-minor-patch:
27
+ update-types:
28
+ - minor
29
+ - patch
@@ -0,0 +1,52 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+
10
+ jobs:
11
+ linux:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v7.0.1
15
+ - uses: PyO3/maturin-action@v1.51.0
16
+ with:
17
+ manylinux: auto
18
+ command: build
19
+ args: --release --sdist -o dist --find-interpreter
20
+ - name: Upload wheels
21
+ uses: actions/upload-artifact@v7.0.2
22
+ with:
23
+ name: wheels-linux
24
+ path: dist
25
+
26
+ windows:
27
+ runs-on: windows-latest
28
+ steps:
29
+ - uses: actions/checkout@v7.0.1
30
+ - uses: PyO3/maturin-action@v1.51.0
31
+ with:
32
+ command: build
33
+ args: --release -o dist --find-interpreter
34
+ - name: Upload wheels
35
+ uses: actions/upload-artifact@v7.0.2
36
+ with:
37
+ name: wheels-windows
38
+ path: dist
39
+
40
+ macos:
41
+ runs-on: macos-latest
42
+ steps:
43
+ - uses: actions/checkout@v7.0.1
44
+ - uses: PyO3/maturin-action@v1.51.0
45
+ with:
46
+ command: build
47
+ args: --release -o dist --target universal2-apple-darwin --find-interpreter
48
+ - name: Upload wheels
49
+ uses: actions/upload-artifact@v7.0.2
50
+ with:
51
+ name: wheels-macos
52
+ path: dist
@@ -0,0 +1,48 @@
1
+ # This file is machine-generated by `gh actions-lock`.
2
+ # Do not edit by hand; run `gh actions-lock` to update.
3
+ # Docs: https://gh.io/actions-lockfile
4
+ version: 'v0.0.3'
5
+ workflows:
6
+ '.github/workflows/CI.yml':
7
+ - 'actions/checkout@v7.0.1'
8
+ - 'actions/upload-artifact@v7.0.2'
9
+ - 'pyo3/maturin-action@v1.51.0'
10
+ '.github/workflows/release.yml':
11
+ - 'actions/checkout@v7.0.1'
12
+ - 'actions/download-artifact@v8.0.2'
13
+ - 'actions/upload-artifact@v7.0.2'
14
+ - 'pyo3/maturin-action@v1.51.0'
15
+ - 'pypa/gh-action-pypi-publish@v1.14.3'
16
+ dependencies:
17
+ 'actions/checkout@v7.0.1':
18
+ ref: 'v7.0.1'
19
+ commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
20
+ owner_id: 44036562
21
+ repo_id: 197814629
22
+ 'actions/download-artifact@v8.0.2':
23
+ ref: 'v8.0.2'
24
+ commit: 'sha1-9000827ccba6bdab643e8b6fd33ac0654aef8333'
25
+ owner_id: 44036562
26
+ repo_id: 192626254
27
+ 'actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405':
28
+ ref: 'v6.2.0'
29
+ commit: 'sha1-a309ff8b426b58ec0e2a45f0f869d46889d02405'
30
+ owner_id: 44036562
31
+ repo_id: 192625525
32
+ 'actions/upload-artifact@v7.0.2':
33
+ ref: 'v7.0.2'
34
+ commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9'
35
+ owner_id: 44036562
36
+ repo_id: 192625955
37
+ 'pyo3/maturin-action@v1.51.0':
38
+ ref: 'v1.51.0'
39
+ commit: 'sha1-e83996d129638aa358a18fbd1dfb82f0b0fb5d3b'
40
+ owner_id: 28156855
41
+ repo_id: 363801746
42
+ 'pypa/gh-action-pypi-publish@v1.14.3':
43
+ ref: 'v1.14.3'
44
+ commit: 'sha1-7245906fb61fa33a13554f9d5fb856fe61758086'
45
+ owner_id: 647025
46
+ repo_id: 178055147
47
+ uses:
48
+ - 'actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405'
@@ -0,0 +1,218 @@
1
+ name: Release
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ version_bump:
6
+ description: Version bump type
7
+ required: true
8
+ type: choice
9
+ options:
10
+ - patch
11
+ - minor
12
+ - major
13
+ permissions:
14
+ contents: read
15
+ concurrency:
16
+ group: release
17
+ env:
18
+ CRATE: graphql-core-rs
19
+ PACKAGE: python-graphql-core-rs
20
+ VERSION_FILES: Cargo.toml Cargo.lock
21
+ DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
22
+ defaults:
23
+ run:
24
+ shell: bash
25
+ jobs:
26
+ check:
27
+ name: Bump version
28
+ runs-on: ubuntu-latest
29
+ timeout-minutes: 45
30
+ permissions:
31
+ contents: read
32
+ outputs:
33
+ version: ${{ steps.version.outputs.version }}
34
+ steps:
35
+ - name: Require the default branch
36
+ run: |
37
+ if [[ "$GITHUB_REF" != "refs/heads/$DEFAULT_BRANCH" ]]; then
38
+ echo "::error::Dispatch the release workflow from $DEFAULT_BRANCH."
39
+ exit 1
40
+ fi
41
+ - uses: actions/checkout@v7.0.1
42
+ with:
43
+ persist-credentials: false
44
+ - name: Choose version
45
+ id: version
46
+ env:
47
+ BUMP: ${{ inputs.version_bump }}
48
+ GH_TOKEN: ${{ github.token }}
49
+ run: |
50
+ current=$(cargo metadata --locked --no-deps --format-version 1 | jq -er '.packages[] | select(.name == env.CRATE) | .version')
51
+ IFS=. read -r major minor patch <<< "$current"
52
+ case "$BUMP" in
53
+ major) version="$((major + 1)).0.0" ;;
54
+ minor) version="$major.$((minor + 1)).0" ;;
55
+ patch) version="$major.$minor.$((patch + 1))" ;;
56
+ esac
57
+ existing=$(gh api "repos/$GITHUB_REPOSITORY/git/matching-refs/tags/v$version" --jq "[.[] | select(.ref == \"refs/tags/v$version\")] | length")
58
+ if [[ "$existing" != 0 ]]; then
59
+ echo "::error::Tag v$version already exists."
60
+ exit 1
61
+ fi
62
+ echo "version=$version" >> "$GITHUB_OUTPUT"
63
+ - name: Commit version bump
64
+ env:
65
+ VERSION: ${{ steps.version.outputs.version }}
66
+ run: |
67
+ sed -i "0,/^version = \".*\"/s//version = \"$VERSION\"/" Cargo.toml
68
+ cargo update --workspace
69
+ git config user.name "github-actions[bot]"
70
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
71
+ read -ra files <<< "$VERSION_FILES"
72
+ git commit -m "Bump version to $VERSION" -- "${files[@]}"
73
+ - name: Build sdist
74
+ uses: PyO3/maturin-action@v1.51.0
75
+ with:
76
+ command: sdist
77
+ args: --out dist
78
+ - name: Verify sdist
79
+ env:
80
+ VERSION: ${{ steps.version.outputs.version }}
81
+ run: ls "dist/${PACKAGE//-/_}-$VERSION.tar.gz"
82
+ - name: Bundle the version commit
83
+ run: git bundle create "$RUNNER_TEMP/release.bundle" "$GITHUB_SHA..HEAD"
84
+ - uses: actions/upload-artifact@v7.0.2
85
+ with:
86
+ name: release-bundle
87
+ path: ${{ runner.temp }}/release.bundle
88
+ retention-days: 1
89
+
90
+ tag:
91
+ name: Push commit and tag
92
+ needs: [check]
93
+ runs-on: ubuntu-latest
94
+ timeout-minutes: 10
95
+ permissions:
96
+ contents: write
97
+ steps:
98
+ - uses: actions/checkout@v7.0.1
99
+ - uses: actions/download-artifact@v8.0.2
100
+ with:
101
+ name: release-bundle
102
+ path: ${{ runner.temp }}
103
+ - name: Push commit and tag
104
+ env:
105
+ VERSION: ${{ needs.check.outputs.version }}
106
+ run: |
107
+ git fetch "$RUNNER_TEMP/release.bundle" HEAD
108
+ commit=$(git rev-parse FETCH_HEAD)
109
+ if [[ "$(git rev-parse "$commit^")" != "$GITHUB_SHA" ]]; then
110
+ echo "::error::The version commit is not a child of $GITHUB_SHA."
111
+ exit 1
112
+ fi
113
+ read -ra allowed <<< "$VERSION_FILES"
114
+ while read -r file; do
115
+ if [[ " ${allowed[*]} " != *" $file "* ]]; then
116
+ echo "::error::The version commit changes $file."
117
+ exit 1
118
+ fi
119
+ done < <(git diff --name-only "$GITHUB_SHA" "$commit")
120
+ git config user.name "github-actions[bot]"
121
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
122
+ git tag -a "v$VERSION" -m "$PACKAGE v$VERSION" "$commit"
123
+ git push --atomic origin "$commit:refs/heads/$DEFAULT_BRANCH" "refs/tags/v$VERSION"
124
+
125
+ linux:
126
+ needs: [check, tag]
127
+ runs-on: ubuntu-latest
128
+ timeout-minutes: 45
129
+ permissions:
130
+ contents: read
131
+ steps:
132
+ - uses: actions/checkout@v7.0.1
133
+ with:
134
+ ref: refs/tags/v${{ needs.check.outputs.version }}
135
+ persist-credentials: false
136
+ - uses: PyO3/maturin-action@v1.51.0
137
+ with:
138
+ manylinux: auto
139
+ command: build
140
+ args: --release --sdist -o dist --find-interpreter
141
+ - uses: actions/upload-artifact@v7.0.2
142
+ with:
143
+ name: wheels-linux
144
+ path: dist
145
+
146
+ windows:
147
+ needs: [check, tag]
148
+ runs-on: windows-latest
149
+ timeout-minutes: 45
150
+ permissions:
151
+ contents: read
152
+ steps:
153
+ - uses: actions/checkout@v7.0.1
154
+ with:
155
+ ref: refs/tags/v${{ needs.check.outputs.version }}
156
+ persist-credentials: false
157
+ - uses: PyO3/maturin-action@v1.51.0
158
+ with:
159
+ command: build
160
+ args: --release -o dist --find-interpreter
161
+ - uses: actions/upload-artifact@v7.0.2
162
+ with:
163
+ name: wheels-windows
164
+ path: dist
165
+
166
+ macos:
167
+ needs: [check, tag]
168
+ runs-on: macos-latest
169
+ timeout-minutes: 45
170
+ permissions:
171
+ contents: read
172
+ steps:
173
+ - uses: actions/checkout@v7.0.1
174
+ with:
175
+ ref: refs/tags/v${{ needs.check.outputs.version }}
176
+ persist-credentials: false
177
+ - uses: PyO3/maturin-action@v1.51.0
178
+ with:
179
+ command: build
180
+ args: --release -o dist --target universal2-apple-darwin --find-interpreter
181
+ - uses: actions/upload-artifact@v7.0.2
182
+ with:
183
+ name: wheels-macos
184
+ path: dist
185
+
186
+ publish:
187
+ name: Publish to PyPI
188
+ needs: [check, linux, windows, macos]
189
+ runs-on: ubuntu-latest
190
+ timeout-minutes: 30
191
+ environment:
192
+ name: pypi
193
+ url: https://pypi.org/project/${{ env.PACKAGE }}/
194
+ permissions:
195
+ contents: read
196
+ id-token: write
197
+ steps:
198
+ - uses: actions/download-artifact@v8.0.2
199
+ with:
200
+ pattern: wheels-*
201
+ path: dist
202
+ merge-multiple: true
203
+ - uses: pypa/gh-action-pypi-publish@v1.14.3
204
+ with:
205
+ skip-existing: true
206
+
207
+ github-release:
208
+ name: Create GitHub Release
209
+ needs: [check, publish]
210
+ runs-on: ubuntu-latest
211
+ timeout-minutes: 10
212
+ permissions:
213
+ contents: write
214
+ steps:
215
+ - env:
216
+ GH_TOKEN: ${{ github.token }}
217
+ VERSION: ${{ needs.check.outputs.version }}
218
+ run: gh release create "v$VERSION" --repo "$GITHUB_REPOSITORY" --verify-tag --title "$PACKAGE v$VERSION" --generate-notes
@@ -0,0 +1,72 @@
1
+ /target
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ .pytest_cache/
6
+ *.py[cod]
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ .venv/
14
+ env/
15
+ bin/
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ include/
26
+ man/
27
+ venv/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+ pip-selfcheck.json
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+
45
+ # Translations
46
+ *.mo
47
+
48
+ # Mr Developer
49
+ .mr.developer.cfg
50
+ .project
51
+ .pydevproject
52
+
53
+ # Rope
54
+ .ropeproject
55
+
56
+ # Django stuff:
57
+ *.log
58
+ *.pot
59
+
60
+ .DS_Store
61
+
62
+ # Sphinx documentation
63
+ docs/_build/
64
+
65
+ # PyCharm
66
+ .idea/
67
+
68
+ # VSCode
69
+ .vscode/
70
+
71
+ # Pyenv
72
+ .python-version
@@ -0,0 +1,197 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "bytes"
7
+ version = "1.12.2"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c"
10
+
11
+ [[package]]
12
+ name = "combine"
13
+ version = "4.6.9"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92"
16
+ dependencies = [
17
+ "bytes",
18
+ "memchr",
19
+ ]
20
+
21
+ [[package]]
22
+ name = "graphql-core-rs"
23
+ version = "0.1.1"
24
+ dependencies = [
25
+ "graphql-parser",
26
+ "pyo3",
27
+ "pyo3-build-config",
28
+ ]
29
+
30
+ [[package]]
31
+ name = "graphql-parser"
32
+ version = "0.4.1"
33
+ source = "registry+https://github.com/rust-lang/crates.io-index"
34
+ checksum = "7a818c0d883d7c0801df27be910917750932be279c7bc82dc541b8769425f409"
35
+ dependencies = [
36
+ "combine",
37
+ "thiserror",
38
+ ]
39
+
40
+ [[package]]
41
+ name = "heck"
42
+ version = "0.5.0"
43
+ source = "registry+https://github.com/rust-lang/crates.io-index"
44
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
45
+
46
+ [[package]]
47
+ name = "libc"
48
+ version = "0.2.191"
49
+ source = "registry+https://github.com/rust-lang/crates.io-index"
50
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
51
+
52
+ [[package]]
53
+ name = "memchr"
54
+ version = "2.8.3"
55
+ source = "registry+https://github.com/rust-lang/crates.io-index"
56
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
57
+
58
+ [[package]]
59
+ name = "once_cell"
60
+ version = "1.21.4"
61
+ source = "registry+https://github.com/rust-lang/crates.io-index"
62
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
63
+
64
+ [[package]]
65
+ name = "portable-atomic"
66
+ version = "1.15.0"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
69
+
70
+ [[package]]
71
+ name = "proc-macro2"
72
+ version = "1.0.107"
73
+ source = "registry+https://github.com/rust-lang/crates.io-index"
74
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
75
+ dependencies = [
76
+ "unicode-ident",
77
+ ]
78
+
79
+ [[package]]
80
+ name = "pyo3"
81
+ version = "0.30.1"
82
+ source = "registry+https://github.com/rust-lang/crates.io-index"
83
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
84
+ dependencies = [
85
+ "libc",
86
+ "once_cell",
87
+ "portable-atomic",
88
+ "pyo3-build-config",
89
+ "pyo3-ffi",
90
+ "pyo3-macros",
91
+ ]
92
+
93
+ [[package]]
94
+ name = "pyo3-build-config"
95
+ version = "0.30.1"
96
+ source = "registry+https://github.com/rust-lang/crates.io-index"
97
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
98
+ dependencies = [
99
+ "target-lexicon",
100
+ ]
101
+
102
+ [[package]]
103
+ name = "pyo3-ffi"
104
+ version = "0.30.1"
105
+ source = "registry+https://github.com/rust-lang/crates.io-index"
106
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
107
+ dependencies = [
108
+ "libc",
109
+ "pyo3-build-config",
110
+ ]
111
+
112
+ [[package]]
113
+ name = "pyo3-macros"
114
+ version = "0.30.1"
115
+ source = "registry+https://github.com/rust-lang/crates.io-index"
116
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
117
+ dependencies = [
118
+ "proc-macro2",
119
+ "pyo3-macros-backend",
120
+ "quote",
121
+ "syn 3.0.10",
122
+ ]
123
+
124
+ [[package]]
125
+ name = "pyo3-macros-backend"
126
+ version = "0.30.1"
127
+ source = "registry+https://github.com/rust-lang/crates.io-index"
128
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
129
+ dependencies = [
130
+ "heck",
131
+ "proc-macro2",
132
+ "quote",
133
+ "syn 3.0.10",
134
+ ]
135
+
136
+ [[package]]
137
+ name = "quote"
138
+ version = "1.0.47"
139
+ source = "registry+https://github.com/rust-lang/crates.io-index"
140
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
141
+ dependencies = [
142
+ "proc-macro2",
143
+ ]
144
+
145
+ [[package]]
146
+ name = "syn"
147
+ version = "2.0.119"
148
+ source = "registry+https://github.com/rust-lang/crates.io-index"
149
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
150
+ dependencies = [
151
+ "proc-macro2",
152
+ "quote",
153
+ "unicode-ident",
154
+ ]
155
+
156
+ [[package]]
157
+ name = "syn"
158
+ version = "3.0.10"
159
+ source = "registry+https://github.com/rust-lang/crates.io-index"
160
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
161
+ dependencies = [
162
+ "proc-macro2",
163
+ "quote",
164
+ "unicode-ident",
165
+ ]
166
+
167
+ [[package]]
168
+ name = "target-lexicon"
169
+ version = "0.13.6"
170
+ source = "registry+https://github.com/rust-lang/crates.io-index"
171
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
172
+
173
+ [[package]]
174
+ name = "thiserror"
175
+ version = "1.0.69"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
178
+ dependencies = [
179
+ "thiserror-impl",
180
+ ]
181
+
182
+ [[package]]
183
+ name = "thiserror-impl"
184
+ version = "1.0.69"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
187
+ dependencies = [
188
+ "proc-macro2",
189
+ "quote",
190
+ "syn 2.0.119",
191
+ ]
192
+
193
+ [[package]]
194
+ name = "unicode-ident"
195
+ version = "1.0.27"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
@@ -0,0 +1,17 @@
1
+ [package]
2
+ name = "graphql-core-rs"
3
+ version = "0.1.1"
4
+ edition = "2021"
5
+ readme = "README.md"
6
+
7
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+ [lib]
9
+ name = "graphql_core_rs"
10
+ crate-type = ["cdylib"]
11
+
12
+ [dependencies]
13
+ graphql-parser = "0.4.1"
14
+ pyo3 = { version = "0.30.1", features = ["extension-module", "abi3-py311"] }
15
+
16
+ [build-dependencies]
17
+ pyo3-build-config = "0.30.1"
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-graphql-core-rs
3
+ Version: 0.1.1
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.11
@@ -0,0 +1,76 @@
1
+ # python-graphql-core-rs
2
+
3
+ A high-performance GraphQL parser for Python, powered by Rust.
4
+
5
+ This library provides Python bindings to the [graphql-parser](https://crates.io/crates/graphql-parser) Rust crate, offering fast and reliable GraphQL query parsing through native extensions.
6
+
7
+ ## Features
8
+
9
+ - Fast GraphQL query parsing using Rust's graphql-parser
10
+ - Native Python extension built with PyO3
11
+ - Supports Python 3.9+ (CPython and PyPy)
12
+
13
+ ## Installation
14
+
15
+ ### From Source
16
+
17
+ Requires [Rust](https://rustup.rs/) and [Maturin](https://github.com/PyO3/maturin):
18
+
19
+ ```bash
20
+ pip install maturin
21
+ maturin develop
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ import graphql_core_rs
28
+
29
+ # Parse a GraphQL query
30
+ query = """
31
+ query GetUser($id: ID!) {
32
+ user(id: $id) {
33
+ name
34
+ email
35
+ }
36
+ }
37
+ """
38
+
39
+ result = graphql_core_rs.parse(query)
40
+ print(result)
41
+ ```
42
+
43
+ ## Development
44
+
45
+ Build the extension in development mode:
46
+
47
+ ```bash
48
+ pip install -r requirements.txt
49
+ maturin develop
50
+ ```
51
+
52
+ Run with release optimizations:
53
+
54
+ ```bash
55
+ maturin develop --release
56
+ ```
57
+
58
+ ## Release
59
+
60
+ Run the Release workflow from `master`:
61
+
62
+ ```bash
63
+ gh workflow run release.yml --ref master -f version_bump=patch
64
+ ```
65
+
66
+ The run bumps the version in `Cargo.toml` and `Cargo.lock`, pushes the version commit to `master` together with the annotated tag `v<version>`, builds the wheels and the sdist from that tag, publishes them to PyPI as `python-graphql-core-rs` with trusted publishing (environment `pypi`), and creates the GitHub Release.
67
+
68
+ ## Requirements
69
+
70
+ - Python 3.9+
71
+ - Rust toolchain
72
+ - Maturin 1.15.x
73
+
74
+ ## License
75
+
76
+ Apache-2.0
@@ -0,0 +1,5 @@
1
+ use pyo3_build_config;
2
+
3
+ fn main() {
4
+ pyo3_build_config::add_extension_module_link_args();
5
+ }
@@ -0,0 +1,12 @@
1
+ [build-system]
2
+ requires = ["maturin>=1.15,<2"]
3
+ build-backend = "maturin"
4
+
5
+ [project]
6
+ name = "python-graphql-core-rs"
7
+ requires-python = ">=3.11"
8
+ classifiers = [
9
+ "Programming Language :: Rust",
10
+ "Programming Language :: Python :: Implementation :: CPython",
11
+ "Programming Language :: Python :: Implementation :: PyPy",
12
+ ]
@@ -0,0 +1,2 @@
1
+ maturin==1.16.0
2
+ tomli==2.5.0
@@ -0,0 +1,26 @@
1
+ use graphql_parser;
2
+ use pyo3::prelude::*;
3
+
4
+ /// Formats the sum of two numbers as string.
5
+ #[pyfunction]
6
+ fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
7
+ Ok((a + b).to_string())
8
+ }
9
+
10
+ #[pyfunction]
11
+ fn parse(query: &str) -> PyResult<String> {
12
+ let ast_result = graphql_parser::parse_query::<&str>(query);
13
+ if let Err(e) = ast_result {
14
+ return Err(pyo3::exceptions::PyValueError::new_err(e.to_string()));
15
+ }
16
+ let ast = ast_result.unwrap();
17
+ Ok(ast.to_string())
18
+ }
19
+
20
+ /// A Python module implemented in Rust.
21
+ #[pymodule]
22
+ fn graphql_core_rs(m: &Bound<'_, PyModule>) -> PyResult<()> {
23
+ m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
24
+ m.add_function(wrap_pyfunction!(parse, m)?)?;
25
+ Ok(())
26
+ }