{ "info": { "author": "Paul Sokolovsky", "author_email": "pfalcon@users.sourceforge.net", "bugtrack_url": null, "classifiers": [], "description": "picoweb\n=======\n\npicoweb is a \"micro\" web micro-framework (thus, \"pico-framework\") for\nradically unbloated web applications using radically unbloated Python\nimplementation, Pycopy, https://github.com/pfalcon/pycopy .\n\nFeatures:\n\n* Asynchronous from the start, using unbloated asyncio-like library\n for Pycopy (`uasyncio `_).\n This means that ``picoweb`` can process multiple concurrent requests\n at the same time (using I/O and/or CPU multiplexing).\n* Small memory usage. Initial version required about 64K of heap for\n a trivial web app, and since then, it was optimized to allow run\n more or less realistic web app in ~36K of heap. More optimizations\n on all the levels (Pycopy and up) are planned (but may lead to\n API changes).\n* Has API affinity with some well-known Python web micro-framework(s),\n thus it should be an easy start if you have experience with them, and\n existing applications can be potentially ported, instead of requiring\n complete rewrite.\n\n\nRequirements and optional modules\n---------------------------------\n\n``picoweb`` depends on ``uasyncio`` for asynchronous networking\n(https://github.com/pfalcon/pycopy-lib/tree/master/uasyncio).\n``uasyncio`` itself requires `Pycopy `,\na minimalist, lightweight, and resource-efficient Python language\nimplementation.\n\nIt is also indended to be used with ``utemplate``\n(https://github.com/pfalcon/utemplate) for templating, but this is\na \"soft\" dependency - picoweb offers convenience functions to use\n``utemplate`` templates, but if you don't use them or will handle\ntemplating in your app (e.g. with a different library), it won't be\nimported.\n\nFor database access, there are following options (``picoweb`` does\nnot depend on any of them, up to your application to choose):\n\n* `btree `_\n builtin Pycopy module. This is a recommended way to do a database\n storage for `picoweb`, as it allows portability across all Pycopy\n targets, starting with very memory- and storage-limited baremetal systems.\n* ``btreedb`` wrapper on top of ``btree`` builtin module. This may add some\n overhead, but may allow to make an application portable between different\n database backends (`filedb` and `uorm` below).\n https://github.com/pfalcon/pycopy-btreedb\n* ``filedb``, for a simple database using files in a filesystem\n https://github.com/pfalcon/filedb\n* ``uorm``, for Sqlite3 database access (works only with Pycopy\n Unix port) https://github.com/pfalcon/uorm\n\nLast but not least, ``picoweb`` uses a standard ``logging``-compatible\nlogger for diagnostic output (like a connection opened, errors and debug\ninformation). However this output is optional, and otherwise you can use\na custom logging class instead of the standard ``logging``/``ulogging``\nmodule. Due to this, and to not put additional dependencies burden on\nthe small webapps for small systems, ``logging`` module is not included\nin ``picoweb``'s installation dependencies. Instead, a particular app\nusing ``picoweb`` should depend on ``pycopy-ulogging`` or\n``pycopy-logging`` package. Note that to disable use of logging,\nan application should start up using ``WebApp.run(debug=-1)``. The\ndefault value for ``debug`` parameter is 0 however, in which case\npicoweb will use ``ulogging`` module (on which your application needs\nto depend, again).\n\n\nDetails\n-------\n\npicoweb API is roughly based on APIs of other well-known Python web\nframeworks. The strongest affinity is Flask, http://flask.pocoo.org, as\narguably the most popular micro-framework. Some features are also based on\nBottle and Django. Note that this does not mean particular \"compatibility\"\nwith Flask, Bottle, or Django: most existing web frameworks are synchronous\n(and threaded), while picoweb is async framework, so its architecture is\nquite different. However, there is an aim to save porting efforts from\nrepetitive search & replace trials: for example, when methods do similar\nthings, they are likely named the same (but they may take slightly different\nparameters, return different values, and behave slightly differently).\n\nThe biggest difference is async, non-threaded nature of picoweb. That means\nthat the same code may handle multiple requests at the same time, but unlike\nthreaded environment, there's no external context (like thread and thread\nlocal storage) to associate with each request. Thus, there're no \"global\"\n(or thread-local \"global\") request and response objects, like Flask,\nBottle, Django have. Instead, all picoweb functions explicitly pass the\ncurrent request and response objects around.\n\nAlso, picoweb, being unbloated framework, tries to avoid avoidable\nabstractions. For example, HTTP at the lowest level has just read and write\nendpoints of a socket. To dispatch request, picoweb needs to pre-parse\nsome request data from input stream, and it saves that partially (sic!)\nparsed data as a \"request\" object, and that's what passed to application\nhandlers. However, there's no unavoidable need to have a \"response\"\nabstraction - the most efficient/lightweight application may want to\njust write raw HTTP status line, headers, and body to the socket. Thus,\nraw write stream is passed to application handlers as the \"response\" object.\n(But high-level convenience functions to construct an HTTP response are\nprovided).\n\nLast point is questionable conveniences. For example, both Flask and Bottle\nprovide special objects to handle form/get parameters, with features\nlike \"if request variable has only one value, the value is returned directly;\notherwise, list of values is returned\".\n\n*However, Python standard library\nprovides function parse_qs(), which always returns array of values (based\non the fact that any request variable may have more than one value). Given\n2 choices, picoweb follows the interface of the standard library, instead of\nproviding extra wrapper class on top of it.* - Changed in 1.5: now\nnormal single-valued fields store the value directly, a list is used only\nfor multi-valued fields. (Reasons: convenience, reduced memory usage.)\n\n\nAPI reference\n-------------\n\nThe best API reference currently are examples (see below) and the ``picoweb``\nsource code itself. It's under 10K, so enjoy:\nhttps://github.com/pfalcon/picoweb/blob/master/picoweb/__init__.py\n\nNote that API is experimental and may undergo changes.\n\n\nExamples\n--------\n\n* `example_webapp.py `_ -\n A simple webapp showing you how to generate a complete HTTP response\n yourself, use ``picoweb`` convenience functions for HTTP headers generation,\n and use of templates. Mapping from URLs to webapp view functions (\"web\n routes\" or just \"routes\") is done Django-style, using a centralized route\n list.\n* `example_webapp2.py `_ -\n Like above, but uses ``app.route()`` decorator for route specification,\n Flask-style.\n* `examples/ `_ -\n Additional examples for various features of picoweb. See comments in each\n file for additional info. To run examples in this directory, you normally\n would need to have picoweb installed (i.e. available in your ``MICROPYPATH``,\n which defaults to ``~/.micropython/lib/``).\n* `notes-pico `_ - A more realistic\n example webapp, ported from the Flask original.\n\n\nRunning under CPython (regressed)\n---------------------------------\n\nInitial versions of picoweb could run under CPython, but later it was\nfurther optimized for Pycopy, and ability to run under CPython\nregressed. It's still on TODO to fix it, instructions below tell how\nit used to work.\n\nAt least CPython 3.4.2 is required (for asyncio loop.create_task() support).\nTo run under CPython, uasyncio compatibility module for CPython is required\n(pycopy-cpython-uasyncio). This and other dependencies can be installed\nusing requirements-cpython.txt::\n\n pip install -r requirements-cpython.txt\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pfalcon/picoweb", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "picoweb", "package_url": "https://pypi.org/project/picoweb/", "platform": "", "project_url": "https://pypi.org/project/picoweb/", "project_urls": { "Homepage": "https://github.com/pfalcon/picoweb" }, "release_url": "https://pypi.org/project/picoweb/1.8/", "requires_dist": null, "requires_python": "", "summary": "A very lightweight, memory-efficient async web framework for Pycopy (https://github.com/pfalcon/pycopy) and its uasyncio module.", "version": "1.8" }, "last_serial": 5965406, "releases": { "1.2": [ { "comment_text": "", "digests": { "md5": "4411de03c67b0087afe0c4be96c65ff9", "sha256": "e12ee1eda4ed680ff26fb64b105c387634b5fcb1237c45a9561f620d7f192e1f" }, "downloads": -1, "filename": "picoweb-1.2.tar.gz", "has_sig": false, "md5_digest": "4411de03c67b0087afe0c4be96c65ff9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3379, "upload_time": "2017-06-10T14:18:10", "url": "https://files.pythonhosted.org/packages/07/a1/ac79de53d38d6ae531c857f3d9291afaa27d90c58eca9a1d295d99f7546a/picoweb-1.2.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "794e40d9640895521778a1bbd641f316", "sha256": "fc017d72743bcef8126625cec806e5ff7c0d6a7715edd927b69b9e660cf87999" }, "downloads": -1, "filename": "picoweb-1.2.2.tar.gz", "has_sig": false, "md5_digest": "794e40d9640895521778a1bbd641f316", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3472, "upload_time": "2017-07-01T15:56:52", "url": "https://files.pythonhosted.org/packages/22/be/7e7cabe1ac2607d849557314f8e48f6d9e0c13c64c47029ae250e9020942/picoweb-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "84bcd7a73ace7a00e80fa2d741a55db8", "sha256": "0ec92aa12a7ea1b78ad3173a82d9daa6a87b2156789a5804e6ed60f21cebe63a" }, "downloads": -1, "filename": "picoweb-1.2.3.tar.gz", "has_sig": false, "md5_digest": "84bcd7a73ace7a00e80fa2d741a55db8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3536, "upload_time": "2017-11-11T23:05:56", "url": "https://files.pythonhosted.org/packages/e2/33/2b8d674c155bc9c28c8513d77634020f3b514608a47080188212dedadc36/picoweb-1.2.3.tar.gz" } ], "1.5": [ { "comment_text": "", "digests": { "md5": "21d73062fb2300fccf8e0d16422b1c76", "sha256": "ab01c60f3a8cd86c3b7b9135b09f3c936a0ef379434c47e7b45cce180a3917d0" }, "downloads": -1, "filename": "picoweb-1.5.tar.gz", "has_sig": false, "md5_digest": "21d73062fb2300fccf8e0d16422b1c76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7409, "upload_time": "2018-11-15T18:55:21", "url": "https://files.pythonhosted.org/packages/5a/99/682423a4b9ad3a2f32fbd36c8e6a7acca77faea5726ac9bae3bb4e09ded1/picoweb-1.5.tar.gz" } ], "1.5.1": [ { "comment_text": "", "digests": { "md5": "5fb6b8b83ee133ae1a47a037316881e5", "sha256": "2df4986e0fe0899ba3518edb78bea6b50d6f0a37c613f7f5017ecd27c4797b0e" }, "downloads": -1, "filename": "picoweb-1.5.1.tar.gz", "has_sig": false, "md5_digest": "5fb6b8b83ee133ae1a47a037316881e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7399, "upload_time": "2018-11-21T19:32:26", "url": "https://files.pythonhosted.org/packages/56/5c/4540e02d8be5b4dc3cc705a3047fb54c1d79e98f49b115290d7a2e736f5d/picoweb-1.5.1.tar.gz" } ], "1.5.3": [ { "comment_text": "", "digests": { "md5": "c0743d8665e2338ac250b501a24bdd76", "sha256": "61c30367c3d6442ed1c5ac75e82d683f9af3d8e65b49bfd919328558d4430a8d" }, "downloads": -1, "filename": "picoweb-1.5.3.tar.gz", "has_sig": false, "md5_digest": "c0743d8665e2338ac250b501a24bdd76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7731, "upload_time": "2019-05-06T15:20:56", "url": "https://files.pythonhosted.org/packages/8b/14/6a1a8b3abf0cfcabaa6fbe35dab1fe4f6a11c3538b727417bfef993bb097/picoweb-1.5.3.tar.gz" } ], "1.5.4": [ { "comment_text": "", "digests": { "md5": "847da2a21cbab6240f051e87d1e3a68f", "sha256": "c9e3ddf702405ef14f438b1b9ac88a0cdd2b899a3e08b0b4e8579ab2458e578f" }, "downloads": -1, "filename": "picoweb-1.5.4.tar.gz", "has_sig": false, "md5_digest": "847da2a21cbab6240f051e87d1e3a68f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7721, "upload_time": "2019-05-06T19:28:59", "url": "https://files.pythonhosted.org/packages/41/99/d4af0bc8e3e67ab02d0819c46463c5cf69cab9af4bc149651a571f144f22/picoweb-1.5.4.tar.gz" } ], "1.7.1": [ { "comment_text": "", "digests": { "md5": "16b4a2d65e1896d41f011435dfe291ee", "sha256": "b43681abe80bbfae0478170ae067e32a20a785ec9935b550e697cedf41a9ad69" }, "downloads": -1, "filename": "picoweb-1.7.1.tar.gz", "has_sig": false, "md5_digest": "16b4a2d65e1896d41f011435dfe291ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7720, "upload_time": "2019-07-19T18:01:51", "url": "https://files.pythonhosted.org/packages/1b/4f/f7d35f90521e95d9d2307f69ff523133d7d4dd6da7ce1ce0c8382e7255fa/picoweb-1.7.1.tar.gz" } ], "1.7.2": [ { "comment_text": "", "digests": { "md5": "e6d3727acf03627d9b2adc70dcbd831c", "sha256": "782704b22383a47ecd9446aab43d631b38c7d88bf1e67d1c0041e9345b15c1af" }, "downloads": -1, "filename": "picoweb-1.7.2.tar.gz", "has_sig": false, "md5_digest": "e6d3727acf03627d9b2adc70dcbd831c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7791, "upload_time": "2019-08-05T16:38:02", "url": "https://files.pythonhosted.org/packages/a7/cb/1b48103a22f8d67985af5e30ee157c195d2a37b12864e6e8744ad8e7e1b6/picoweb-1.7.2.tar.gz" } ], "1.8": [ { "comment_text": "", "digests": { "md5": "0f8331193276e92a17b665ca21b7c5fc", "sha256": "1664aa4eae584463fe373459cb8a5bc4b80df0fa23fa030d09bf800e2abcb03d" }, "downloads": -1, "filename": "picoweb-1.8.tar.gz", "has_sig": false, "md5_digest": "0f8331193276e92a17b665ca21b7c5fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7870, "upload_time": "2019-10-12T21:17:55", "url": "https://files.pythonhosted.org/packages/27/47/5d70d23ecc778bff5fdae3ef2eb57d59aff4a260da1b907b4d608e6486da/picoweb-1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0f8331193276e92a17b665ca21b7c5fc", "sha256": "1664aa4eae584463fe373459cb8a5bc4b80df0fa23fa030d09bf800e2abcb03d" }, "downloads": -1, "filename": "picoweb-1.8.tar.gz", "has_sig": false, "md5_digest": "0f8331193276e92a17b665ca21b7c5fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7870, "upload_time": "2019-10-12T21:17:55", "url": "https://files.pythonhosted.org/packages/27/47/5d70d23ecc778bff5fdae3ef2eb57d59aff4a260da1b907b4d608e6486da/picoweb-1.8.tar.gz" } ] }