From 2ca659a7840635a6058f032b9c00488534a07820 Mon Sep 17 00:00:00 2001 From: Sabar Dasgupta Date: Mon, 27 Feb 2023 12:54:03 -0800 Subject: [PATCH] docs: update PyPI page (#384) --- README.rst | 102 ----------------------------------------------------- setup.py | 5 ++- 2 files changed, 4 insertions(+), 103 deletions(-) delete mode 100644 README.rst diff --git a/README.rst b/README.rst deleted file mode 100644 index d82b8071..00000000 --- a/README.rst +++ /dev/null @@ -1,102 +0,0 @@ -Please read -`UPGRADE-v2.0.md `__ -to learn how to upgrade to Graphene ``2.0``. - --------------- - -|Graphene Logo| Graphene-SQLAlchemy |Build Status| |PyPI version| |Coverage Status| -=================================================================================== - -A `SQLAlchemy `__ integration for -`Graphene `__. - -Installation ------------- - -For instaling graphene, just run this command in your shell - -.. code:: bash - - pip install "graphene-sqlalchemy>=2.0" - -Examples --------- - -Here is a simple SQLAlchemy model: - -.. code:: python - - from sqlalchemy import Column, Integer, String - from sqlalchemy.orm import backref, relationship - - from sqlalchemy.ext.declarative import declarative_base - - Base = declarative_base() - - class UserModel(Base): - __tablename__ = 'department' - id = Column(Integer, primary_key=True) - name = Column(String) - last_name = Column(String) - -To create a GraphQL schema for it you simply have to write the -following: - -.. code:: python - - from graphene_sqlalchemy import SQLAlchemyObjectType - - class User(SQLAlchemyObjectType): - class Meta: - model = UserModel - - class Query(graphene.ObjectType): - users = graphene.List(User) - - def resolve_users(self, info): - query = User.get_query(info) # SQLAlchemy query - return query.all() - - schema = graphene.Schema(query=Query) - -Then you can simply query the schema: - -.. code:: python - - query = ''' - query { - users { - name, - lastName - } - } - ''' - result = schema.execute(query, context_value={'session': db_session}) - -To learn more check out the following `examples `__: - -- **Full example**: `Flask SQLAlchemy - example `__ - -Contributing ------------- - -After cloning this repo, ensure dependencies are installed by running: - -.. code:: sh - - python setup.py install - -After developing, the full test suite can be evaluated by running: - -.. code:: sh - - python setup.py test # Use --pytest-args="-v -s" for verbose mode - -.. |Graphene Logo| image:: http://graphene-python.org/favicon.png -.. |Build Status| image:: https://travis-ci.org/graphql-python/graphene-sqlalchemy.svg?branch=master - :target: https://travis-ci.org/graphql-python/graphene-sqlalchemy -.. |PyPI version| image:: https://badge.fury.io/py/graphene-sqlalchemy.svg - :target: https://badge.fury.io/py/graphene-sqlalchemy -.. |Coverage Status| image:: https://coveralls.io/repos/graphql-python/graphene-sqlalchemy/badge.svg?branch=master&service=github - :target: https://coveralls.io/github/graphql-python/graphene-sqlalchemy?branch=master diff --git a/setup.py b/setup.py index 9122baf2..ad8bd3b9 100644 --- a/setup.py +++ b/setup.py @@ -34,8 +34,11 @@ name="graphene-sqlalchemy", version=version, description="Graphene SQLAlchemy integration", - long_description=open("README.rst").read(), + long_description=open("README.md").read(), url="https://github.com/graphql-python/graphene-sqlalchemy", + project_urls={ + "Documentation": "https://docs.graphene-python.org/projects/sqlalchemy/en/latest", + }, author="Syrus Akbary", author_email="me@syrusakbary.com", license="MIT",