various improvements
This commit is contained in:
20
packaging/build/docs/Makefile
Normal file
20
packaging/build/docs/Makefile
Normal file
@ -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
packaging/build/docs/make.bat
Normal file
35
packaging/build/docs/make.bat
Normal file
@ -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
|
||||
|
||||
%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.https://www.sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
|
||||
:end
|
||||
popd
|
8
packaging/build/docs/source/_templates/versioning.html
Normal file
8
packaging/build/docs/source/_templates/versioning.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% if versions %}
|
||||
<h3>{{ _('Версии') }}</h3>
|
||||
<ul>
|
||||
{%- for item in versions %}
|
||||
<li><a href="{{ item.url }}">{{ item.name }}</a></li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
33
packaging/build/docs/source/conf.py
Normal file
33
packaging/build/docs/source/conf.py
Normal file
@ -0,0 +1,33 @@
|
||||
# Add /mnt/build/compute-0.1.0.dev1 to path for autodoc Sphinx extension
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('/mnt/build/compute-0.1.0.dev1'))
|
||||
|
||||
# Project information
|
||||
project = 'Compute'
|
||||
copyright = '2023, Compute Authors'
|
||||
author = 'Compute Authors'
|
||||
release = '0.1.0'
|
||||
|
||||
# Sphinx general settings
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx_multiversion',
|
||||
]
|
||||
templates_path = ['_templates']
|
||||
exclude_patterns = []
|
||||
language = 'en'
|
||||
|
||||
# HTML output settings
|
||||
html_theme = 'alabaster'
|
||||
html_static_path = ['_static']
|
||||
html_sidebars = {
|
||||
'**': [
|
||||
'about.html',
|
||||
'navigation.html',
|
||||
'relations.html',
|
||||
'searchbox.html',
|
||||
'donate.html',
|
||||
'versioning.html',
|
||||
]
|
||||
}
|
16
packaging/build/docs/source/index.rst
Normal file
16
packaging/build/docs/source/index.rst
Normal file
@ -0,0 +1,16 @@
|
||||
Compute
|
||||
=======
|
||||
|
||||
Compute instances management library.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
pyapi/index
|
||||
|
||||
Indices and tables
|
||||
------------------
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
5
packaging/build/docs/source/pyapi/exceptions.rst
Normal file
5
packaging/build/docs/source/pyapi/exceptions.rst
Normal file
@ -0,0 +1,5 @@
|
||||
``exceptions``
|
||||
==============
|
||||
|
||||
.. automodule:: compute.exceptions
|
||||
:members:
|
49
packaging/build/docs/source/pyapi/index.rst
Normal file
49
packaging/build/docs/source/pyapi/index.rst
Normal file
@ -0,0 +1,49 @@
|
||||
Python API
|
||||
==========
|
||||
|
||||
The API allows you to perform actions on instances programmatically. Below is
|
||||
an example of changing parameters and launching the `myinstance` instance.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import logging
|
||||
|
||||
from compute import Session
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
with Session() as session:
|
||||
instance = session.get_instance('myinstance')
|
||||
instance.set_vcpus(4)
|
||||
instance.start()
|
||||
instance.set_autostart(enabled=True)
|
||||
|
||||
|
||||
:class:`Session` context manager provides an abstraction over :class:`libvirt.virConnect`
|
||||
and returns objects of other classes of the present library.
|
||||
|
||||
Entity representation
|
||||
---------------------
|
||||
|
||||
Entities such as a compute-instance are represented as classes. These classes directly
|
||||
call libvirt methods to perform operations on the hypervisor. An example class is
|
||||
:class:`Volume`.
|
||||
|
||||
The configuration files of various libvirt objects in `compute` are described by special
|
||||
dataclasses. The dataclass stores object parameters in its properties and can return an
|
||||
XML config for libvirt using the ``to_xml()`` method. For example :class:`VolumeConfig`.
|
||||
|
||||
`Pydantic <https://docs.pydantic.dev/>`_ models are used to validate input data.
|
||||
For example :class:`VolumeSchema`.
|
||||
|
||||
Modules documentation
|
||||
---------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
session
|
||||
instance/index
|
||||
storage/index
|
||||
utils
|
||||
exceptions
|
@ -0,0 +1,6 @@
|
||||
``guest_agent``
|
||||
===============
|
||||
|
||||
.. automodule:: compute.instance.guest_agent
|
||||
:members:
|
||||
:special-members: __init__
|
10
packaging/build/docs/source/pyapi/instance/index.rst
Normal file
10
packaging/build/docs/source/pyapi/instance/index.rst
Normal file
@ -0,0 +1,10 @@
|
||||
``instance``
|
||||
============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Contents:
|
||||
|
||||
instance
|
||||
guest_agent
|
||||
schemas
|
6
packaging/build/docs/source/pyapi/instance/instance.rst
Normal file
6
packaging/build/docs/source/pyapi/instance/instance.rst
Normal file
@ -0,0 +1,6 @@
|
||||
``instance``
|
||||
============
|
||||
|
||||
.. automodule:: compute.instance.instance
|
||||
:members:
|
||||
:special-members: __init__
|
5
packaging/build/docs/source/pyapi/instance/schemas.rst
Normal file
5
packaging/build/docs/source/pyapi/instance/schemas.rst
Normal file
@ -0,0 +1,5 @@
|
||||
``schemas``
|
||||
===========
|
||||
|
||||
.. automodule:: compute.instance.schemas
|
||||
:members:
|
6
packaging/build/docs/source/pyapi/session.rst
Normal file
6
packaging/build/docs/source/pyapi/session.rst
Normal file
@ -0,0 +1,6 @@
|
||||
``session``
|
||||
===========
|
||||
|
||||
.. automodule:: compute.session
|
||||
:members:
|
||||
:special-members: __init__
|
9
packaging/build/docs/source/pyapi/storage/index.rst
Normal file
9
packaging/build/docs/source/pyapi/storage/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
``storage``
|
||||
============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Contents:
|
||||
|
||||
pool
|
||||
volume
|
6
packaging/build/docs/source/pyapi/storage/pool.rst
Normal file
6
packaging/build/docs/source/pyapi/storage/pool.rst
Normal file
@ -0,0 +1,6 @@
|
||||
``pool``
|
||||
========
|
||||
|
||||
.. automodule:: compute.storage.pool
|
||||
:members:
|
||||
:special-members: __init__
|
6
packaging/build/docs/source/pyapi/storage/volume.rst
Normal file
6
packaging/build/docs/source/pyapi/storage/volume.rst
Normal file
@ -0,0 +1,6 @@
|
||||
``volume``
|
||||
==========
|
||||
|
||||
.. automodule:: compute.storage.volume
|
||||
:members:
|
||||
:special-members: __init__
|
14
packaging/build/docs/source/pyapi/utils.rst
Normal file
14
packaging/build/docs/source/pyapi/utils.rst
Normal file
@ -0,0 +1,14 @@
|
||||
``utils``
|
||||
=========
|
||||
|
||||
``utils.units``
|
||||
---------------
|
||||
|
||||
.. automodule:: compute.utils.units
|
||||
:members:
|
||||
|
||||
``utils.ids``
|
||||
-------------
|
||||
|
||||
.. automodule:: compute.utils.ids
|
||||
:members:
|
Reference in New Issue
Block a user