Skip to content

Commit b35f5e6

Browse files
committed
feat: initial commit
To be clear, this work was not all done in a single commit. That would be insane. @xkludge, @DaleSeo, and @mattbullock were all part of the work to create this project and should get kudos as well.
0 parents  commit b35f5e6

17 files changed

+781
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
<!-- A clear and concise description of what the bug is. -->
12+
13+
**To Reproduce**
14+
<!-- Steps to reproduce the behavior: -->
15+
16+
**Expected behavior**
17+
<!-- A clear and concise description of what you expected to happen. -->
18+
19+
**Additional context**
20+
<!-- Add any other context about the problem here. -->
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
12+
13+
**Describe the solution you'd like**
14+
<!-- A clear and concise description of what you want to happen. -->
15+
16+
**Describe alternatives you've considered**
17+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
18+
19+
**Additional context**
20+
<!-- Add any other context or screenshots about the feature request here. -->

.github/pull_request_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## What kind of change does this PR introduce?
2+
3+
<!-- > (Bug fix, feature, docs update, ...) -->
4+
5+
6+
7+
## What is the current behavior?
8+
9+
<!-- > (You can also link to an open issue here). -->
10+
11+
12+
13+
## What is the new behavior?
14+
15+
16+
17+
## **Does this PR introduce a breaking change?**
18+
19+
<!-- > What changes might users need to make in their application due to this PR? -->
20+
21+
22+
23+
## Other information
24+
25+

.gitignore

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
.pytest_cache/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
db.sqlite3
58+
59+
# Flask stuff:
60+
instance/
61+
.webassets-cache
62+
63+
# Scrapy stuff:
64+
.scrapy
65+
66+
# Sphinx documentation
67+
docs/_build/
68+
69+
# PyBuilder
70+
target/
71+
72+
# Jupyter Notebook
73+
.ipynb_checkpoints
74+
75+
# pyenv
76+
.python-version
77+
78+
# celery beat schedule file
79+
celerybeat-schedule
80+
81+
# SageMath parsed files
82+
*.sage.py
83+
84+
# Environments
85+
.env
86+
.venv
87+
env/
88+
venv/
89+
ENV/
90+
env.bak/
91+
venv.bak/
92+
93+
# Spyder project settings
94+
.spyderproject
95+
.spyproject
96+
97+
# Rope project settings
98+
.ropeproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/

.makefile.identity.inc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
4+
PPPPPPPPPPPPPPPPP QQQQQQQQQ CCCCCCCCCCCCC
5+
P::::::::::::::::P QQ:::::::::QQ CCC::::::::::::C
6+
P::::::PPPPPP:::::P QQ:::::::::::::QQ CC:::::::::::::::C
7+
PP:::::P P:::::PQ:::::::QQQ:::::::Q C:::::CCCCCCCC::::C
8+
P::::P P:::::PQ::::::O Q::::::Q C:::::C CCCCCC
9+
P::::P P:::::PQ:::::O Q:::::QC:::::C
10+
P::::PPPPPP:::::P Q:::::O Q:::::QC:::::C
11+
P:::::::::::::PP Q:::::O Q:::::QC:::::C
12+
P::::PPPPPPPPP Q:::::O Q:::::QC:::::C
13+
P::::P Q:::::O Q:::::QC:::::C
14+
P::::P Q:::::O QQQQ:::::QC:::::C
15+
P::::P Q::::::O Q::::::::Q C:::::C CCCCCC
16+
PP::::::PP Q:::::::QQ::::::::Q C:::::CCCCCCCC::::C
17+
P::::::::P QQ::::::::::::::Q CC:::::::::::::::C
18+
P::::::::P QQ:::::::::::Q CCC::::::::::::C
19+
PPPPPPPPPP QQQQQQQQ::::QQ CCCCCCCCCCCCC
20+
Q:::::Q
21+
QQQQQQ

