Skip to content

Commit

Permalink
WIP Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
AWhetter committed Jul 8, 2023
1 parent 1e4c9bc commit da4bb5a
Show file tree
Hide file tree
Showing 49 changed files with 2,775 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: tests

on:
- push
- pull_request

jobs:
test:
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install tox tox-gh-actions
- name: Run tests
run: tox
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.egg-info
*.pyc
.mypy_cache/
.pytest_cache/
.ruff_cache/
.tox/
_build
build/
dist/
__pycache__/
13 changes: 13 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

python:
install:
- method: pip
path: .
extra_requirements:
- doc
Empty file added CHANGELOG.rst
Empty file.
26 changes: 26 additions & 0 deletions LICENSE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
The MIT License (MIT)
=====================

Copyright (c) 2023 Ashley Whetter

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

103 changes: 103 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
graphql2sphinx
==============

.. image:: https://readthedocs.org/projects/graphql2sphinx/badge/?version=latest
:target: https://graphql2sphinx.readthedocs.org
:alt: Documentation

.. image:: https://github.com/AWhetter/graphql2sphinx/actions/workflows/main.yml/badge.svg?branch=main
:target: https://github.com/AWhetter/graphql2sphinx/actions/workflows/main.yml?query=branch%3Amain
:alt: Github Build Status

.. image:: https://img.shields.io/pypi/v/graphql2sphinx.svg
:target: https://pypi.org/project/graphql2sphinx/
:alt: PyPI Version

.. image:: https://img.shields.io/pypi/pyversions/graphql2sphinx.svg
:target: https://pypi.org/project/graphql2sphinx/
:alt: Supported Python Versions

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/python/black
:alt: Formatted with Black

A Sphinx extension for automatically documenting GraphQL schemas.


Getting Started
---------------

The following steps will walk through how to add ``graphql2sphinx`` to an existing Sphinx project.
For instructions on how to set up a Sphinx project,
see Sphinx's documentation on
`Getting Started <https://www.sphinx-doc.org/en/master/usage/quickstart.html>`_.


Installation
~~~~~~~~~~~~

``graphql2sphinx`` can be installed through pip:

.. code-block:: bash
pip install graphql2sphinx
Next, add ``graphql2sphinx`` to the ``extensions`` list in your Sphinx project's `conf.py`.

.. code-block:: python
extensions.append("graphql2sphinx")
Usage
-----

Each directive accepts a small snippet of the original schema.
For more detailed usage, see the documentation:
https://graphql2sphinx.readthedocs.io/en/latest/

TODO

Contributing
------------


Running the tests
~~~~~~~~~~~~~~~~~

Tests are executed through `tox <https://tox.readthedocs.io/en/latest/>`_.

.. code-block:: bash
tox
Code Style
~~~~~~~~~~

Code is formatted using `black <https://github.com/python/black>`_.

You can check your formatting using black's check mode:

.. code-block:: bash
tox -e formatting
You can also get black to format your changes for you:

.. code-block:: bash
black graphql2sphinx.py tests/
Versioning
----------

We use `SemVer <https://semver.org/>`_ for versioning. For the versions available, see the `tags on this repository <https://github.com/AWhetter/graphql2sphinx/tags>`_.


License
-------

This project is licensed under the MIT License.
See the `LICENSE.rst <LICENSE.rst>`_ file for details.
Empty file added doc/changes/.gitkeep
Empty file.
45 changes: 45 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'graphql2sphinx'
copyright = '2023, Ashley Whetter'
author = 'Ashley Whetter'
release = '0.1.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'graphql2sphinx',
'sphinx.ext.intersphinx',
]

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'furo'
html_static_path = ['_static']


# -- Options for intersphinx -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration

intersphinx_mapping = {
'sphinx': ('https://www.sphinx-doc.org/en/master', None),
}


def setup(app):
app.add_object_type('confval', 'confval',
objname='configuration value',
indextemplate='pair: %s; configuration value')
Loading

0 comments on commit da4bb5a

Please sign in to comment.