How to use the sphinx.util.logging.getLogger function in Sphinx

To help you get started, we’ve selected a few Sphinx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sphinx-doc / sphinx / sphinx / builders / manpage.py View on Github external
from sphinx import addnodes
from sphinx.application import Sphinx
from sphinx.builders import Builder
from sphinx.config import Config
from sphinx.errors import NoUri
from sphinx.locale import __
from sphinx.util import logging
from sphinx.util import progress_message
from sphinx.util.console import darkgreen  # type: ignore
from sphinx.util.nodes import inline_all_toctrees
from sphinx.util.osutil import make_filename_from_project
from sphinx.writers.manpage import ManualPageWriter, ManualPageTranslator


logger = logging.getLogger(__name__)


class ManualPageBuilder(Builder):
    """
    Builds groff output in manual page format.
    """
    name = 'man'
    format = 'man'
    epilog = __('The manual pages are in %(outdir)s.')

    default_translator_class = ManualPageTranslator
    supported_image_types = []  # type: List[str]

    def init(self) -> None:
        if not self.config.man_pages:
            logger.warning(__('no "man_pages" config value found; no manual pages '
github codejamninja / sphinx-markdown-builder / sphinx_markdown_builder / markdown_builder.py View on Github external
from os import path
from sphinx.builders import Builder
from sphinx.builders import Builder
from sphinx.locale import __
from sphinx.util import logging
from sphinx.util.osutil import ensuredir, os_path
import shutil
import os


if False:
    from typing import Any, Dict, Iterator, Set, Tuple
    from docutils import nodes
    from sphinx.application import Sphinx

logger = logging.getLogger(__name__)

class MarkdownBuilder(Builder):
    name = 'markdown'
    format = 'markdown'
    epilog = __('The markdown files are in %(outdir)s.')

    out_suffix = '.md'
    allow_parallel = True
    default_translator_class = MarkdownTranslator

    current_docname = None

    markdown_http_base = 'https://localhost'

    def init(self):
        self.secnumbers = {}
github QuantEcon / sphinxcontrib-jupyter / sphinxcontrib / jupyter / builders / jupyter_code.py View on Github external
import os.path
import docutils.io

import nbformat
from ..writers.jupyter import JupyterWriter
from sphinx.builders import Builder
from ..writers.execute_nb import ExecuteNotebookWriter
from dask.distributed import Client
from sphinx.util import logging
from sphinx.util.console import bold
import time
from .utils import copy_dependencies, create_hash, normalize_cell, check_codetree_validity
import json
from collections import OrderedDict

logger = logging.getLogger(__name__)

class JupyterCodeBuilder(Builder):

    #Builder Settings
    name="execute"
    docformat = "json"
    out_suffix = ".codetree"
    allow_parallel = True
    nbversion = 4
    #Dask Configuration
    threads_per_worker = 1
    n_workers = 1
    #-Sphinx Writer
    _writer_class = JupyterWriter

    def init(self):
github sphinx-doc / sphinx / sphinx / builders / epub3.py View on Github external
from sphinx.builders import _epub_base
from sphinx.config import ENUM
from sphinx.deprecation import RemovedInSphinx40Warning
from sphinx.locale import __
from sphinx.util import logging, xmlname_checker
from sphinx.util.fileutil import copy_asset_file
from sphinx.util.i18n import format_date
from sphinx.util.osutil import make_filename

if False:
    # For type annotation
    from typing import Any, Dict, List, Set, Tuple  # NOQA
    from sphinx.application import Sphinx  # NOQA
    from sphinx.config import Config  # NOQA

logger = logging.getLogger(__name__)


NavPoint = namedtuple('NavPoint', ['text', 'refuri', 'children'])

# writing modes
PAGE_PROGRESSION_DIRECTIONS = {
    'horizontal': 'ltr',
    'vertical': 'rtl',
}
IBOOK_SCROLL_AXIS = {
    'horizontal': 'vertical',
    'vertical': 'horizontal',
}
THEME_WRITING_MODES = {
    'vertical': 'vertical-rl',
    'horizontal': 'horizontal-tb',
github praekeltfoundation / seaworthy / docs / apigen.py View on Github external
from typing import Dict

from sphinx import __display_version__
from sphinx.application import Sphinx
from sphinx.cmd.quickstart import EXTENSIONS
from sphinx.util import logging
from sphinx.util.osutil import FileAvoidWrite, walk

if sys.version_info[0] >= 3:
    unicode = str

if False:
    # For type annotation
    from typing import Any, List, Tuple  # NOQA

logger = logging.getLogger(__name__)


BASEDIR = path.dirname(__file__)


INITPY = '__init__.py'
PY_SUFFIXES = set(['.py', '.pyx'])


def makename(package, module):
    # type: (unicode, unicode) -> unicode
    """Join package and module with a dot."""
    # Both package and module can be None/empty.
    if package:
        name = package
        if module:
github openstack / os-api-ref / os_api_ref / __init__.py View on Github external
from docutils.parsers.rst.directives.tables import Table
from docutils.statemachine import ViewList
import pbr.version
import six
from sphinx.util import logging
from sphinx.util.osutil import copyfile
import yaml

from os_api_ref.http_codes import http_code
from os_api_ref.http_codes import http_code_html
from os_api_ref.http_codes import HTTPResponseCodeDirective

__version__ = pbr.version.VersionInfo(
    'os_api_ref').version_string()

LOG = logging.getLogger(__name__)

"""This provides a sphinx extension able to create the HTML needed
for the api-ref website.

It contains 2 new stanzas.

  .. rest_method:: GET /foo/bar

Which is designed to be used as the first stanza in a new section to
state that section is about that REST method. During processing the
rest stanza will be reparented to be before the section in question,
and used as a show/hide selector for it's details.

  .. rest_parameters:: file.yaml

     - name1: name_in_file1
github sphinx-doc / sphinx / sphinx / util / inspect.py View on Github external
from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.util import logging
from sphinx.util.typing import NoneType

if sys.version_info > (3, 7):
    from types import (
        ClassMethodDescriptorType,
        MethodDescriptorType,
        WrapperDescriptorType
    )
else:
    ClassMethodDescriptorType = type(object.__init__)
    MethodDescriptorType = type(str.join)
    WrapperDescriptorType = type(dict.__dict__['fromkeys'])

logger = logging.getLogger(__name__)

memory_address_re = re.compile(r' at 0x[0-9a-f]{8,16}(?=>)', re.IGNORECASE)


# Copied from the definition of inspect.getfullargspec from Python master,
# and modified to remove the use of special flags that break decorated
# callables and bound methods in the name of backwards compatibility. Used
# under the terms of PSF license v2, which requires the above statement
# and the following:
#
#   Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
#   2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Python Software
#   Foundation; All Rights Reserved
def getargspec(func):
    """Like inspect.getfullargspec but supports bound methods, and wrapped
    methods."""
github Karaage-Cluster / karaage / docs / ext / djangodocs.py View on Github external
Sphinx plugins for Karaage documentation. Copied from Django.
"""
import json
import os
import re

from docutils import nodes
from docutils.parsers.rst import Directive
from sphinx import addnodes
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.domains.std import Cmdoption
from sphinx.util import logging
from sphinx.util.console import bold
from sphinx.writers.html import HTMLTranslator

logger = logging.getLogger(__name__)
# RE for option descriptions without a '--' prefix
simple_option_desc_re = re.compile(
    r'([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)')


def setup(app):
    app.add_crossref_type(
        directivename="setting",
        rolename="setting",
        indextemplate="pair: %s; setting",
    )
    app.add_crossref_type(
        directivename="templatetag",
        rolename="ttag",
        indextemplate="pair: %s; template tag"
    )
github Qiskit / qiskit / docs / versionutils.py View on Github external
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

import os
import re
import subprocess
from functools import partial

from docutils import nodes
from docutils.parsers.rst.directives.tables import Table
from docutils.parsers.rst import Directive, directives
from sphinx.util import logging


logger = logging.getLogger(__name__)

translations_list = [
    ('en', 'English'),
    ('ja', 'Japanese')
]

default_language = 'en'

def setup(app):
    app.connect('config-inited', _extend_html_context)
    app.add_config_value('content_prefix', '', '')
    app.add_config_value('translations', True, 'html')
    app.add_directive('version-history', _VersionHistory)

def _extend_html_context(app, config):
    context = config.html_context