Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/sphinx/generated/

# PyBuilder
target/
Expand Down
19 changes: 19 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2

build:
os: "ubuntu-lts-latest"
tools:
python: "3.11"

python:
install:
- requirements: requirements.txt
- requirements: docs/rtd-requirements.txt
# Install our python package before building the docs
- method: pip
path: .

sphinx:
configuration: docs/sphinx/conf.py
# Fail on all warnings to avoid broken references
fail_on_warning: true
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 = sphinx
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=sphinx
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
2 changes: 2 additions & 0 deletions docs/rtd-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx>=8.2
sphinx-rtd-theme
Empty file added docs/sphinx/_static/.gitkeep
Empty file.
57 changes: 57 additions & 0 deletions docs/sphinx/_templates/autoclass-fake-module-debug.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:show-inheritance:
:undoc-members:

objtype: {{ objtype }} class: {{ class }} mod: {{ module }} {{ name }} {{ objname }} {{ fullname }}

{{ members }}

{{ objtype }} {{ class }}

{{ inherited_members }}

{{ objtype }} {{ class }}

.. currentmodule:: {{ fullname }}

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods provided by this class') }}

.. autosummary::
{% for item in methods %}
{%- if item not in inherited_members %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}

.. rubric:: {{ _('Methods inherited from parent class') }}

.. autosummary::
{% for item in methods %}
{%- if item in inherited_members %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}

{% for item in methods %}

.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
57 changes: 57 additions & 0 deletions docs/sphinx/_templates/autoclass-fake-module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

{%- set emit_module = namespace(emit=true) %}
{%- for grp in tinytuya_parent_modules %}
{%- for memb in grp['members'] %}
{%- if memb.name == fullname %}
{%- set emit_module.emit = memb.currentmodule %}
{%- endif %}
{%- endfor %}
{%- endfor %}

.. autoclass:: {{ objname }}
:show-inheritance:
:undoc-members:
{% if emit_module.emit %}
.. currentmodule:: {{ fullname }}
{%- endif %}

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods provided by this class') }}

.. autosummary::
{% for item in methods %}
{%- if item not in inherited_members %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}

.. rubric:: {{ _('Methods inherited from parent class') }}

.. autosummary::
{% for item in methods %}
{%- if item in inherited_members %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}

{% for item in methods %}

.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
45 changes: 45 additions & 0 deletions docs/sphinx/_templates/autoclass-no-module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:show-inheritance:
:undoc-members:

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods provided by this class') }}

.. autosummary::
{% for item in methods %}
{%- if item not in inherited_members %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}

.. rubric:: {{ _('Methods inherited from parent class') }}

.. autosummary::
{% for item in methods %}
{%- if item in inherited_members %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}

{% for item in methods %}

.. automethod:: {{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
68 changes: 68 additions & 0 deletions docs/sphinx/_templates/automodule-tinytuya-core.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{ tinytuya_core_autodocument.get(name, fullname) | escape | underline}}

.. automodule:: {{ fullname }}
:show-inheritance:
:undoc-members:

.. currentmodule:: tinytuya

{% block attributes %}
{%- if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
{% for item in attributes %}
{{ item }}
{%- endfor %}

{% for item in attributes %}
.. autodata:: tinytuya::{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block functions %}
{%- if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block classes %}
{%- if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block exceptions %}
{%- if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block modules %}
{%- if modules %}
.. rubric:: Modules

.. autosummary::
:toctree: core-sub
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}
77 changes: 77 additions & 0 deletions docs/sphinx/_templates/automodule-tinytuya.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{{ fullname + _(' module') | escape }}
===================================

.. automodule:: {{ fullname }}
:show-inheritance:
:members:
:undoc-members:
:imported-members:

.. currentmodule:: tinytuya

{% block attributes %}
{%- if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block functions %}
{%- if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block classes %}
{%- if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block exceptions %}
{%- if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}

{%- block other %}
.. rubric:: {{ _('Extras') }}

.. autosummary::
:toctree:
:template: automodule-tinytuya-core.rst
{% for item in tinytuya_core_autodocument %}
~core.{{ item }}
{%- endfor %}
{% endblock %}

{%- block modules %}
{%- if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock %}
Loading
Loading