diff --git a/Makefile b/Makefile index b15db210..bc1aa898 100755 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ install: # cleanup everything clean: + rm -rf ./docs/build rm -rf ./.cache rm -rf ./autobahn.egg-info rm -rf ./build diff --git a/autobahn/__init__.py b/autobahn/__init__.py index 4040a824..bebe2b29 100644 --- a/autobahn/__init__.py +++ b/autobahn/__init__.py @@ -24,7 +24,8 @@ # ############################################################################### -__version__ = u'0.13.1' -""" -AutobahnPython library version. -""" +from __future__ import absolute_import + +from autobahn._version import __version__ + +version = __version__ diff --git a/autobahn/_version.py b/autobahn/_version.py new file mode 100644 index 00000000..4040a824 --- /dev/null +++ b/autobahn/_version.py @@ -0,0 +1,30 @@ +############################################################################### +# +# The MIT License (MIT) +# +# Copyright (c) Tavendo GmbH +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +############################################################################### + +__version__ = u'0.13.1' +""" +AutobahnPython library version. +""" diff --git a/docs/conf.py b/docs/conf.py index 8dc8dc8c..c8c8449c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,24 +14,91 @@ import sys import os +import shlex +import time + +try: + import sphinx_rtd_theme +except ImportError: + sphinx_rtd_theme = None + +try: + from sphinxcontrib import spelling +except ImportError: + spelling = None + # If extensions (or modules to document with autodoc) are in another directory, # 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. -#sys.path.insert(0, os.path.abspath('.')) +sys.path.insert(0, os.path.abspath('./_extensions')) +sys.path.insert(0, os.path.abspath('..')) + +# monkey-patch txaio so that we can "use" both twisted *and* asyncio, +# at least at import time -- this is so the autodoc stuff can +# successfully import autobahn.twisted.* as well as autobahn.asyncio.* +# (usually, you can only import one or the other in a single Python +# interpreter) +import txaio + +def use_tx(): + "monkey-patched for doc-building" + from txaio import tx + txaio._use_framework(tx) + +def use_aio(): + "monkey-patched for doc-building" + from txaio import aio + txaio._use_framework(aio) + +txaio.use_twisted = use_tx +txaio.use_asyncio = use_aio + + +# Monkey patch away WARNING like: +# "index.rst:4: WARNING: nonlocal image URI found: https://img.shields.io/pypi/v/txaio.svg" +# see: http://stackoverflow.com/a/28778969 +import sphinx.environment +from docutils.utils import get_source_line + +def _warn_node(self, msg, node): + if not msg.startswith('nonlocal image URI found:'): + self._warnfunc(msg, '%s:%s' % get_source_line(node)) + +sphinx.environment.BuildEnvironment.warn_node = _warn_node + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' +# Check if we are building on readthedocs +RTD_BUILD = os.environ.get('READTHEDOCS', None) == 'True' + # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.viewcode', + 'sphinx.ext.autodoc', + 'sphinx.ext.viewcode', + 'sphinx.ext.intersphinx', + + 'sphinx.ext.ifconfig', + 'sphinx.ext.todo', + 'sphinx.ext.doctest', + #'sphinxcontrib.spelling', + 'txsphinx' ] +# extensions not available on RTD +if spelling is not None: + extensions.append('sphinxcontrib.spelling') + +spelling_lang = 'en_US' +spelling_show_suggestions = False +spelling_word_list_filename = 'spelling_wordlist.txt' + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -42,24 +109,30 @@ source_suffix = '.rst' #source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = 'contents' # General information about the project. project = u'autobahn' -copyright = u'2016, Crossbar.io Project' +author = u'Tavendo' +this_year = u'{0}'.format(time.strftime('%Y')) +if this_year != u'2012': + copyright = u'2012-{0}, Tavendo GmbH'.format(this_year) +else: + copyright = u'2012, Tavendo GmbH' # 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. # -# The short X.Y version. -version = '0.13.2' -# The full version, including alpha/beta/rc tags. -release = '0.13.2' +base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) +with open(os.path.join(base_dir, "autobahn", "_version.py")) as f: + exec(f.read()) # defines __version__ + +version = release = __version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +language = 'en' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -69,7 +142,7 @@ release = '0.13.2' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = [] +exclude_patterns = ['_build', 'work'] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -95,12 +168,19 @@ pygments_style = 'sphinx' # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +if sphinx_rtd_theme: + html_theme = "sphinx_rtd_theme" + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] +else: + html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -129,7 +209,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = [] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -145,7 +225,17 @@ html_static_path = ['_static'] #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# Show full, global TOC in sidebar +# http://stackoverflow.com/a/19007358 +# http://sphinx-doc.org/config.html#confval-html_sidebars +html_sidebars = { + '**': [ + 'globaltoc.html', + 'relations.html', + 'sourcelink.html', + 'searchbox.html' + ], +} # Additional templates that should be rendered to pages, maps page names to # template names. @@ -180,81 +270,36 @@ html_static_path = ['_static'] # Output file base name for HTML help builder. htmlhelp_basename = 'autobahndoc' - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', +# http://sphinx-doc.org/ext/intersphinx.html +intersphinx_mapping = { + 'py2': ('http://docs.python.org/2', None), + 'py3': ('http://docs.python.org/3', None), + 'six': ('https://pythonhosted.org/six/', None), } -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ('index', 'autobahn.tex', u'autobahn Documentation', - u'Crossbar.io Project', 'manual'), -] +rst_epilog = """ +.. |ab| replace:: Autobahn +.. |Ab| replace:: **Autobahn** +.. |abL| replace:: Autobahn|Python +.. |AbL| replace:: **Autobahn**\|Python +.. _Autobahn: http://autobahn.ws +.. _AutobahnJS: http://autobahn.ws/js +.. _AutobahnPython: **Autobahn**\|Python +.. _WebSocket: http://tools.ietf.org/html/rfc6455 +.. _RFC6455: http://tools.ietf.org/html/rfc6455 +.. _WAMP: http://wamp.ws/ +.. _Twisted: http://twistedmatrix.com/ +.. _asyncio: http://docs.python.org/3.4/library/asyncio.html +.. _CPython: http://python.org/ +.. _PyPy: http://pypy.org/ +.. _Jython: http://jython.org/ +.. _WAMP: http://wamp.ws/ +.. _WAMPv1: http://wamp.ws/spec/wamp1/ +.. _WAMPv2: https://github.com/wamp-proto/wamp-proto/blob/master/spec/README.md +.. _AutobahnTestsuite: http://autobahn.ws/testsuite +.. _trollius: https://pypi.python.org/pypi/trollius/ +.. _tulip: https://pypi.python.org/pypi/asyncio/ +""" -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'autobahn', u'autobahn Documentation', - [u'Crossbar.io Project'], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ('index', 'autobahn', u'autobahn Documentation', - u'Crossbar.io Project', 'autobahn', 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False +rst_prolog = """ +""" diff --git a/docs/index.rst b/docs/index.rst index 2c011191..bfa7919d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,25 +1,12 @@ |AbL| ===== +| |Version| |Downloads| |Build Status| |Coverage| |Docs| + +-------------- + *Open-source (MIT) real-time framework for Web, Mobile & Internet of Things.* -Latest release: v\ |version| (:ref:`changelog`) - -.. ifconfig:: not no_network - - .. raw:: html - -

