From d84d4fce6dc524e9a6de5787cb0895085dd2d7a1 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sat, 8 Sep 2018 00:18:44 +0300 Subject: [PATCH] Conda... Hate RTD and small changes in docs config. --- dev_requirements.txt | 1 + docs/source/conf.py | 17 +++++++++++++++-- docs/source/examples/echo_bot.rst | 5 +++-- environment.yml | 4 ++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index ea4d686a..ac4a62ec 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -11,6 +11,7 @@ wheel>=0.31.0 rethinkdb>=2.3.0 sphinx>=1.7.3 sphinx-rtd-theme>=0.3.0 +sphinxcontrib-programoutput>=0.11 aresponses>=1.0.0 tox>=3.0.0 aiosocksy>=0.1 diff --git a/docs/source/conf.py b/docs/source/conf.py index 156643ea..a51cc5b9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -17,9 +17,12 @@ # 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 datetime import os import sys +from pip._vendor.pkg_resources import parse_version + sys.path.insert(0, os.path.abspath('../..')) import aiogram @@ -37,6 +40,8 @@ extensions = [ 'sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc', + 'sphinx.ext.ifconfig', + 'sphinxcontrib.programoutput', ] # Add any paths that contain templates here, relative to this directory. @@ -53,18 +58,26 @@ master_doc = 'index' # General information about the project. project = 'aiogram' -copyright = '2017, Illemius / Alex Root Junior' author = 'Illemius / Alex Root Junior' +copyright = f'{datetime.datetime.now().year}, {author}' # 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. # + +parsed_version = parse_version(aiogram.__version__) + # The short X.Y version. -version = aiogram.__version__ +version = parsed_version.base_version + # The full version, including alpha/beta/rc tags. release = aiogram.__version__ +releaselevel = 'dev' if parsed_version.dev else 'alpha' \ + if 'a' in version else 'beta' \ + if 'b' in version else 'stable' + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # diff --git a/docs/source/examples/echo_bot.rst b/docs/source/examples/echo_bot.rst index bacd2c36..c8c7b4a8 100644 --- a/docs/source/examples/echo_bot.rst +++ b/docs/source/examples/echo_bot.rst @@ -3,5 +3,6 @@ Echo bot .. literalinclude:: ../../../examples/echo_bot.py - :language: python - :linenos: + :caption: echo_bot.py + :language: python + :linenos: diff --git a/environment.yml b/environment.yml index 026e9cf8..c32b183e 100644 --- a/environment.yml +++ b/environment.yml @@ -3,8 +3,8 @@ channels: - conda-forge dependencies: - python=3.7 - - sphinx=1.5.3 - - sphinx_rtd_theme=0.2.4 + - sphinx + - sphinx_rtd_theme - pip - openssl - xz