Skip to content

Commit

Permalink
[Doc] Add sphinx basis
Browse files Browse the repository at this point in the history
  • Loading branch information
Herklos committed Mar 25, 2020
1 parent 1f3bb02 commit 6dcae87
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ venv.bak/
# mypy
.mypy_cache/

# ide
.idea

# cython
*.html
*.c

cython_debug/

# doc
docs/build
15 changes: 15 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
install:
- requirements: requirements.txt
- requirements: dev_requirements.txt
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Build status](https://ci.appveyor.com/api/projects/status/erg9ebvtco73x5h4?svg=true)](https://ci.appveyor.com/project/Herklos/octobot-channels)
[![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot-Channels/badge.svg?branch=master)](https://coveralls.io/github/Drakkar-Software/OctoBot-Channels?branch=master)

OctoBot channels package.
[OctoBot](https://github.com/Drakkar-Software/OctoBot) channels package.

## Installation
With python3 : `pip install OctoBot-Channels`
Expand Down Expand Up @@ -44,3 +44,6 @@ await producer.send("test")
# Stops the channel with all its producers and consumers
# await Channels.get_chan("Awesome").stop()
```

# Developer documentation
On [readthedocs.io](https://octobot-channels.readthedocs.io/en/latest/)
3 changes: 3 additions & 0 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ setuptools
wheel

pur

sphinx==2.4.4
sphinx_rtd_theme
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
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)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
87 changes: 87 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- 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('../..'))


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

project = 'OctoBot-Channels'
copyright = '2020, Drakkar-Software'
author = 'Drakkar-Software'

# The short X.Y version
version = '1.3'

# The full version, including alpha/beta/rc tags
release = '1.3.21-beta'

# https://github.com/readthedocs/readthedocs.org/issues/2569
master_doc = 'index'

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

# 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.coverage',
'sphinx.ext.todo',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon',
]

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

# 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 = 'en'

# 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 = []


# -- 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 = 'sphinx_rtd_theme'

# 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 -------------------------------------------------

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/3/': None}

# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
20 changes: 20 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. OctoBot-Channels documentation master file, created by
sphinx-quickstart on Tue Mar 24 00:38:18 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to OctoBot-Channels's documentation!
============================================

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



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

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
octobot_channels
================

.. toctree::
:maxdepth: 4

octobot_channels
30 changes: 30 additions & 0 deletions docs/source/octobot_channels.channels.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
octobot\_channels.channels package
==================================

Submodules
----------

octobot\_channels.channels.channel module
-----------------------------------------

.. automodule:: octobot_channels.channels.channel
:members:
:undoc-members:
:show-inheritance:

octobot\_channels.channels.channel\_instances module
----------------------------------------------------

.. automodule:: octobot_channels.channels.channel_instances
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: octobot_channels.channels
:members:
:undoc-members:
:show-inheritance:
46 changes: 46 additions & 0 deletions docs/source/octobot_channels.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
octobot\_channels package
=========================

Subpackages
-----------

.. toctree::

octobot_channels.channels
octobot_channels.util

Submodules
----------

octobot\_channels.constants module
----------------------------------

.. automodule:: octobot_channels.constants
:members:
:undoc-members:
:show-inheritance:

octobot\_channels.consumer module
---------------------------------

.. automodule:: octobot_channels.consumer
:members:
:undoc-members:
:show-inheritance:

octobot\_channels.producer module
---------------------------------

.. automodule:: octobot_channels.producer
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: octobot_channels
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/source/octobot_channels.util.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
octobot\_channels.util package
==============================

Submodules
----------

octobot\_channels.util.channel\_creator module
----------------------------------------------

.. automodule:: octobot_channels.util.channel_creator
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: octobot_channels.util
:members:
:undoc-members:
:show-inheritance:
6 changes: 6 additions & 0 deletions octobot_channels/channels/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from octobot_channels.channels.channel_instances import ChannelInstances

"""
channel.py
====================================
A Channel is the object to connect a producer / producers class(es) to a consumer / consumers class(es)
It contains a registered consumers dict to notify every consumer when a producer 'send' something.
It contains a registered producers list to allow producer modification through 'modify'.
Expand Down Expand Up @@ -55,6 +57,10 @@ def __init__(self):

@classmethod
def get_name(cls) -> str:
"""
Default implementation is to return the name of the class without the 'Channel' substring
:returns the channel name
"""
return cls.__name__.replace('Channel', '')

async def new_consumer(self,
Expand Down

0 comments on commit 6dcae87

Please sign in to comment.