Skip to content

Commit 40ee17b

Browse files
authored
Feat: Package & Dependency Management using Poetry (#210)
* feat(Poetry): Adds Pyproject file for poetry * feat(Dependencies): Drops support of Python 3.6 (End of Life), bumps mongoengine to latest 0.27 * fix(Tests): Fix import names of pytest * fix(Dependencies): Locks dependencies using poetry.lock * fix(Dependencies): Adds Coveralls dependency * feat(Packaging): Removed unused setup.py and requirements.txt, [WIP] updated Makefile * refactor(Converter): Remove unused import * refactor(Fields): Fixes lint issues, logs error * fix(Dev Dependecies): Adds Twine [Intermediate for migration from setup.py to pyproject] * fix: migration patch for uploading to pypi
1 parent 2702142 commit 40ee17b

File tree

9 files changed

+1315
-69
lines changed

9 files changed

+1315
-69
lines changed

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,21 @@ lint:
1414
@flake8 graphene_mongo
1515

1616
test: clean lint
17-
py.test graphene_mongo/tests --cov=graphene_mongo --cov-report=html --cov-report=term
17+
pytest graphene_mongo/tests --cov=graphene_mongo --cov-report=html --cov-report=term
1818

1919
register-pypitest:
20-
python setup.py register -r pypitest
20+
#python setup.py register -r pypitest
2121

2222
deploy-pypitest: clean
23-
python setup.py sdist upload -r pypitest
23+
poetry build
24+
#poetry publish --repository testpypi
25+
twine upload --repository testpypi dist/*
2426

2527
register:
26-
python setup.py register -r pypi
28+
#python setup.py register -r pypi
2729

2830
deploy: clean
29-
python setup.py sdist upload -r pypi
31+
poetry build
32+
twine upload dist/*
33+
#poetry publish
3034

graphene_mongo/converter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import graphene
44
import mongoengine
5-
import uuid
65

76
from graphene.types.json import JSONString
87
from graphene.utils.str_converters import to_snake_case, to_camel_case

graphene_mongo/fields.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import absolute_import
22

3+
import logging
34
from collections import OrderedDict
45
from functools import partial, reduce
56

@@ -515,11 +516,8 @@ def chained_resolver(self, resolver, is_partial, root, info, **args):
515516
args.update(resolved._query)
516517
args_copy = args.copy()
517518
for arg_name, arg in args.copy().items():
518-
if "." in arg_name or arg_name not in (
519-
self.model._fields_ordered +
520-
('first', 'last', 'before', 'after') +
521-
tuple(self.filter_args.keys())
522-
):
519+
if "." in arg_name or arg_name not in self.model._fields_ordered \
520+
+ ('first', 'last', 'before', 'after') + tuple(self.filter_args.keys()):
523521
args_copy.pop(arg_name)
524522
if arg_name == '_id' and isinstance(arg, dict):
525523
operation = list(arg.keys())[0]
@@ -554,8 +552,8 @@ def connection_resolver(cls, resolver, connection_type, root, info, **args):
554552
if value:
555553
try:
556554
setattr(root, key, from_global_id(value)[1])
557-
except Exception:
558-
pass
555+
except Exception as error:
556+
logging.error("Exception Occurred: ", exc_info=error)
559557
iterable = resolver(root, info, **args)
560558

561559
if isinstance(connection_type, graphene.NonNull):

graphene_mongo/tests/test_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import graphene
22
import mongoengine
3-
from py.test import raises
3+
from pytest import raises
44

55
from .models import (
66
Article,

graphene_mongo/tests/test_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from py.test import raises
1+
from pytest import raises
22

33
from graphene import Field, Int, Interface, ObjectType
44
from graphene.relay import Node, is_node

poetry.lock

Lines changed: 1252 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[tool.poetry]
2+
name = "graphene-mongo"
3+
packages = [{ include = "graphene_mongo" }]
4+
version = "0.3.0"
5+
description = "Graphene Mongoengine integration"
6+
authors = [
7+
"Abaw Chen <abaw.chen@gmail.com>",
8+
]
9+
license = "MIT"
10+
readme = "README.md"
11+
homepage = "https://github.com/graphql-python/graphene-mongo"
12+
repository = "https://github.com/graphql-python/graphene-mongo"
13+
classifiers = [
14+
"Development Status :: 4 - Beta",
15+
"Intended Audience :: Developers",
16+
"Topic :: Software Development :: Libraries",
17+
"Programming Language :: Python :: 3.6",
18+
"Programming Language :: Python :: 3.8",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: Implementation :: PyPy",
21+
"License :: OSI Approved :: MIT License",
22+
]
23+
keywords = [
24+
"graphene-mongo", "graphql", "api", "graphql", "protocol", "relay", "graphene", "mongo", "mongoengine"
25+
]
26+
27+
[tool.poetry.dependencies]
28+
python = ">=3.7,<4"
29+
graphene = ">=3.1.1"
30+
promise = ">=2.3"
31+
mongoengine = ">=0.27"
32+
singledispatch = ">=3.7.0"
33+
iso8601 = "*"
34+
35+
[tool.poetry.group.dev.dependencies]
36+
pytest = "*"
37+
mongomock = ">=4.1.2"
38+
mock = ">=5.0.1"
39+
flake8 = "*"
40+
pytest-cov = "*"
41+
coveralls = "*"
42+
twine = "*"
43+
44+
45+
[build-system]
46+
requires = ["poetry-core"]
47+
build-backend = "poetry.core.masonry.api"

requirements.txt

Lines changed: 0 additions & 19 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)