- - Build Status - - - Downloads - -

- ------ - |AbL| is part of the `Autobahn`_ project and provides open-source implementations of * `The WebSocket Protocol `_ @@ -242,3 +229,25 @@ Finally, we are on `Twitter `_. reference/autobahn contribute changelog + + +.. |Version| image:: https://img.shields.io/pypi/v/autobahn.svg + :target: https://pypi.python.org/pypi/autobahn + +.. |Downloads| image:: https://img.shields.io/pypi/dm/autobahn.svg + :target: https://pypi.python.org/pypi/autobahn + +.. |GitHub Stars| image:: https://img.shields.io/github/stars/crossbario/autobahn-python.svg?style=social&label=Star + :target: https://github.com/crossbario/autobahn-python + +.. |Master Branch| image:: https://img.shields.io/badge/branch-master-orange.svg + :target: https://travis-ci.org/crossbario/autobahn-python.svg?branch=master + +.. |Build Status| image:: https://travis-ci.org/crossbario/autobahn-python.svg?branch=master + :target: https://travis-ci.org/crossbario/autobahn-python + +.. |Coverage| image:: https://img.shields.io/codecov/c/github/crossbario/autobahn-python/master.svg + :target: https://codecov.io/github/crossbario/autobahn-python + +.. |Docs| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat + :target: http://autobahn.readthedocs.org/en/latest/ diff --git a/setup.py b/setup.py index be1dd01b..c8ee34cc 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ PY3 = sys.version_info >= (3,) PY33 = (3, 3) <= sys.version_info < (3, 4) # read version string -with open('autobahn/__init__.py') as f: +with open('autobahn/_version.py') as f: exec(f.read()) # defines __version__ # read package long description @@ -99,7 +99,7 @@ extras_require_compress = [ # non-JSON WAMP serialization support (namely MsgPack, CBOR and UBJSON) os.environ['PYUBJSON_NO_EXTENSION'] = '1' # enforce use of pure Python py-ubjson (no Cython) extras_require_serialization = [ - "msgpack-python>=0.4.6", # Apache 2.0 license + "u-msgpack-python>=2.1", # MIT license "cbor>=0.1.24", # Apache 2.0 license "py-ubjson>=0.8.3" # Apache 2.0 license ] @@ -114,21 +114,26 @@ extras_require_encryption = [ # everything extras_require_all = extras_require_twisted + extras_require_asyncio + \ - extras_require_accelerate + extras_require_serialization + extras_require_encryption + extras_require_accelerate + extras_require_compress + \ + extras_require_serialization + extras_require_encryption # extras_require_all += extras_require_compress # development dependencies extras_require_dev = [ # flake8 will install the version "it needs" - # "pep8>=1.6.2", # MIT license - "pep8-naming>=0.3.3", # MIT license - "flake8>=2.5.1", # MIT license - "pyflakes>=1.0.0", # MIT license - "mock>=1.3.0", # BSD license - "pytest>=2.8.6", # MIT license - "unittest2>=1.1.0", # BSD license - "twine>=1.6.5", # Apache 2.0 + # "pep8>=1.6.2", # MIT license + "pep8-naming>=0.3.3", # MIT license + "flake8>=2.5.1", # MIT license + "pyflakes>=1.0.0", # MIT license + "mock>=1.3.0", # BSD license + "pytest>=2.8.6", # MIT license + "unittest2>=1.1.0", # BSD license + "twine>=1.6.5", # Apache 2.0 + 'sphinx>=1.2.3', # BSD + 'pyenchant>=1.6.6', # LGPL + 'sphinxcontrib-spelling>=2.1.2', # BSD + 'sphinx_rtd_theme>=0.1.9', # BSD ] # for testing by users with "python setup.py test" (not Tox, which we use)