Skip to content

Commit

Permalink
Make minor improvements for CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
eamigo86 committed Jul 10, 2019
1 parent d9a0cc2 commit bfeb51b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ matrix:
include:
- { python: "3.6", env: DJANGO=2.0 }
- { python: "3.6", env: DJANGO=2.1 }
- { python: "3.6", env: DJANGO=2.2 }

- { python: "3.7", env: DJANGO=2.0 }
- { python: "3.7", env: DJANGO=2.1 }
- { python: "3.7", env: DJANGO=2.2 }

- { python: "3.6", env: TOXENV=quality }
- { python: "3.7", env: TOXENV=quality }

before_install:
- pip install codecov
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Ernesto Perez
Copyright (c) 2017 Ernesto Perez Amigo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
[![pypi-version]][pypi]
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)


[build-status-image]: https://secure.travis-ci.org/encode/graphene-django-extras.svg?branch=master
[travis]: https://travis-ci.org/eamigo86/graphene-django-extras?branch=master
[build-status-image]: https://travis-ci.org/eamigo86/graphene-django-extras.svg?branch=master
[travis]: https://travis-ci.org/eamigo86/graphene-django-extras
[coverage-status-image]: https://img.shields.io/codecov/c/gh/encode/graphene-django-extras/master.svg
[codecov]: https://codecov.io/gh/eamigo86/graphene-django-extras?branch=master
[pypi-version]: https://img.shields.io/pypi/v/graphene_django_extras.svg
[pypi]: https://pypi.org/project/graphene_django_extras/

This package add some extra functionalities to graphene-django to facilitate the graphql use without Relay:
1. Allows pagination and filtering on Queries.
2. Allows to define DjangoRestFramework serializers based Mutations.
3. Allows use Directives on Queries and Fragments.
This package adds some extra functionalities to graphene-django to facilitate the graphql use without Relay:
1. Allow pagination and filtering on Queries.
2. Allow defining DjangoRestFramework serializers based on Mutations.
3. Allow using Directives on Queries and Fragments.

**NOTE:** Subscription support was moved to [graphene-django-subscriptions](https://github.com/eamigo86/graphene-django-subscriptions).

Expand Down Expand Up @@ -190,12 +189,18 @@ class Queries(graphene.ObjectType):
user1 = UserListType.RetrieveField(description='User List with pagination and filtering')

# Exist two ways to define single or list user queries with DjangoSerializerType
user_retrieve1, user_list1 = UserModelType.QueryFields(description='Some description message for both queries',
deprecation_reason='Some deprecation message for both queries')
user_retrieve2 = UserModelType.RetrieveField(description='Some description message for retrieve query',
deprecation_reason='Some deprecation message for retrieve query')
user_list2 = UserModelType.ListField(description='Some description message for list query',
deprecation_reason='Some deprecation message for list query')
user_retrieve1, user_list1 = UserModelType.QueryFields(
description='Some description message for both queries',
deprecation_reason='Some deprecation message for both queries'
)
user_retrieve2 = UserModelType.RetrieveField(
description='Some description message for retrieve query',
deprecation_reason='Some deprecation message for retrieve query'
)
user_list2 = UserModelType.ListField(
description='Some description message for list query',
deprecation_reason='Some deprecation message for list query'
)

class Mutations(graphene.ObjectType):
user_create = UserSerializerMutation.CreateField(deprecation_reason='Some one deprecation message')
Expand All @@ -205,7 +210,8 @@ class Mutations(graphene.ObjectType):
# Exist two ways to define mutations with DjangoSerializerType
user_create1, user_delete1, user_update1 = UserModelType.MutationFields(
description='Some description message for create, delete and update mutations',
deprecation_reason='Some deprecation message for create, delete and update mutations')
deprecation_reason='Some deprecation message for create, delete and update mutations'
)

