From 3ca381f7016440d9e3cf9ba3f02cffd6fd75e0e1 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Wed, 11 Mar 2020 15:02:22 +0100 Subject: [PATCH] [ADD] First draft of autodoc --- README.md | 8 +------ doc/requirements.txt | 1 + doc/source/api/index.rst | 7 ++++++ doc/source/api/spawn_classes.rst | 23 +++++++++++++++++++ doc/source/conf.py | 39 +++++++++++++++++++++++++------- doc/source/history.rst | 9 ++++++++ doc/source/index.rst | 14 +++++++----- 7 files changed, 80 insertions(+), 21 deletions(-) create mode 100644 doc/requirements.txt create mode 100644 doc/source/api/index.rst create mode 100644 doc/source/api/spawn_classes.rst create mode 100644 doc/source/history.rst diff --git a/README.md b/README.md index b2d95d2..f519b21 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/tbji72d5s0tagrt9?svg=true)](https://ci.appveyor.com/project/raczben/wexpect) [![codecov](https://codecov.io/gh/raczben/wexpect/branch/master/graph/badge.svg)](https://codecov.io/gh/raczben/wexpect) +[![Documentation Status](https://readthedocs.org/projects/wexpect/badge/?version=latest)](https://wexpect.readthedocs.io/en/latest/?badge=latest) *Wexpect* is a Windows variant of [pexpect](https://pexpect.readthedocs.io/en/stable/). @@ -18,13 +19,6 @@ them automatically. pip install wexpect -OR - -Because wexpect a tiny project dropping the wexpect.py file into your working directory is usually -good enough instead of installing. However in this case you need to install manually the pypiwin32 -dependence. - - ## **Usage** To interract with a child process use `spawn` method: diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..1d45dc6 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1 @@ +pbr diff --git a/doc/source/api/index.rst b/doc/source/api/index.rst new file mode 100644 index 0000000..16c0265 --- /dev/null +++ b/doc/source/api/index.rst @@ -0,0 +1,7 @@ +API documentation +================= + +.. toctree:: + :maxdepth: 2 + + spawn_classes diff --git a/doc/source/api/spawn_classes.rst b/doc/source/api/spawn_classes.rst new file mode 100644 index 0000000..f05cb24 --- /dev/null +++ b/doc/source/api/spawn_classes.rst @@ -0,0 +1,23 @@ +Spawn classes +============= + +.. automodule:: wexpect.host + +SpawnPipe +--------- + +.. autoclass:: SpawnPipe + + .. automethod:: __init__ + .. automethod:: expect + .. automethod:: expect_exact + .. automethod:: expect_list + .. automethod:: compile_pattern_list + .. automethod:: send + .. automethod:: sendline + .. automethod:: write + .. automethod:: writelines + .. automethod:: sendeof + .. automethod:: read + .. automethod:: readline + .. automethod:: read_nonblocking diff --git a/doc/source/conf.py b/doc/source/conf.py index 7227279..47ff826 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -9,10 +9,23 @@ # 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 +from pbr.version import VersionInfo + +repo_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) +print(repo_path) +sys.path.insert(0, repo_path) + +# import wexpect + +os.environ['WEXPECT_SPAWN_CLASS'] = 'SpawnPipe' +autodoc_mock_imports = ["pywintypes", "win32process", "win32con", "win32file", "winerror", + "win32pipe", "ctypes", "win32console", "win32gui"] + +# from ctypes import windll + # -- Project information ----------------------------------------------------- @@ -21,8 +34,18 @@ project = 'wexpect' copyright = '2020, Benedek Racz' author = 'Benedek Racz' -# The full version, including alpha/beta/rc tags -release = '0.0.1' +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +package_name='wexpect' +info = VersionInfo(package_name) +version = info.version_string() + +# The full version, including alpha/beta/rc tags. +release = version + # -- General configuration --------------------------------------------------- @@ -30,7 +53,7 @@ release = '0.0.1' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = [ +extensions = [ 'sphinx.ext.autodoc' ] # Add any paths that contain templates here, relative to this directory. @@ -52,4 +75,4 @@ html_theme = 'alabaster' # 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'] \ No newline at end of file +html_static_path = ['_static'] diff --git a/doc/source/history.rst b/doc/source/history.rst new file mode 100644 index 0000000..96ab393 --- /dev/null +++ b/doc/source/history.rst @@ -0,0 +1,9 @@ +History +======= + +Wexpect was a one-file code developed at University of Washington. There were several +`copy `_ and +`reference `_ +to this code with very few (almost none) documentation nor integration. + +This project fixes these limitations, with example codes and pypi integration. diff --git a/doc/source/index.rst b/doc/source/index.rst index a996e6a..05c0a29 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -6,6 +6,11 @@ Wexpect version |version| :align: right :alt: Build status +.. warning:: + **UNDER CONSTRUCTION!!!** + Documentation is in a very preliminary state. I'm learning sphinx and + readthedocs. + *Wexpect* is a Windows variant of `Pexpect `_ Wexpect and Pexpect makes Python a better tool for controlling other applications. @@ -29,8 +34,8 @@ Wexpect is on PyPI, and can be installed with standard tools:: pip install wexpect -Usage -^^^^^ +Hello Wexpect +^^^^^^^^^^^^^ To interract with a child process use :code:`spawn` method: @@ -49,15 +54,12 @@ For more information see [examples](./examples) folder. Contents: + .. toctree:: :maxdepth: 2 - overview api/index - examples - FAQ - commonissues history Wexpect is developed `on Github `_. Please