diff --git a/docs/conf.py b/docs/conf.py index 21b9b9cf..c97f3c19 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ import sanic # -- General configuration ------------------------------------------------ -extensions = [] +extensions = ['sphinx.ext.autodoc'] templates_path = ['_templates'] @@ -68,7 +68,6 @@ pygments_style = 'sphinx' # 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 @@ -80,13 +79,11 @@ html_theme = 'sphinx_rtd_theme' # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] - # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. htmlhelp_basename = 'Sanicdoc' - # -- Options for LaTeX output --------------------------------------------- latex_elements = { @@ -110,21 +107,14 @@ latex_elements = { # 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 = [ - (master_doc, 'Sanic.tex', 'Sanic Documentation', - 'Sanic contributors', 'manual'), -] - +latex_documents = [(master_doc, 'Sanic.tex', 'Sanic Documentation', + 'Sanic contributors', 'manual'), ] # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'sanic', 'Sanic Documentation', - [author], 1) -] - +man_pages = [(master_doc, 'sanic', 'Sanic Documentation', [author], 1)] # -- Options for Texinfo output ------------------------------------------- @@ -132,13 +122,10 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'Sanic', 'Sanic Documentation', - author, 'Sanic', 'One line description of project.', - 'Miscellaneous'), + (master_doc, 'Sanic', 'Sanic Documentation', author, 'Sanic', + 'One line description of project.', 'Miscellaneous'), ] - - # -- Options for Epub output ---------------------------------------------- # Bibliographic Dublin Core info. @@ -150,8 +137,6 @@ epub_copyright = copyright # A list of files that should not be packed into the epub file. epub_exclude_files = ['search.html'] - - # -- Custom Settings ------------------------------------------------------- suppress_warnings = ['image.nonlocal_uri'] diff --git a/docs/index.rst b/docs/index.rst index 43cd0ba2..3fa63d5c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -16,6 +16,7 @@ Guides sanic/blueprints sanic/config sanic/cookies + sanic/streaming sanic/class_based_views sanic/custom_protocol sanic/ssl diff --git a/docs/config.md b/docs/sanic/config.md similarity index 100% rename from docs/config.md rename to docs/sanic/config.md diff --git a/docs/sanic/index.rst b/docs/sanic/index.rst index eb9eb286..08797e9f 100644 --- a/docs/sanic/index.rst +++ b/docs/sanic/index.rst @@ -7,8 +7,8 @@ On top of being Flask-like, Sanic supports async request handlers. This means y Sanic is developed `on GitHub `_. Contributions are welcome! -Sanic aspires to be simple: -------------------- +Sanic aspires to be simple +--------------------------- .. code:: python diff --git a/environment.yml b/environment.yml index 7eee43a5..298ea552 100644 --- a/environment.yml +++ b/environment.yml @@ -15,4 +15,5 @@ dependencies: - httptools>=0.0.9 - ujson>=1.35 - aiofiles>=0.3.0 + - websockets>=3.2 - https://github.com/channelcat/docutils-fork/zipball/master \ No newline at end of file diff --git a/sanic/app.py b/sanic/app.py index 63e466ec..248bb029 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -320,7 +320,7 @@ class Sanic: the output URL's query string. :param view_name: string referencing the view name - :param **kwargs: keys and values that are used to build request + :param \*\*kwargs: keys and values that are used to build request parameters and query string arguments. :return: the built URL diff --git a/sanic/response.py b/sanic/response.py index eb2d3e49..c129884f 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -251,8 +251,7 @@ def text(body, status=200, headers=None, :param body: Response data to be encoded. :param status: Response code. :param headers: Custom Headers. - :param content_type: - the content type (string) of the response + :param content_type: the content type (string) of the response """ return HTTPResponse( body, status=status, headers=headers, @@ -266,8 +265,7 @@ def raw(body, status=200, headers=None, :param body: Response data. :param status: Response code. :param headers: Custom Headers. - :param content_type: - the content type (string) of the response + :param content_type: the content type (string) of the response. """ return HTTPResponse(body_bytes=body, status=status, headers=headers, content_type=content_type) @@ -316,17 +314,16 @@ def stream( content_type="text/plain; charset=utf-8"): """Accepts an coroutine `streaming_fn` which can be used to write chunks to a streaming response. Returns a `StreamingHTTPResponse`. - Example usage: - ``` - @app.route("/") - async def index(request): - async def streaming_fn(response): - await response.write('foo') - await response.write('bar') + Example usage:: - return stream(streaming_fn, content_type='text/plain') - ``` + @app.route("/") + async def index(request): + async def streaming_fn(response): + await response.write('foo') + await response.write('bar') + + return stream(streaming_fn, content_type='text/plain') :param streaming_fn: A coroutine accepts a response and writes content to that response. diff --git a/sanic/router.py b/sanic/router.py index 38b1c029..2819cc7c 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -75,9 +75,10 @@ class Router: """Parse a parameter string into its constituent name, type, and pattern - For example: - `parse_parameter_string('')` -> - ('param_one', str, '[A-z]') + For example:: + + parse_parameter_string('')` -> + ('param_one', str, '[A-z]') :param parameter_string: String to parse :return: tuple containing diff --git a/sanic/server.py b/sanic/server.py index 39816e28..11601c00 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -329,7 +329,7 @@ def serve(host, port, request_handler, error_handler, before_start=None, `app` instance and `loop` :param after_stop: function to be executed when a stop signal is received after it is respected. Takes arguments - `app` instance and `loop` + `app` instance and `loop` :param debug: enables debug output (slows server) :param request_timeout: time in seconds :param ssl: SSLContext