user_create2 = UserModelType.CreateField(description='Description message for create')
user_delete2 = UserModelType.DeleteField(description='Description message for delete')
Expand All @@ -230,8 +236,8 @@ GRAPHENE = {
}
```

2. You must add the *directives* param with yours custom directives to your schema definition. This module come with
some common directives for you, this directives allow to you format strings, numbers, lists, and dates (optional), and
2. You must add the *directives* param with your custom directives to your schema definition. This module comes with
some common directives for you, these directives allow to you format strings, numbers, lists, and dates (optional), and
you can load like this:

```python
Expand All @@ -244,7 +250,7 @@ schema = graphene.Schema(
directives=all_directives
)
```
**NOTE**: Date directive depends of *dateutil* module, so if you do not have installed it, this directive will not be
**NOTE**: Date directive depends on *dateutil* module, so if you do not have installed it, this directive will not be
available. You can install *dateutil* module manually:
```
pip install python-dateutil
Expand Down Expand Up @@ -290,7 +296,7 @@ versa.
12. **StripGraphQLDirective**: Take a optional 'chars' string argument(default=" ").
Return the taken string with the leading and trailing characters removed. The 'chars' argument is not a prefix or
suffix; rather, all combinations of its values are stripped.
13. **TitleCaseGraphQLDirective**: Return the taken string titlecased, where words start with an uppercase character
13. **TitleCaseGraphQLDirective**: Return the taken string title-cased, where words start with an uppercase character
and the remaining characters are lowercase.
14. **CenterGraphQLDirective**: Take a 'width' string argument and a optional 'fillchar' string argument(default=" ").
Return the taken string centered with the 'width' argument as new length. Padding is done using the specified
Expand Down Expand Up @@ -477,7 +483,7 @@ And we get this output data:
}
}
```
As we see, the directives is a easy way to format output data on queries, and it's can be put together like a chain.
As we see, the directives are an easy way to format output data on queries, and it's can be put together like a chain.

**List of possible date's tokens**:
"YYYY", "YY", "WW", "W", "DD", "DDDD", "d", "ddd", "dddd", "MM", "MMM", "MMMM", "HH", "hh", "mm", "ss", "A", "ZZ", "z".
Expand Down
1 change: 1 addition & 0 deletions tests/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
DjangoFilterListField,
)
from graphene_django_extras.paginations import LimitOffsetGraphqlPagination

# from . import serializers
from . import filtersets

Expand Down
34 changes: 26 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ isolated_build = true
envlist =
{py36, py37}-django20,
{py36, py37}-django21,
{py36, py37}-django22,
quality

[travis:env]
DJANGO =
2.0: django20
2.1: django21
2.2: django22

[testenv]
whitelist_externals = poetry
Expand All @@ -17,36 +19,52 @@ commands =
poetry install -v
poetry run pytest tests/ --cov=graphene_django_extras

[testenv:py35-django20]
[testenv:py36-django20]
whitelist_externals = poetry
skip_install = true
commands =
poetry install -v
poetry run pip install 'django<=2.1'
poetry run pip install 'django~=2.0'
poetry run pytest tests/ --cov=graphene_django_extras

[testenv:py35-django21]
[testenv:py36-django21]
whitelist_externals = poetry
skip_install = true
commands =
poetry install -v
poetry run pip install 'django<=2.2'
poetry run pip install 'django~=2.1'
poetry run pytest tests/ --cov=graphene_django_extras

[testenv:py36-django20]
[testenv:py36-django22]
whitelist_externals = poetry
skip_install = true
commands =
poetry install -v
poetry run pip install 'django<=2.1'
poetry run pip install 'django~=2.2'
poetry run pytest tests/ --cov=graphene_django_extras

[testenv:py36-django21]
[testenv:py37-django20]
whitelist_externals = poetry
skip_install = true
commands =
poetry install -v
poetry run pip install 'django~=2.0'
poetry run pytest tests/ --cov=graphene_django_extras

[testenv:py37-django21]
whitelist_externals = poetry
skip_install = true
commands =
poetry install -v
poetry run pip install 'django~=2.1'
poetry run pytest tests/ --cov=graphene_django_extras

[testenv:py37-django22]
whitelist_externals = poetry
skip_install = true
commands =
poetry install -v
poetry run pip install 'django<=2.2'
poetry run pip install 'django~=2.2'
poetry run pytest tests/ --cov=graphene_django_extras

[testenv:quality]
Expand Down

0 comments on commit bfeb51b

Please sign in to comment.