Skip to content

Commit c935d27

Browse files
authored
Merge pull request #2 from elastic-coders/release_0.0.4
Release 0.0.4
2 parents b34d0a2 + b46fc76 commit c935d27

16 files changed

+119
-17
lines changed

.circleci/config.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: 2
2+
3+
jobs:
4+
build:
5+
working_directory: ~/py-graphqlparser
6+
docker:
7+
- image: ubuntu:16.04
8+
steps:
9+
- checkout
10+
- run:
11+
name: apt update
12+
command: apt-get -q update
13+
- run:
14+
name: apt required packages
15+
command: apt-get install -qy build-essential python python3 python3-pip python3-dev git cmake bison flex pkg-config
16+
- run:
17+
name: install cython
18+
command: pip3 install -q cython==0.27.3
19+
- run:
20+
name: git submodules
21+
command: |
22+
mkdir -p -m 700 ~/.ssh
23+
ssh-keyscan github.com >> ~/.ssh/known_hosts
24+
git submodule -q sync
25+
git submodule -q update -f --init
26+
- run:
27+
name: build libgraphqlparser
28+
command: |
29+
cd libgraphqlparser
30+
cmake .
31+
make
32+
- run:
33+
name: ast
34+
command: python2 ast/build_ast.py
35+
- run:
36+
name: build ext
37+
command: LDFLAGS="-L./libgraphqlparser" CFLAGS="-Ilibgraphqlparser/c -Ilibgraphqlparser" python3 setup.py build_ext
38+
- run:
39+
name: install package
40+
command: pip3 install -e .
41+
- run:
42+
name: install pytest
43+
command: pip3 install pytest
44+
- run:
45+
name: test
46+
command: python3 -m pytest
47+
environment:
48+
LD_LIBRARY_PATH: "./libgraphqlparser"

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/.git/
2+
**/__pycache__/
3+
.circleci/
4+
.pytest_cache/
5+
.tox/
6+
.wheelhouse/
7+
**/CMakeCache.txt

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ __pycache__
99
/.cache
1010
/dist/
1111
/*.egg-info
12+
.pytest_cache

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update -qy
4+
RUN apt-get install -qy build-essential python python3 python3-pip python3-dev git cmake bison flex pkg-config
5+
RUN pip3 install cython
6+
7+
RUN mkdir /tmp/build
8+
COPY libgraphqlparser /tmp/build/libgraphqlparser
9+
COPY ast /tmp/build/ast
10+
COPY examples /tmp/build/examples
11+
COPY graphql_parser /tmp/build/graphql_parser
12+
COPY setup.py *.rst /tmp/build/
13+
14+
15+
RUN cd /tmp/build/libgraphqlparser && \
16+
cmake . && \
17+
make && \
18+
cp libgraphqlparser.so /usr/local/lib
19+
RUN cd /tmp/build && \
20+
python2 ast/build_ast.py && \
21+
LDFLAGS="-L./libgraphqlparser" CFLAGS="-Ilibgraphqlparser/c -Ilibgraphqlparser" \
22+
python3 setup.py build_ext && \
23+
pip3 install .
24+
ENV LD_LIBRARY_PATH=/usr/local/lib
25+
26+
ENTRYPOINT ["python3", "/tmp/build/examples/visitor_example.py"]

NEWS.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
News
22
----
33

4+
v0.0.4
5+
------
6+
7+
- compatible with latest libgraphqlparser 0.7.0
8+
- built wheels for python 3.6
9+
10+
411
v0.0.3
512
------
613

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Graphql parser based on libgraphqlparser
22
=========================================
33

4+
.. image:: https://circleci.com/gh/elastic-coders/py-graphqlparser.svg?style=svg
5+
:target: https://circleci.com/gh/elastic-coders/py-graphqlparser
6+
47
Python2.7+ Python3.4+ class-based bindings to libgraphqlparser; just a thin layer on top of ``libgraphqlparser`` C API.
58

69
Still **EXPERIMENTAL**
@@ -16,7 +19,7 @@ on `graphqlparser github releases`_
1619

1720
Pick the right wheel for your platform and python version, then install it using pip::
1821

19-
pip install https://github.com/elastic-coders/py-graphqlparser/releases/download/v0.0.3/graphqlparser-0.0.3-cp27-none-linux_x86_64.whl
22+
pip install https://github.com/elastic-coders/py-graphqlparser/releases/download/v0.0.4/graphqlparser-0.0.4-cp36-cp36m-linux_x86_64.whl
2023

2124

2225
As an alternative you can install ``graphqlparser`` from source distribution:

ast/ast_cython.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ def start_type(self, name):
3636
print '''
3737
cdef class %(name)s(GraphQLAst):
3838
39-
cdef %(cmodule)s.%(name)s* _wrapped
39+
cdef const %(cmodule)s.%(name)s* _wrapped
4040
4141
@staticmethod
42-
cdef create(cGraphQLAst.%(name)s *thing)
42+
cdef create(const cGraphQLAst.%(name)s *thing)
4343
4444
''' % {'name': st_name, 'cmodule': ast_cython_c.CMODULE_NAME}
4545
self._current_type = name

ast/ast_cython_impl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_%(snake)s(self):
5555
# python object return type
5656
return '''
5757
def get_%(snake)s(self):
58-
cdef %(cmodule)s.%(return_st)s *next
58+
cdef const %(cmodule)s.%(return_st)s *next
5959
next = %(cmodule)s.%(owning_st)s_get_%(snake)s(self._wrapped)
6060
if next is NULL:
6161
return None
@@ -88,7 +88,7 @@ def start_type(self, name):
8888
cdef class %(name)s(GraphQLAst):
8989
9090
@staticmethod
91-
cdef create(%(cmodule)s.%(name)s *thing):
91+
cdef create(const %(cmodule)s.%(name)s *thing):
9292
node = %(name)s()
9393
node._wrapped = thing
9494
return node

ast/ast_cython_visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def end_file(self):
5050

5151
print '''
5252
void graphql_node_visit(GraphQLAstNode *node,
53-
GraphQLAstVisitorCallbacks *callbacks,
53+
const GraphQLAstVisitorCallbacks *callbacks,
5454
void *userData)
5555
'''
5656

ast/ast_cython_visitor_impl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def end_file(self):
5555
_map = {'snake': snake(type), 'name': type, 'cmodule': CMODULE_NAME}
5656
print '''
5757
58-
cdef int _visit_%(snake)s(%(cmodule)s.GraphQLAst%(name)s* node, void* userData, int end):
58+
cdef int _visit_%(snake)s(const %(cmodule)s.GraphQLAst%(name)s* node, void* userData, int end):
5959
cdef GraphQLAstVisitor visitor
6060
ast = GraphQLAst.GraphQLAst%(name)s.create(node)
6161
if userData is not NULL:
@@ -66,10 +66,10 @@ def end_file(self):
6666
retval = fun(ast)
6767
return 0 if retval is None else retval
6868
69-
cdef int visit_%(snake)s(%(cmodule)s.GraphQLAst%(name)s* node, void* userData):
69+
cdef int visit_%(snake)s(const %(cmodule)s.GraphQLAst%(name)s* node, void* userData):
7070
return _visit_%(snake)s(node, userData, 0)
7171
72-
cdef void end_visit_%(snake)s(%(cmodule)s.GraphQLAst%(name)s* node, void* userData):
72+
cdef void end_visit_%(snake)s(const %(cmodule)s.GraphQLAst%(name)s* node, void* userData):
7373
_visit_%(snake)s(node, userData, 1)
7474
''' % _map
7575

0 commit comments

Comments
 (0)