Skip to content

Commit

Permalink
Merge pull request #8 from open-contracting/dev
Browse files Browse the repository at this point in the history
Add docs
  • Loading branch information
jpmckinney committed Jul 2, 2018
2 parents 8b06b68 + a29d0df commit 951d3dc
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
/.coverage
/dist
/*.egg-info
/docs/_build
5 changes: 0 additions & 5 deletions README.rst
@@ -1,6 +1,3 @@
Extension Registry Python Package
=================================

|PyPI version| |Build Status| |Dependency Status| |Coverage Status|

This Python package eases access to information about extensions in the `Open Contracting Data Standard <http://standard.open-contracting.org>`__'s `extension registry <https://github.com/open-contracting/extension_registry>`__.
Expand Down Expand Up @@ -30,8 +27,6 @@ Contributing

Methods in this library should either apply to all possible extensions, or be useful to at least two use cases. Methods that don't yet meet these criteria are documented as experimental.

Copyright (c) 2018 Open Contracting Partnership, released under the BSD license

.. |PyPI version| image:: https://badge.fury.io/py/ocdsextensionregistry.svg
:target: https://badge.fury.io/py/ocdsextensionregistry
.. |Build Status| image:: https://secure.travis-ci.org/open-contracting/extension_registry.py.png
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = OCDSExtensionRegistryPythonPackage
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
6 changes: 6 additions & 0 deletions docs/api/exceptions.rst
@@ -0,0 +1,6 @@
Exceptions
==========

.. autoexception:: ocdsextensionregistry.exceptions.OCDSExtensionRegistryError
.. autoexception:: ocdsextensionregistry.exceptions.DoesNotExist
.. autoexception:: ocdsextensionregistry.exceptions.MissingExtensionMetadata
6 changes: 6 additions & 0 deletions docs/api/extension.rst
@@ -0,0 +1,6 @@
Extension
=========

.. autoclass:: ocdsextensionregistry.extension.Extension
:special-members:
:exclude-members: __weakref__
6 changes: 6 additions & 0 deletions docs/api/extension_registry.rst
@@ -0,0 +1,6 @@
Extension Registry
==================

.. autoclass:: ocdsextensionregistry.extension_registry.ExtensionRegistry
:special-members:
:exclude-members: __weakref__
6 changes: 6 additions & 0 deletions docs/api/extension_version.rst
@@ -0,0 +1,6 @@
Extension Version
=================

.. autoclass:: ocdsextensionregistry.extension_version.ExtensionVersion
:special-members:
:exclude-members: __weakref__
100 changes: 100 additions & 0 deletions docs/conf.py
@@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os
import sys
sys.path.insert(0, os.path.abspath('..'))


# -- Project information -----------------------------------------------------

project = 'OCDS Extension Registry Python Package'
copyright = '2018, Open Contracting Partnership'
author = 'Open Contracting Partnership'

# The short X.Y version
version = '0.0.4'
# The full version, including alpha/beta/rc tags
release = '0.0.4'


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'default'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


# -- Extension configuration -------------------------------------------------

autodoc_default_flags = ['members']
autodoc_member_order = 'bysource'

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
22 changes: 22 additions & 0 deletions docs/index.rst
@@ -0,0 +1,22 @@
OCDS Extension Registry Python Package |release|
================================================

.. include:: ../README.rst

.. toctree::
:maxdepth: 2
:caption: Contents

api/extension_registry
api/extension_version
api/extension
api/exceptions

Copyright (c) 2018 Open Contracting Partnership, released under the BSD license

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
3 changes: 3 additions & 0 deletions ocdsextensionregistry/extension_registry.py
Expand Up @@ -54,6 +54,9 @@ def get(self, **kwargs):
self._handle_attribute_error(e)

def __iter__(self):
"""
Iterates over the extension versions in the registry.
"""
for version in self.versions:
yield version

Expand Down
5 changes: 5 additions & 0 deletions setup.py
Expand Up @@ -22,6 +22,11 @@
'pytest',
'pytest-cov',
],
'docs': [
'Sphinx',
'sphinx-autobuild',
'sphinx_rtd_theme',
]
},
classifiers=[
'License :: OSI Approved :: BSD License',
Expand Down

0 comments on commit 951d3dc

Please sign in to comment.