Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
See #1
  • Loading branch information
Xander Harris committed Feb 3, 2023
1 parent 7a4fa3f commit 0455dc2
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 55 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
9 changes: 9 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]
jupyter = "*"
20 changes: 20 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 0 additions & 52 deletions README.rst

This file was deleted.

59 changes: 59 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Sphinx JSON Domain

![https://pypi.python.org/pypi/sphinx-jsondomain](https://img.shields.io/pypi/v/sphinx-jsondomain.svg?maxAge=2592000)
![http://sphinx-jsondomain.readthedocs.io/en/latest/?badge=latest](https://readthedocs.org/projects/sphinx-jsondomain/badge/?version=latest)
![https://travis-ci.org/dave-shawley/sphinx-jsondomain](https://travis-ci.org/dave-shawley/sphinx-jsondomain.svg?branch=master)

> I was surprised that this didn't already exist somewhere when I wanted to
> describe a JSON document outside of using [sphinxcontrib-httpdomain](https://pythonhosted.org/sphinxcontrib-httpdomain/)
> to document one of my APIs. This extension simplifies describing structured
> JSON documents using a new [Sphinx domain](http://www.sphinx-doc.org/en/stable/domains.html#what-is-a-domain).
>
> -- [Dave Shawley](mailto:[email protected])
```rst
.. json:object:: Github User
What Github's API thinks a user looks like.
:property string login: the user's login
:property integer id: Github assigned unique user identifier
:property string avatar_url: url to user's selected avatar image
or the empty string
:property string gravatar_url: url to the user's gravatar image
or the empty string
```

This will format to something pretty and make references to the JSON object work as expected.

```rst
:json:object:`Github User`
```

See the [online examples](https://sphinx-jsondomain.readthedocs.io/en/latest/examples.html)
for a better idea of what is possible.

## Quick Start

Install sphinx and the ``sphinx-jsondomain`` package with [Pipenv](https://pipenv.pypa.io/en/latest/index.html).

```sh
pipenv install
pipenv shell
```

### Documentation

1. Set up the sphinx documentation root and build your documentation set.

```sh
sphinx-quickstart
sphinx-build docs docs/_build/html
```

2. Add `sphinxjsondomain` to the list of extensions in your configuration file.
3. Add an object directive to one of your source files and run `sphinx-build` again to see the results.

```rst
.. json:object:: GitHub
```
Empty file added semver.ipynb
Empty file.
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

import os.path
from pathlib import Path

import setuptools

Expand All @@ -18,13 +18,20 @@ def read_requirements(name):
requirements.append(line)
return requirements

def long_description():
"""Return the contents of the readme."""
r_path=Path('readme.md')
with r_path.open('r', encoding='utf-8') as r_fh:
r_str = r_fh.read()
return r_str


setuptools.setup(
name='sphinx-jsondomain',
version='0.0.3',
url='https://github.com/dave-shawley/sphinx-jsondomain',
url='https://github.com/edwardtheharris/sphinx-jsondomain',
description='Describe JSON document structures in sphinx',
long_description='\n'+open('README.rst').read(),
long_description=long_description(),
license='BSD',
author='Dave Shawley',
author_email='[email protected]',
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.3

0 comments on commit 0455dc2

Please sign in to comment.