.makefile.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Available colors
2+
RED := $(shell tput -Txterm setaf 1)
3+
GREEN := $(shell tput -Txterm setaf 2)
4+
YELLOW := $(shell tput -Txterm setaf 3)
5+
WHITE := $(shell tput -Txterm setaf 7)
6+
RESET := $(shell tput -Txterm sgr0)
7+
8+
9+
define HELP_SCRIPT
10+
if ((/^```/ && $$p > 0) || /^```ascii/) { $$p++; next };
11+
print $$_ if ($$p == 1);
12+
if (/^([A-Za-z0-9_-]+[%]?)*:.*## (.*)/) {printf "${YELLOW}%-${TARGET_MAX_CHAR_NUM}s${GREEN}%s${RESET}\n", $$1, $$2 };
13+
if (/^###?/) { printf "\n" }
14+
endef
15+
export HELP_SCRIPT
16+
17+
define SHOW_IDENTITY
18+
@[ -f ./.makefile.identity.inc ] && cat ./.makefile.identity.inc; echo ''; echo '' || echo ''
19+
endef

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: stable
4+
hooks:
5+
- id: black
6+
language_version: python3.7
7+
- repo: https://gitlab.com/pycqa/flake8
8+
rev: ""
9+
hooks:
10+
- id: flake8
11+
additional_dependencies: [flake8-docstrings]
12+
- repo: local
13+
hooks:
14+
- id: test
15+
name: test
16+
entry: python -m unittest discover tests/
17+
pass_filenames: false
18+
language: system
19+
types: [python]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Prodigy Education Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include .makefile.inc
2+
3+
.PHONY: help
4+
help: ## List all available commands.
5+
${SHOW_IDENTITY}
6+
@echo 'Usage:'
7+
@echo '${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
8+
@echo ''
9+
@echo 'Targets:'
10+
@perl -ne "$${HELP_SCRIPT}" $(MAKEFILE_LIST)
11+
12+
.PHONY: tests
13+
tests: ## Run the unit tests against the project.
14+
python -m unittest discover -s tests/

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Python GraphQL Client
2+
3+
> Simple package for making requests to a graphql server.
4+
5+
<!-- Badges here. -->
6+
7+
## Installation
8+
9+
```bash
10+
pip install python-graphql-client
11+
```
12+
13+
## Usage
14+
15+
```python
16+
from python_graphql_client import GraphqlClient
17+
18+
# Instantiate the client with an endpoint.
19+
client = GraphqlClient(endpoint="https://countries.trevorblades.com")
20+
21+
# Create the query string and variables required for the request.
22+
query = """
23+
query countryQuery($countryCode: String) {
24+
country(code:$countryCode) {
25+
code
26+
name
27+
}
28+
}
29+
"""
30+
variables = {"countryCode": "CA"}
31+
32+
# Synchronous request
33+
data = client.execute(query=query, variables=variables)
34+
print(data) # => {'data': {'country': {'code': 'CA', 'name': 'Canada'}}}
35+
36+
37+
# Asynchronous request
38+
import asyncio
39+
40+
data = asyncio.run(client.execute_async(query=query, variables=variables))
41+
print(data) # => {'data': {'country': {'code': 'CA', 'name': 'Canada'}}}
42+
```
43+
44+
## Roadmap
45+
46+
To start we'll try and use a Github project board for listing current work and updating priorities of upcoming features.
47+
48+
## Contributing
49+
50+
Read the [Contributing](docs/CONTRIBUTING.md) documentation for details on the process for submitting pull requests to the project. Also take a peek at our [Code of Conduct](docs/CODE_OF_CONDUCT.md).
51+
52+
## Authors and Acknowledgement
53+
54+
Kudos to @xkludge, @DaleSeo, and @mattbullock for getting this project started.
55+
56+
## License
57+
58+
[MIT License](LICENSE)

0 commit comments

Comments
 (0)