Skip to content

Commit

Permalink
Merge pull request #6 from carlos-jenkins/fix_sphinx_1_8_0
Browse files Browse the repository at this point in the history
new: usr: Updating codebase for Sphinx 1.8.0 and ownership transfer.
  • Loading branch information
carlos-jenkins authored Apr 10, 2019
2 parents 46760f7 + 50a095c commit 450dc1b
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ License

::

Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
Copyright (C) 2015-2018 KuraLabs S.R.L

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
27 changes: 13 additions & 14 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import os
from sys import path
from os.path import join, dirname, abspath
from os.path import dirname, abspath

from autoapi import __version__

Expand All @@ -36,9 +36,8 @@
'sphinx.ext.autodoc',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.intersphinx',
'sphinxcontrib.plantuml',
'sphinx.ext.graphviz',
'autoapi.sphinx'
'autoapi.sphinx',
'plantweb.directive',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -57,8 +56,8 @@

# General information about the project.
project = 'autoapi'
copyright = '2015, Carlos Jenkins'
author = 'Carlos Jenkins'
author = 'KuraLabs S.R.L'
copyright = '2015-2018, ' + 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
Expand Down Expand Up @@ -235,7 +234,7 @@
(
'index', 'autoapi.tex',
'autoapi Documentation',
'Carlos Jenkins', 'manual'
author, 'manual'
),
]

Expand Down Expand Up @@ -313,22 +312,22 @@
def setup(app):
app.add_stylesheet('styles/custom.css')


# autoapi configuration
autoapi_modules = {
'autoapi': {'prune': True},
'documented': {'output': 'autoapi'}
}

# Configure PlantUML
plantuml = 'java -jar ' + join(dirname(abspath(__name__)), 'plantuml.8030.jar')
plantuml_output_format = 'svg'

# Configure Graphviz
graphviz_output_format = 'svg'
# Plantweb configuration
plantweb_defaults = {
'use_cache': True,
'format': 'svg',
}

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3.4', None)
'python': ('https://docs.python.org/3', None)
}

# Setup theme if not building in readthedocs.org
Expand Down
8 changes: 6 additions & 2 deletions doc/documented.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def a_function(my_arg, another):
:param int my_arg: The first argument of the function. Just a number.
:param another: The other argument of the important function.
:type another: A list of :class:`MyClass`
:rtype: int
:return: The length of the second argument times the first argument.
:rtype: int
"""
return my_arg * len(another)

Expand All @@ -52,7 +53,9 @@ class MyClass(object):
:param int param1: The first parameter of my class.
:param param2: The second one.
:type param2: int or float
:var my_attribute: Just an instance attribute.
:raises TypeError: if param2 is not None.
"""

