[ADD] First draft of autodoc

This commit is contained in:
Benedek Racz 2020-03-11 15:02:22 +01:00
parent f91da266e6
commit 3ca381f701
7 changed files with 80 additions and 21 deletions

View File

@ -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:

1
doc/requirements.txt Normal file
View File

@ -0,0 +1 @@
pbr

7
doc/source/api/index.rst Normal file
View File

@ -0,0 +1,7 @@
API documentation
=================
.. toctree::
:maxdepth: 2
spawn_classes

View File

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

View File

@ -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']
html_static_path = ['_static']

9
doc/source/history.rst Normal file
View File

@ -0,0 +1,9 @@
History
=======
Wexpect was a one-file code developed at University of Washington. There were several
`copy <https://gist.github.com/anthonyeden/8488763>`_ and
`reference <https://mediarealm.com.au/articles/python-pexpect-windows-wexpect/>`_
to this code with very few (almost none) documentation nor integration.
This project fixes these limitations, with example codes and pypi integration.

View File

@ -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 <https://pexpect.readthedocs.io/en/stable/>`_
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 <http://github.com/raczben/wexpect>`_. Please