mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-22 13:59:51 +03:00
Remove redundant files
This commit is contained in:
parent
2e87ebe5fc
commit
c2f2685f7a
|
@ -1,2 +0,0 @@
|
||||||
[run]
|
|
||||||
omit = graphene/pyutils/*,*/tests/*
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -16,6 +16,7 @@ dist/
|
||||||
downloads/
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
.eggs/
|
.eggs/
|
||||||
|
_version.py
|
||||||
lib/
|
lib/
|
||||||
lib64/
|
lib64/
|
||||||
parts/
|
parts/
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[settings]
|
|
||||||
known_third_party = aniso8601,graphql,graphql_relay,promise,pytest,pytz,pyutils,setuptools,snapshottest,sphinx_graphene_theme
|
|
|
@ -1,28 +1,31 @@
|
||||||
repos:
|
repos:
|
||||||
- repo: git://github.com/pre-commit/pre-commit-hooks
|
- repo: git://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v2.1.0
|
rev: v3.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-merge-conflict
|
- id: check-merge-conflict
|
||||||
- id: check-json
|
- id: check-json
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: debug-statements
|
- id: debug-statements
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
exclude: ^docs/.*$
|
exclude: ^docs/.*$
|
||||||
- id: pretty-format-json
|
- id: pretty-format-json
|
||||||
args:
|
args:
|
||||||
- --autofix
|
- --autofix
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
exclude: README.md
|
exclude: README.md
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v1.12.0
|
rev: v2.9.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
- repo: https://github.com/ambv/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 19.10b0
|
rev: 20.8b1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
language_version: python3
|
- repo: https://github.com/PyCQA/flake8
|
||||||
- repo: https://github.com/PyCQA/flake8
|
rev: 3.8.4
|
||||||
rev: 3.7.8
|
hooks:
|
||||||
hooks:
|
- id: flake8
|
||||||
- id: flake8
|
- repo: https://github.com/pycqa/isort
|
||||||
|
rev: 5.6.4
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
|
10
.travis.yml
10
.travis.yml
|
@ -1,10 +1,12 @@
|
||||||
language: python
|
language: python
|
||||||
dist: xenial
|
dist: focal
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- "3.6"
|
- "3.6"
|
||||||
- "3.7"
|
- "3.7"
|
||||||
- "3.8"
|
- "3.8"
|
||||||
|
- "3.9"
|
||||||
|
- "nightly"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install tox tox-travis
|
- pip install tox tox-travis
|
||||||
|
@ -13,9 +15,7 @@ after_success:
|
||||||
- pip install coveralls
|
- pip install coveralls
|
||||||
- coveralls
|
- coveralls
|
||||||
cache:
|
cache:
|
||||||
directories:
|
- pip
|
||||||
- $HOME/.cache/pip
|
|
||||||
- $HOME/.cache/pre-commit
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
|
@ -23,6 +23,8 @@ stages:
|
||||||
if: tag IS present
|
if: tag IS present
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
allow_failures:
|
||||||
|
- python: "nightly"
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- env: TOXENV=pre-commit
|
- env: TOXENV=pre-commit
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
global-exclude tests/*
|
global-exclude tests/*
|
||||||
recursive-exclude tests *
|
recursive-exclude tests *
|
||||||
recursive-exclude tests_py35 *
|
|
||||||
recursive-exclude examples *
|
recursive-exclude examples *
|
||||||
include LICENSE
|
include LICENSE
|
||||||
|
|
10
README.md
10
README.md
|
@ -24,11 +24,11 @@
|
||||||
|
|
||||||
Graphene has multiple integrations with different frameworks:
|
Graphene has multiple integrations with different frameworks:
|
||||||
|
|
||||||
| integration | Package |
|
| integration | Package |
|
||||||
| ----------------- | --------------------------------------------------------------------------------------- |
|
| ----------------- | ----------------------------------------------------------------------------- |
|
||||||
| Django | [graphene-django](https://github.com/graphql-python/graphene-django/) |
|
| Django | [graphene-django](https://github.com/graphql-python/graphene-django/) |
|
||||||
| SQLAlchemy | [graphene-sqlalchemy](https://github.com/graphql-python/graphene-sqlalchemy/) |
|
| SQLAlchemy | [graphene-sqlalchemy](https://github.com/graphql-python/graphene-sqlalchemy/) |
|
||||||
| Google App Engine | [graphene-gae](https://github.com/graphql-python/graphene-gae/) |
|
| Google App Engine | [graphene-gae](https://github.com/graphql-python/graphene-gae/) |
|
||||||
|
|
||||||
Also, Graphene is fully compatible with the GraphQL spec, working seamlessly with all GraphQL clients, such as [Relay](https://github.com/facebook/relay), [Apollo](https://github.com/apollographql/apollo-client) and [gql](https://github.com/graphql-python/gql).
|
Also, Graphene is fully compatible with the GraphQL spec, working seamlessly with all GraphQL clients, such as [Relay](https://github.com/facebook/relay), [Apollo](https://github.com/apollographql/apollo-client) and [gql](https://github.com/graphql-python/gql).
|
||||||
|
|
||||||
|
|
179
README.rst
179
README.rst
|
@ -1,179 +0,0 @@
|
||||||
**We are looking for contributors**! Please check the
|
|
||||||
`ROADMAP <https://github.com/graphql-python/graphene/blob/master/ROADMAP.md>`__
|
|
||||||
to see how you can help ❤️
|
|
||||||
|
|
||||||
--------------
|
|
||||||
|
|
||||||
|Graphene Logo| `Graphene <http://graphene-python.org>`__ |Build Status| |PyPI version| |Coverage Status|
|
|
||||||
=========================================================================================================
|
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
|
||||||
------------
|
|
||||||
|
|
||||||
`Graphene <http://graphene-python.org>`__ is a Python library for
|
|
||||||
building GraphQL schemas/types fast and easily.
|
|
||||||
|
|
||||||
- **Easy to use:** Graphene helps you use GraphQL in Python without
|
|
||||||
effort.
|
|
||||||
- **Relay:** Graphene has builtin support for Relay.
|
|
||||||
- **Data agnostic:** Graphene supports any kind of data source: SQL
|
|
||||||
(Django, SQLAlchemy), NoSQL, custom Python objects, etc. We believe
|
|
||||||
that by providing a complete API you could plug Graphene anywhere
|
|
||||||
your data lives and make your data available through GraphQL.
|
|
||||||
|
|
||||||
Integrations
|
|
||||||
------------
|
|
||||||
|
|
||||||
Graphene has multiple integrations with different frameworks:
|
|
||||||
|
|
||||||
+---------------------+----------------------------------------------------------------------------------------------+
|
|
||||||
| integration | Package |
|
|
||||||
+=====================+==============================================================================================+
|
|
||||||
| Django | `graphene-django <https://github.com/graphql-python/graphene-django/>`__ |
|
|
||||||
+---------------------+----------------------------------------------------------------------------------------------+
|
|
||||||
| SQLAlchemy | `graphene-sqlalchemy <https://github.com/graphql-python/graphene-sqlalchemy/>`__ |
|
|
||||||
+---------------------+----------------------------------------------------------------------------------------------+
|
|
||||||
| Google App Engine | `graphene-gae <https://github.com/graphql-python/graphene-gae/>`__ |
|
|
||||||
+---------------------+----------------------------------------------------------------------------------------------+
|
|
||||||
| Peewee | *In progress* (`Tracking Issue <https://github.com/graphql-python/graphene/issues/289>`__) |
|
|
||||||
+---------------------+----------------------------------------------------------------------------------------------+
|
|
||||||
|
|
||||||
Also, Graphene is fully compatible with the GraphQL spec, working
|
|
||||||
seamlessly with all GraphQL clients, such as
|
|
||||||
`Relay <https://github.com/facebook/relay>`__,
|
|
||||||
`Apollo <https://github.com/apollographql/apollo-client>`__ and
|
|
||||||
`gql <https://github.com/graphql-python/gql>`__.
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
For instaling graphene, just run this command in your shell
|
|
||||||
|
|
||||||
.. code:: bash
|
|
||||||
|
|
||||||
pip install "graphene>=2.0"
|
|
||||||
|
|
||||||
2.0 Upgrade Guide
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Please read `UPGRADE-v2.0.md </UPGRADE-v2.0.md>`__ to learn how to
|
|
||||||
upgrade.
|
|
||||||
|
|
||||||
Examples
|
|
||||||
--------
|
|
||||||
|
|
||||||
Here is one example for you to get started:
|
|
||||||
|
|
||||||
.. code:: python
|
|
||||||
|
|
||||||
import graphene
|
|
||||||
|
|
||||||
class Query(graphene.ObjectType):
|
|
||||||
hello = graphene.String(description='A typical hello world')
|
|
||||||
|
|
||||||
def resolve_hello(self, info):
|
|
||||||
return 'World'
|
|
||||||
|
|
||||||
schema = graphene.Schema(query=Query)
|
|
||||||
|
|
||||||
Then Querying ``graphene.Schema`` is as simple as:
|
|
||||||
|
|
||||||
.. code:: python
|
|
||||||
|
|
||||||
query = '''
|
|
||||||
query SayHello {
|
|
||||||
hello
|
|
||||||
}
|
|
||||||
'''
|
|
||||||
result = schema.execute(query)
|
|
||||||
|
|
||||||
If you want to learn even more, you can also check the following
|
|
||||||
`examples <examples/>`__:
|
|
||||||
|
|
||||||
- **Basic Schema**: `Starwars example <examples/starwars>`__
|
|
||||||
- **Relay Schema**: `Starwars Relay
|
|
||||||
example <examples/starwars_relay>`__
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
Documentation and links to additional resources are available at
|
|
||||||
https://docs.graphene-python.org/en/latest/
|
|
||||||
|
|
||||||
Contributing
|
|
||||||
------------
|
|
||||||
|
|
||||||
After cloning this repo, create a
|
|
||||||
`virtualenv <https://virtualenv.pypa.io/en/stable/>`__ and ensure
|
|
||||||
dependencies are installed by running:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
virtualenv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
pip install -e ".[test]"
|
|
||||||
|
|
||||||
Well-written tests and maintaining good test coverage is important to
|
|
||||||
this project. While developing, run new and existing tests with:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
py.test graphene/relay/tests/test_node.py # Single file
|
|
||||||
py.test graphene/relay # All tests in directory
|
|
||||||
|
|
||||||
Add the ``-s`` flag if you have introduced breakpoints into the code for
|
|
||||||
debugging. Add the ``-v`` ("verbose") flag to get more detailed test
|
|
||||||
output. For even more detailed output, use ``-vv``. Check out the
|
|
||||||
`pytest documentation <https://docs.pytest.org/en/latest/>`__ for more
|
|
||||||
options and test running controls.
|
|
||||||
|
|
||||||
You can also run the benchmarks with:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
py.test graphene --benchmark-only
|
|
||||||
|
|
||||||
Graphene supports several versions of Python. To make sure that changes
|
|
||||||
do not break compatibility with any of those versions, we use ``tox`` to
|
|
||||||
create virtualenvs for each Python version and run tests with that
|
|
||||||
version. To run against all Python versions defined in the ``tox.ini``
|
|
||||||
config file, just run:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
tox
|
|
||||||
|
|
||||||
If you wish to run against a specific version defined in the ``tox.ini``
|
|
||||||
file:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
tox -e py36
|
|
||||||
|
|
||||||
Tox can only use whatever versions of Python are installed on your
|
|
||||||
system. When you create a pull request, Travis will also be running the
|
|
||||||
same tests and report the results, so there is no need for potential
|
|
||||||
contributors to try to install every single version of Python on their
|
|
||||||
own system ahead of time. We appreciate opening issues and pull requests
|
|
||||||
to make graphene even more stable & useful!
|
|
||||||
|
|
||||||
Building Documentation
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
The documentation is generated using the excellent
|
|
||||||
`Sphinx <http://www.sphinx-doc.org/>`__ and a custom theme.
|
|
||||||
|
|
||||||
An HTML version of the documentation is produced by running:
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
make docs
|
|
||||||
|
|
||||||
.. |Graphene Logo| image:: http://graphene-python.org/favicon.png
|
|
||||||
.. |Build Status| image:: https://travis-ci.org/graphql-python/graphene.svg?branch=master
|
|
||||||
:target: https://travis-ci.org/graphql-python/graphene
|
|
||||||
.. |PyPI version| image:: https://badge.fury.io/py/graphene.svg
|
|
||||||
:target: https://badge.fury.io/py/graphene
|
|
||||||
.. |Coverage Status| image:: https://coveralls.io/repos/graphql-python/graphene/badge.svg?branch=master&service=github
|
|
||||||
:target: https://coveralls.io/github/graphql-python/graphene?branch=master
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Install the required scripts with
|
|
||||||
# pip install autoflake autopep8 isort
|
|
||||||
autoflake ./examples/ ./graphene/ -r --remove-unused-variables --remove-all-unused-imports --in-place
|
|
||||||
autopep8 ./examples/ ./graphene/ -r --in-place --experimental --aggressive --max-line-length 120
|
|
||||||
isort -rc ./examples/ ./graphene/
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
pandoc README.md --from markdown --to rst -s -o README.rst
|
|
|
@ -1,4 +1,4 @@
|
||||||
from .pyutils.version import get_version
|
from ._version import __version__
|
||||||
from .relay import (
|
from .relay import (
|
||||||
ClientIDMutation,
|
ClientIDMutation,
|
||||||
Connection,
|
Connection,
|
||||||
|
@ -41,11 +41,6 @@ from .types import (
|
||||||
from .utils.module_loading import lazy_import
|
from .utils.module_loading import lazy_import
|
||||||
from .utils.resolve_only_args import resolve_only_args
|
from .utils.resolve_only_args import resolve_only_args
|
||||||
|
|
||||||
VERSION = (3, 0, 0, "beta", 7)
|
|
||||||
|
|
||||||
|
|
||||||
__version__ = get_version(VERSION)
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"__version__",
|
"__version__",
|
||||||
"Argument",
|
"Argument",
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import datetime
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
|
|
||||||
def get_version(version=None):
|
|
||||||
"Returns a PEP 440-compliant version number from VERSION."
|
|
||||||
version = get_complete_version(version)
|
|
||||||
|
|
||||||
# Now build the two parts of the version number:
|
|
||||||
# main = X.Y[.Z]
|
|
||||||
# sub = .devN - for pre-alpha releases
|
|
||||||
# | {a|b|rc}N - for alpha, beta, and rc releases
|
|
||||||
|
|
||||||
main = get_main_version(version)
|
|
||||||
|
|
||||||
sub = ""
|
|
||||||
if version[3] == "alpha" and version[4] == 0:
|
|
||||||
git_changeset = get_git_changeset()
|
|
||||||
if git_changeset:
|
|
||||||
sub = ".dev%s" % git_changeset
|
|
||||||
else:
|
|
||||||
sub = ".dev"
|
|
||||||
elif version[3] != "final":
|
|
||||||
mapping = {"alpha": "a", "beta": "b", "rc": "rc"}
|
|
||||||
sub = mapping[version[3]] + str(version[4])
|
|
||||||
|
|
||||||
return str(main + sub)
|
|
||||||
|
|
||||||
|
|
||||||
def get_main_version(version=None):
|
|
||||||
"Returns main version (X.Y[.Z]) from VERSION."
|
|
||||||
version = get_complete_version(version)
|
|
||||||
parts = 2 if version[2] == 0 else 3
|
|
||||||
return ".".join(str(x) for x in version[:parts])
|
|
||||||
|
|
||||||
|
|
||||||
def get_complete_version(version=None):
|
|
||||||
"""Returns a tuple of the graphene version. If version argument is non-empty,
|
|
||||||
then checks for correctness of the tuple provided.
|
|
||||||
"""
|
|
||||||
if version is None:
|
|
||||||
from graphene import VERSION as version
|
|
||||||
else:
|
|
||||||
assert len(version) == 5
|
|
||||||
assert version[3] in ("alpha", "beta", "rc", "final")
|
|
||||||
|
|
||||||
return version
|
|
||||||
|
|
||||||
|
|
||||||
def get_docs_version(version=None):
|
|
||||||
version = get_complete_version(version)
|
|
||||||
if version[3] != "final":
|
|
||||||
return "dev"
|
|
||||||
else:
|
|
||||||
return "%d.%d" % version[:2]
|
|
||||||
|
|
||||||
|
|
||||||
def get_git_changeset():
|
|
||||||
"""Returns a numeric identifier of the latest git changeset.
|
|
||||||
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
|
|
||||||
This value isn't guaranteed to be unique, but collisions are very unlikely,
|
|
||||||
so it's sufficient for generating the development version numbers.
|
|
||||||
"""
|
|
||||||
repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
try:
|
|
||||||
git_log = subprocess.Popen(
|
|
||||||
"git log --pretty=format:%ct --quiet -1 HEAD",
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
shell=True,
|
|
||||||
cwd=repo_dir,
|
|
||||||
universal_newlines=True,
|
|
||||||
)
|
|
||||||
timestamp = git_log.communicate()[0]
|
|
||||||
timestamp = datetime.datetime.utcfromtimestamp(int(timestamp))
|
|
||||||
except:
|
|
||||||
return None
|
|
||||||
return timestamp.strftime("%Y%m%d%H%M%S")
|
|
|
@ -1,13 +1,10 @@
|
||||||
|
from dataclasses import field, make_dataclass
|
||||||
|
|
||||||
from .base import BaseOptions, BaseType, BaseTypeMeta
|
from .base import BaseOptions, BaseType, BaseTypeMeta
|
||||||
from .field import Field
|
from .field import Field
|
||||||
from .interface import Interface
|
from .interface import Interface
|
||||||
from .utils import yank_fields_from_attrs
|
from .utils import yank_fields_from_attrs
|
||||||
|
|
||||||
try:
|
|
||||||
from dataclasses import make_dataclass, field
|
|
||||||
except ImportError:
|
|
||||||
from ..pyutils.dataclasses import make_dataclass, field # type: ignore
|
|
||||||
|
|
||||||
# For static type checking with Mypy
|
# For static type checking with Mypy
|
||||||
MYPY = False
|
MYPY = False
|
||||||
if MYPY:
|
if MYPY:
|
||||||
|
@ -28,7 +25,11 @@ class ObjectTypeMeta(BaseTypeMeta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
base_cls = super().__new__(
|
base_cls = super().__new__(
|
||||||
cls, name_, (InterObjectType,) + bases, namespace, **options,
|
cls,
|
||||||
|
name_,
|
||||||
|
(InterObjectType,) + bases,
|
||||||
|
namespace,
|
||||||
|
**options,
|
||||||
)
|
)
|
||||||
if base_cls._meta:
|
if base_cls._meta:
|
||||||
fields = [
|
fields = [
|
||||||
|
|
17
mypy.ini
17
mypy.ini
|
@ -1,17 +0,0 @@
|
||||||
[mypy]
|
|
||||||
ignore_missing_imports = True
|
|
||||||
|
|
||||||
[mypy-graphene.pyutils.*]
|
|
||||||
ignore_errors = True
|
|
||||||
|
|
||||||
[mypy-graphene.types.scalars]
|
|
||||||
ignore_errors = True
|
|
||||||
|
|
||||||
[mypy-graphene.types.generic]
|
|
||||||
ignore_errors = True
|
|
||||||
|
|
||||||
[mypy-graphene.types.tests.*]
|
|
||||||
ignore_errors = True
|
|
||||||
|
|
||||||
[mypy-graphene.relay.tests.*]
|
|
||||||
ignore_errors = True
|
|
19
setup.cfg
19
setup.cfg
|
@ -6,7 +6,26 @@ max-line-length = 120
|
||||||
omit = graphene/pyutils/*,*/tests/*,graphene/types/scalars.py
|
omit = graphene/pyutils/*,*/tests/*,graphene/types/scalars.py
|
||||||
|
|
||||||
[isort]
|
[isort]
|
||||||
|
profile = black
|
||||||
known_first_party=graphene
|
known_first_party=graphene
|
||||||
|
|
||||||
|
[mypy]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-graphene.pyutils.*]
|
||||||
|
ignore_errors = True
|
||||||
|
|
||||||
|
[mypy-graphene.types.scalars]
|
||||||
|
ignore_errors = True
|
||||||
|
|
||||||
|
[mypy-graphene.types.generic]
|
||||||
|
ignore_errors = True
|
||||||
|
|
||||||
|
[mypy-graphene.types.tests.*]
|
||||||
|
ignore_errors = True
|
||||||
|
|
||||||
|
[mypy-graphene.relay.tests.*]
|
||||||
|
ignore_errors = True
|
||||||
|
|
||||||
[bdist_wheel]
|
[bdist_wheel]
|
||||||
universal=1
|
universal=1
|
||||||
|
|
67
setup.py
67
setup.py
|
@ -1,48 +1,6 @@
|
||||||
import ast
|
from pathlib import Path
|
||||||
import codecs
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
from setuptools.command.test import test as TestCommand
|
|
||||||
|
|
||||||
_version_re = re.compile(r"VERSION\s+=\s+(.*)")
|
|
||||||
|
|
||||||
with open("graphene/__init__.py", "rb") as f:
|
|
||||||
version = ast.literal_eval(_version_re.search(f.read().decode("utf-8")).group(1))
|
|
||||||
|
|
||||||
path_copy = sys.path[:]
|
|
||||||
|
|
||||||
sys.path.append("graphene")
|
|
||||||
try:
|
|
||||||
from pyutils.version import get_version
|
|
||||||
|
|
||||||
version = get_version(version)
|
|
||||||
except Exception:
|
|
||||||
version = ".".join([str(v) for v in version])
|
|
||||||
|
|
||||||
sys.path[:] = path_copy
|
|
||||||
|
|
||||||
|
|
||||||
class PyTest(TestCommand):
|
|
||||||
user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]
|
|
||||||
|
|
||||||
def initialize_options(self):
|
|
||||||
TestCommand.initialize_options(self)
|
|
||||||
self.pytest_args = []
|
|
||||||
|
|
||||||
def finalize_options(self):
|
|
||||||
TestCommand.finalize_options(self)
|
|
||||||
self.test_args = []
|
|
||||||
self.test_suite = True
|
|
||||||
|
|
||||||
def run_tests(self):
|
|
||||||
# import here, cause outside the eggs aren't loaded
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
errno = pytest.main(self.pytest_args)
|
|
||||||
sys.exit(errno)
|
|
||||||
|
|
||||||
|
|
||||||
tests_require = [
|
tests_require = [
|
||||||
"pytest>=5.3,<6",
|
"pytest>=5.3,<6",
|
||||||
|
@ -55,38 +13,43 @@ tests_require = [
|
||||||
"promise>=2.3,<3",
|
"promise>=2.3,<3",
|
||||||
"mock>=4.0,<5",
|
"mock>=4.0,<5",
|
||||||
"pytz==2019.3",
|
"pytz==2019.3",
|
||||||
"iso8601>=0.1,<2",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
dev_requires = ["black==19.10b0", "flake8>=3.7,<4"] + tests_require
|
dev_requires = ["black==20.8b1", "flake8>=3.7,<4"] + tests_require
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="graphene",
|
name="graphene",
|
||||||
version=version,
|
|
||||||
description="GraphQL Framework for Python",
|
description="GraphQL Framework for Python",
|
||||||
long_description=codecs.open(
|
long_description=Path("README.md").read_text(encoding="utf-8"),
|
||||||
"README.rst", "r", encoding="ascii", errors="replace"
|
long_description_content_type="text/markdown",
|
||||||
).read(),
|
|
||||||
url="https://github.com/graphql-python/graphene",
|
url="https://github.com/graphql-python/graphene",
|
||||||
author="Syrus Akbary",
|
author="Syrus Akbary",
|
||||||
author_email="me@syrusakbary.com",
|
author_email="me@syrusakbary.com",
|
||||||
license="MIT",
|
license="MIT",
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 3 - Beta",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"Topic :: Software Development :: Libraries",
|
"Topic :: Software Development :: Libraries",
|
||||||
|
"Programming Language :: Python ",
|
||||||
|
"Programming Language :: Python :: Only",
|
||||||
"Programming Language :: Python :: 3.6",
|
"Programming Language :: Python :: 3.6",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
],
|
],
|
||||||
keywords="api graphql protocol rest relay graphene",
|
keywords="api graphql protocol rest relay graphene",
|
||||||
packages=find_packages(exclude=["examples*"]),
|
packages=find_packages(exclude=["examples"]),
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"graphql-core>=3.1.2,<4",
|
"graphql-core>=3.1.2,<4",
|
||||||
"graphql-relay>=3.0,<4",
|
"graphql-relay>=3.0,<4",
|
||||||
"aniso8601>=8,<9",
|
"aniso8601>=8,<9",
|
||||||
|
"dataclasses>=0.8;python_version<'3.7'",
|
||||||
],
|
],
|
||||||
|
use_scm_version={
|
||||||
|
"write_to": "graphene/_version.py",
|
||||||
|
"write_to_template": "__version__ = '{version}'\n",
|
||||||
|
},
|
||||||
|
setup_requires=["setuptools_scm", "wheel"],
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
extras_require={"test": tests_require, "dev": dev_requires},
|
extras_require={"test": tests_require, "dev": dev_requires},
|
||||||
cmdclass={"test": PyTest},
|
|
||||||
)
|
)
|
||||||
|
|
19
tox.ini
19
tox.ini
|
@ -1,14 +1,10 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = flake8,py36,py37,py38,pre-commit,mypy
|
envlist = flake8, py36, py37, py38, py39, pre-commit, mypy
|
||||||
skipsdist = true
|
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
extras = test
|
||||||
.[test]
|
|
||||||
setenv =
|
|
||||||
PYTHONPATH = .:{envdir}
|
|
||||||
commands =
|
commands =
|
||||||
py{36,37,38}: pytest --cov=graphene graphene examples {posargs}
|
py{36,37,38,39}: pytest --cov=graphene graphene examples {posargs}
|
||||||
|
|
||||||
[testenv:pre-commit]
|
[testenv:pre-commit]
|
||||||
basepython=python3.7
|
basepython=python3.7
|
||||||
|
@ -17,21 +13,18 @@ deps =
|
||||||
setenv =
|
setenv =
|
||||||
LC_CTYPE=en_US.UTF-8
|
LC_CTYPE=en_US.UTF-8
|
||||||
commands =
|
commands =
|
||||||
pre-commit {posargs:run --all-files}
|
pre-commit {posargs:run --all-files --show-diff-on-failure}
|
||||||
|
|
||||||
[testenv:mypy]
|
[testenv:mypy]
|
||||||
basepython=python3.7
|
basepython=python3.7
|
||||||
deps =
|
deps =
|
||||||
mypy>=0.761,<1
|
mypy>=0.800,<1
|
||||||
commands =
|
commands =
|
||||||
mypy graphene
|
mypy graphene
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
basepython=python3.7
|
basepython=python3.7
|
||||||
deps =
|
deps =
|
||||||
flake8>=3.7,<4
|
flake8>=3.8,<4
|
||||||
commands =
|
commands =
|
||||||
pip install --pre -e .
|
|
||||||
flake8 graphene
|
flake8 graphene
|
||||||
|
|
||||||
[pytest]
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user