Skip to content

Commit 2923597

Browse files
authored
Merge pull request #3 from qlient-org/dev
Test CI/CD with publish
2 parents 95e6c39 + 13f69bf commit 2923597

File tree

4 files changed

+91
-47
lines changed

4 files changed

+91
-47
lines changed

.circleci/config.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44

55
# Building and testing the project
66
# Useful when a PR is open, for example
7-
build-and-test:
7+
test:
88
# Our environment, Python 3.7
99
docker:
1010
- image: circleci/python:3.7
@@ -44,8 +44,19 @@ jobs:
4444
python -m poetry run coverage run --omit="/home/circleci/.cache/pypoetry/virtualenvs" -m pytest
4545
python -m poetry run coverage report
4646
47+
# create the GitHub release
48+
release:
49+
50+
# Same environment
51+
docker:
52+
- image: circleci/python:3.7
53+
54+
steps:
55+
- checkout
56+
57+
4758
# This is the definition of another job, the one we use to publish the package to PyPI
48-
deployment:
59+
publish:
4960

5061
# Same environment
5162
docker:
@@ -70,26 +81,24 @@ workflows:
7081
# The build-and-test we will run EVERYTIME a piece of code changes
7182
build-and-test-workflow:
7283
jobs:
73-
- build-and-test
84+
- test
7485

7586
# The deployment workflow publishes the package
76-
deployment-workflow:
87+
release-and-publish:
7788
jobs:
78-
79-
# Runs build and test, but now just on Git tags (created from a GitHub release)
80-
- build-and-test:
89+
- release:
8190
filters:
82-
tags:
83-
only: /v[0-9]+(\.[0-9]+)*/
8491
branches:
85-
ignore: /.*/
92+
only: main
93+
94+
# Runs build and test, but now just on Git tags (created from a GitHub release)
95+
- test
8696

8797
# Runs the deployment job, just with the tags as well
88-
- deployment:
98+
- publish:
8999
requires:
90-
- build-and-test
100+
- release
101+
- test
91102
filters:
92-
tags:
93-
only: /v[0-9]+(\.[0-9]+)*/
94103
branches:
95-
ignore: /.*/
104+
only: main

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,26 @@ res = client.query.launchesPast(
2929
find={"mission_name": "Starlink"},
3030
limit=5,
3131
sort="mission_name",
32-
32+
3333
# qlient specific
3434
_fields=["mission_name", "launch_success", "launch_year"]
3535
)
3636
````
37-
`res` will look something like this.
37+
38+
which sends the following query
39+
40+
```gql
41+
query launchesPast($find: LaunchFind, $limit: Int, $sort: String) {
42+
launchesPast(find: $find, limit: $limit, sort: $sort) {
43+
mission_name
44+
launch_success
45+
launch_year
46+
}
47+
}
48+
```
49+
50+
to the server and return this body:
51+
3852
````json
3953
{
4054
"data": {

docs/index.md

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,66 @@ A fast and modern graphql client designed with simplicity in mind.
1111

1212
## Quick Start
1313

14-
```python
15-
from qlient import Client, Fields
14+
````python
15+
from qlient import Client
1616

1717
client = Client("https://api.spacex.land/graphql/")
1818

19-
mission_fields = Fields("mission_id", "mission_name")
20-
rocket_fields = Fields("rocket_name", fairings="ship")
19+
res = client.query.launchesPast(
20+
# spacex graphql input fields
21+
find={"mission_name": "Starlink"},
22+
limit=5,
23+
sort="mission_name",
2124

22-
result = client.query.launchesPast(
23-
limit=3,
24-
_fields=Fields(mission_fields, rocket=rocket_fields)
25+
# qlient specific
26+
_fields=["mission_name", "launch_success", "launch_year"]
2527
)
26-
print(result)
28+
````
29+
30+
which sends the following query
31+
32+
```gql
33+
query launchesPast($find: LaunchFind, $limit: Int, $sort: String) {
34+
launchesPast(find: $find, limit: $limit, sort: $sort) {
35+
mission_name
36+
launch_success
37+
launch_year
38+
}
39+
}
2740
```
2841

29-
```json
42+
to the server and return this body:
43+
44+
````json
3045
{
3146
"data": {
3247
"launchesPast": [
3348
{
34-
"mission_name": "Starlink-15 (v1.0)",
35-
"rocket": {
36-
"rocket_name": "Falcon 9",
37-
"fairings": {
38-
"ship": "GOMSCHIEF"
39-
}
40-
}
49+
"mission_name": "Paz / Starlink Demo",
50+
"launch_success": true,
51+
"launch_year": "2018"
52+
},
53+
{
54+
"mission_name": "Starlink 1",
55+
"launch_success": true,
56+
"launch_year": "2019"
57+
},
58+
{
59+
"mission_name": "Starlink 2",
60+
"launch_success": true,
61+
"launch_year": "2020"
4162
},
4263
{
43-
"mission_name": "Sentinel-6 Michael Freilich",
44-
"rocket": {
45-
"rocket_name": "Falcon 9",
46-
"fairings": {
47-
"ship": null
48-
}
49-
}
64+
"mission_name": "Starlink 3",
65+
"launch_success": true,
66+
"launch_year": "2020"
5067
},
5168
{
52-
"mission_name": "Crew-1",
53-
"rocket": {
54-
"rocket_name": "Falcon 9",
55-
"fairings": null
56-
}
69+
"mission_name": "Starlink 4",
70+
"launch_success": true,
71+
"launch_year": "2020"
5772
}
5873
]
5974
}
6075
}
61-
```
76+
````

docs/install.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# Installation
22

3-
This package uses ``setuptools`` so it can be easily installed like so:
3+
This package is build with [poetry](https://python-poetry.org/) so installation is as you might expect.
44

5+
* **Using `pip`**
56
```shell
67
pip install python-qlient
8+
```
9+
10+
* **Using `poetry`**
11+
```shell
12+
poetry add python-qlient
713
```

0 commit comments

Comments
 (0)