Expand All @@ -74,9 +77,10 @@ def my_method(self, param1, param2):
:param int param1: A parameter.
:param list param2: Another parameter.
:rtype: list of int
:return: A list of the first parameter as long a the length of the
second parameter.
:rtype: list of int
"""
return [param1] * len(param2)

Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ License

::

Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
Copyright (C) 2015-2018 KuraLabs S.R.L

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Binary file removed doc/plantuml.8030.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/apinode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (C) 2015-2018 KuraLabs S.R.L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions lib/autoapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (C) 2015-2018 KuraLabs S.R.L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,8 +20,8 @@

from .apinode import __doc__, APINode # noqa

__author__ = 'Carlos Jenkins'
__email__ = 'carlos@jenkins.co.cr'
__version__ = '1.3.1'
__author__ = 'KuraLabs S.R.L'
__email__ = 'info@kuralabs.io'
__version__ = '1.4.0'

__all__ = ['APINode']
6 changes: 3 additions & 3 deletions lib/autoapi/apinode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (C) 2015-2018 KuraLabs S.R.L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -162,9 +162,9 @@ def __init__(self, name, directory=None):
try:
subnode = APINode(subname, self.directory)
self.subnodes.append(subnode)
except: # Overbroad exception handling on purpose
except Exception as e:
log.error('Failed to import {}'.format(subname))
log.debug(format_exc())
log.error(format_exc())
self.subnodes_failed.append(subname)

# Fetch all public objects
Expand Down
19 changes: 9 additions & 10 deletions lib/autoapi/sphinx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (C) 2015-2018 KuraLabs S.R.L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -23,12 +23,13 @@
from __future__ import print_function, division

from inspect import getdoc
from logging import getLogger
from functools import wraps
from traceback import format_exc
from os.path import join, dirname, abspath, exists

from jinja2.sandbox import SandboxedEnvironment
from sphinx.util.osutil import ensuredir
from sphinx.util.logging import getLogger
from sphinx.jinja2glue import BuiltinTemplateLoader

from . import __version__
Expand All @@ -43,20 +44,17 @@ def handle_exception(func):
Utility decorator to report all exceptions in module without making Sphinx
to die.
"""
@wraps(func)
def wrapper(app):
try:
func(app)
except Exception:
app.warn(
log.warning(
'Unhandled exception in autoapi module: \n{}'.format(
format_exc()
)
)

# Preserve docstring
if hasattr(func, '__doc__'):
wrapper.__doc__ = func.__doc__

return wrapper


Expand All @@ -73,9 +71,9 @@ def filter_summary(obj):
summary = doc.split('\n').pop(0)
summary.replace('\\', '\\\\') # Escape backslash in RST
return summary
except:
except Exception as e:
log.error(
'AutoApi failed to determine autosummary for obj: {}'.format(obj)
'AutoApi failed to determine summary for obj: {}'.format(obj)
)
log.error(format_exc())

Expand Down Expand Up @@ -158,7 +156,8 @@ def builder_inited(app):

# Iterate nodes and render them
for node in nodes:
out_file = join(out_dir, node.name + app.config.source_suffix[0])
source_suffix = next(iter(app.config.source_suffix))
out_file = join(out_dir, node.name + source_suffix)

# Skip file if it override is off and it exists
if not options['override'] and exists(out_file):
Expand Down
2 changes: 1 addition & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pytest
pytest-cov
sphinx
sphinx_rtd_theme
sphinxcontrib-plantuml
plantweb
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (C) 2015-2018 KuraLabs S.R.L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -68,8 +68,8 @@ def find_requirements(filename):
install_requires=find_requirements('requirements.txt'),

# Metadata
author='Carlos Jenkins',
author_email='carlos@jenkins.co.cr',
author='KuraLabs S.R.L',
author_email='info@kuralabs.io',
description=(
'Automatic API reference documentation generation for Sphinx inspired '
'by Doxygen'
Expand All @@ -79,7 +79,7 @@ def find_requirements(filename):
keywords='autoapi',

classifiers=[
'Development Status :: 3 - Alpha',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
Expand All @@ -88,5 +88,6 @@ def find_requirements(filename):
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
]
)
2 changes: 1 addition & 1 deletion test/test_autoapi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (C) 2015-2018 KuraLabs S.R.L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion test/test_autoapi_apinode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Carlos Jenkins <carlos@jenkins.co.cr>
# Copyright (C) 2015-2018 KuraLabs S.R.L
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
17 changes: 7 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
[tox]
envlist = py27, py34, coverage, doc
envlist = py27, py34, py35, coverage, doc


[testenv]
passenv = http_proxy https_proxy
passenv = http_proxy https_proxy no_proxy HOME
deps =
-rrequirements.dev.txt
changedir = {envtmpdir}
commands =
{envpython} -c "import autoapi; print(autoapi.__file__)"
flake8 {toxinidir}
py.test {posargs} \
{toxinidir}/test \
{envsitepackagesdir}/autoapi

[testenv:coverage]
basepython = python3.4
commands =
py.test \
--junitxml=tests.xml \
--cov=autoapi \
--cov-report xml \
Expand All @@ -25,15 +19,18 @@ commands =
{toxinidir}/test \
{envsitepackagesdir}/autoapi


[testenv:doc]
basepython = python3.4
basepython = python3
whitelist_externals =
dot
commands =
sphinx-build -W -b html -d doctrees {toxinidir}/doc/ html


[flake8]
exclude = .git,.tox,.cache,__pycache__,*.egg-info


[pytest]
addopts = --doctest-modules

0 comments on commit 450dc1b

Please sign in to comment.