Skip to content

Commit 8553651

Browse files
author
Marco Paolini
committed
Fix packaging
1 parent a4196d5 commit 8553651

File tree

7 files changed

+35
-22
lines changed

7 files changed

+35
-22
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ __pycache__
55
/build/
66
/.wheelhouse/
77
/.python-version
8+
/.tox
9+
/.cache
10+
/dist/
811

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# libgraphql cython port
22

3-
Python2.7+ (includes python3) class-based bindings to libgraphql
3+
Python2.7+ Python3.4+ class-based bindings to libgraphqlparser
44

55
See usage example in `examples/visitor_example.py`
66

7-
This bindings are still experimental.
7+
Still **EXPERIMENTAL**
88

99

1010
## Building from source
@@ -34,3 +34,9 @@ Make sure `libgraphql` is available to the loader in your `LD_LIBRARY_PATH`
3434
- Unicode string handling not yet complete (a mixture of bytes and strings all over)
3535
- Exceptions in the visitor's class callbacks are ignored
3636
- libgraphqlparser is **dynamically** linked but It would be better if it was linked statically
37+
38+
39+
## TODO
40+
41+
- build and upload wheels to pypi
42+
- build more wheel packages for linux 32 bit and other platforms

examples/visitor_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22

3-
import GraphQLAstVisitor
4-
import GraphQLParser
3+
from graphql_parser import GraphQLAstVisitor
4+
from graphql_parser import GraphQLParser
55

66

77
class Visitor(GraphQLAstVisitor.GraphQLAstVisitor):

graphql_parser/__init__.py

Whitespace-only changes.

setup.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
from distutils.core import setup
2-
from distutils.extension import Extension
3-
import os
1+
from setuptools import setup, Extension
42

53
from Cython.Build import cythonize
64

7-
LIBGRAPHQLPARSER_HOME = os.environ.get('LIBGRAPHQLPARSER_HOME', './libgraphqlparser')
8-
5+
extensions = cythonize([
6+
Extension('graphql_parser.{}'.format(cls_name),
7+
['graphql_parser/{}.pyx'.format(cls_name)],
8+
libraries=['graphqlparser'],
9+
include_dirs=['.'])
10+
for cls_name in ['GraphQLParser', 'GraphQLAstVisitor',
11+
'GraphQLAst', 'GraphQLAstNode']
12+
])
913

1014
setup(
1115
name='graphqlparser',
12-
version='0.0.1',
16+
version='0.0.2',
1317
author='Marco Paolini',
1418
author_email='[email protected]',
1519
description='Python bindings for libgraphqlparser (Cython-based)',
20+
long_description='Graphql parser based on libgraphql with Cython-based bindings',
1621
url='https://github.com/elastic-coders/py-graphqlparser',
17-
ext_modules=cythonize(
18-
Extension("grahpql_parser",
19-
["graphql_parser/GraphQLParser.pyx",
20-
"graphql_parser/GraphQLAstVisitor.pyx",
21-
"graphql_parser/GraphQLAst.pyx",
22-
"graphql_parser/GraphQLAstNode.pyx"],
23-
libraries=['graphqlparser'],
24-
library_dirs=[LIBGRAPHQLPARSER_HOME]
25-
)
26-
),
22+
packages=['graphql_parser'],
23+
ext_modules=extensions,
2724
classifiers=[
2825
'Development Status :: 3 - Alpha',
2926
'Environment :: Console',

tests/test_parse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33

44
def test_parse_ok():
5-
import GraphQLParser
5+
from graphql_parser import GraphQLParser
66
assert GraphQLParser.graphql_parse_string('{query {id}}')
77

88

99
def test_parse_bad():
10-
import GraphQLParser
10+
from graphql_parser import GraphQLParser
1111
with pytest.raises(GraphQLParser.GraphQLParseError):
1212
assert GraphQLParser.graphql_parse_string('{query {id')

tox.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[tox]
2+
envlist=py27,py33,py34,py35
3+
4+
[testenv]
5+
deps = pytest
6+
Cython
7+
commands=py.test

0 commit comments

Comments
 (0)