Documentation Sphinx is a tool that makes it easy to create intelligent and beautiful documentation. It was originally created for the Python documentation, and it has excellent facilities for the documentation of software projects in a range of languages. The following features should be highlighted: Output formats: HTML (including Windows HTML Help), LaTeX (for printable PDF versions), ePub, Texinfo, manual pages, plain text Extensive cross-references: semantic markup and automatic links for functions, classes, citations, glossary terms and similar pieces of information Hierarchical structure: easy definition of a document tree, with automatic links to siblings, parents and children Automatic indices: general index as well as a language-specific module indices Code handling: automatic highlighting using the Pygments highlighter Extensions: automatic testing of code snippets, inclusion of docstrings from Python modules (API docs), and more Contributed extensions: more than 50 extensions contributed by users in a second repository; most of them installable from PyPI Sphinx uses reStructuredText as its markup language, and many of its strengths come from the power and straightforwardness of reStructuredText and its parsing and translating suite, the Docutils.

Read More…

Scenario While implementing wxgigo project, I need create an agent which will receive the POST requests from Wechat server, then relay to AMQP broker. In the appserver side, celery workers fetch messages from AMQP server and save result in result backend, finally agent will retrieve the result for result backend and return to Wechat server. Agent: +----------------+ | Wechat Server | +----------------+ | |http post +-----------------------------------------|---------------------------------+ | Wxgigo Agent Server +-------------------+ | | | nginx | | | +-------------------+ | | |forward http post | | | | | +--------------+ +--------------+ +--------------+ | | | wxgigo agent | | wxgigo agent | | wxgigo agent | | | +--------------+ +--------------+ +--------------+ | +------------------------------------------|--------------------------------+ |AMQP message | +-----------------+ | AMQP Broker | +-----------------+ Consideration By comparing multiple python web framework benchmark, I prefer to choose Tornado as the base framework for it’s async supportability, but to utilize this async feature for performance consideration, it need decouple all the steps to be async ready including connecting to broker, send message, receive message reply, retrieve result from backend…

Read More…

tornado-coroutine

2017-04-19

Preface What’s the difference between normal function and coroutine: coroutines are functions that allow for multiple entry points, that can yield multiple times, and resume their execution when called again. coroutines can transfer execution to any other coroutine instead of just the coroutine that called them. Functions, being special cases of coroutines, have a single entry point, can only yield once, and can only transfer execution back to the caller

Read More…