aiohttp-devtools
================
|Coverage| |pypi| |license|
Dev tools for `aiohttp`_.
**aiohttp-devtools** provides a number of tools useful when developing applications with aiohttp and associated
libraries.
Installation
------------
.. code:: shell
pip install aiohttp-devtools
Usage
-----
The ``aiohttp-devtools`` CLI (and it's shorter alias ``adev``) consist of two sub-commands:
`runserver`_ and `serve`_.
runserver
~~~~~~~~~
Provides a simple local server for running your application while you're developing.
Usage is simply
.. code:: shell
adev runserver <app-path>
**Note:** ``adev runserver <app-path>`` will import the whole file, hence it doesn't work
with ``web.run_app(app)``. You can however use ``if __name__ == '__main__': web.run_app(app)``.
``app-path`` can be a path to either a directory containing a recognized default file (``app.py``
or ``main.py``) or to a specific file. The ``--app-factory`` option can be used to define which method is called
from the app path file, if not supplied some default method names are tried
(namely `app`, `app_factory`, `get_app` and `create_app`, which can be
variables, functions, or coroutines).
All ``runserver`` arguments can be set via environment variables.
``runserver`` has a few useful features:
* **livereload** will reload resources in the browser as your code changes without having to hit refresh, see `livereload`_ for more details.
* **static files** are served separately from your main app (generally on ``8001`` while your app is on ``8000``) so you don't have to contaminate your application to serve static files you only need locally.
For more options see ``adev runserver --help``.
serve
~~~~~
Similar to `runserver`_ except just serves static files.
Usage is simply
.. code:: shell
adev serve <path-to-directory-to-serve>
Like ``runserver`` you get nice live reloading and access logs. For more options see ``adev serve --help``.
Tutorial
--------
To demonstrate what adev can do when combined with create-aio-app, let's walk through creating a new application:
First let's create a clean python environment to work in and install aiohttp-devtools and create-aio-app.
(it is assumed you've already got **python**, **pip** and **virtualenv** installed)
.. code:: shell
mkdir my_new_app && cd my_new_app
virtualenv -p `which python3` env
. env/bin/activate
pip install aiohttp-devtools create-aio-app
We're now ready to build our new application with ``create-aio-app`` and we'll name the
project ``my_new_app`` after the current directory.
We're going to explicitly choose no database here to make this tutorial easier, but you can remove that option
and choose to use a proper database if you like.
You can just hit return to choose the default for all the options.
.. code:: shell
create-aio-app my_new_app --without-postgres
That's it, your app is now created. You might want to have a look through the local directory's file tree.
Before you can run your app you'll need to install the other requirements, luckily they've already been listed in
``requirements/development.txt`` by ``create-aio-app``, to install simply run
.. code:: shell
pip install -r requirements/development.txt
You can then run your app with just:
.. code:: shell
adev runserver
With that:
* your app should be being served at ``localhost:8000`` (you can go and play with it in a browser).
* Your static files are being served at ``localhost:8001``, adev has configured your app to know that so it should be rendering properly.
* any changes to your app's code (``.py`` files) should cause the server to reload, changes to any files
(``.py`` as well as ``.jinja``, ``.js``, ``.css`` etc.) will cause livereload to prompt your browser to reload the required pages.
**That's it, go develop.**
.. |Coverage| image:: https://codecov.io/gh/aio-libs/aiohttp-devtools/branch/master/graph/badge.svg
:target: https://codecov.io/gh/aio-libs/aiohttp-devtools
.. |pypi| image:: https://img.shields.io/pypi/v/aiohttp-devtools.svg
:target: https://pypi.python.org/pypi/aiohttp-devtools
.. |license| image:: https://img.shields.io/pypi/l/aiohttp-devtools.svg
:target: https://github.com/aio-libs/aiohttp-devtools
.. _Changes.txt: /CHANGES.txt
.. _livereload: https://github.com/livereload/livereload-js
.. _aiohttp: http://aiohttp.readthedocs.io/en/stable/
Raw data
{
"_id": null,
"home_page": "https://github.com/aio-libs/aiohttp-devtools",
"name": "aiohttp-devtools",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Samuel Colvin",
"author_email": "s@muelcolvin.com",
"download_url": "https://files.pythonhosted.org/packages/45/dc/b3f41aab488d024f4cff584241e4c9b9e2309750e391d5116cd6d640e3bc/aiohttp-devtools-1.1.1.tar.gz",
"platform": null,
"description": "aiohttp-devtools\n================\n\n|Coverage| |pypi| |license|\n\nDev tools for `aiohttp`_.\n\n**aiohttp-devtools** provides a number of tools useful when developing applications with aiohttp and associated\nlibraries.\n\nInstallation\n------------\n\n.. code:: shell\n\n pip install aiohttp-devtools\n\nUsage\n-----\n\nThe ``aiohttp-devtools`` CLI (and it's shorter alias ``adev``) consist of two sub-commands:\n`runserver`_ and `serve`_.\n\nrunserver\n~~~~~~~~~\n\nProvides a simple local server for running your application while you're developing.\n\nUsage is simply\n\n.. code:: shell\n\n adev runserver <app-path>\n\n**Note:** ``adev runserver <app-path>`` will import the whole file, hence it doesn't work\nwith ``web.run_app(app)``. You can however use ``if __name__ == '__main__': web.run_app(app)``.\n\n``app-path`` can be a path to either a directory containing a recognized default file (``app.py``\nor ``main.py``) or to a specific file. The ``--app-factory`` option can be used to define which method is called\nfrom the app path file, if not supplied some default method names are tried\n(namely `app`, `app_factory`, `get_app` and `create_app`, which can be\nvariables, functions, or coroutines).\n\nAll ``runserver`` arguments can be set via environment variables.\n\n``runserver`` has a few useful features:\n\n* **livereload** will reload resources in the browser as your code changes without having to hit refresh, see `livereload`_ for more details.\n* **static files** are served separately from your main app (generally on ``8001`` while your app is on ``8000``) so you don't have to contaminate your application to serve static files you only need locally.\n\nFor more options see ``adev runserver --help``.\n\nserve\n~~~~~\n\nSimilar to `runserver`_ except just serves static files.\n\nUsage is simply\n\n.. code:: shell\n\n adev serve <path-to-directory-to-serve>\n\nLike ``runserver`` you get nice live reloading and access logs. For more options see ``adev serve --help``.\n\nTutorial\n--------\n\nTo demonstrate what adev can do when combined with create-aio-app, let's walk through creating a new application:\n\nFirst let's create a clean python environment to work in and install aiohttp-devtools and create-aio-app.\n\n(it is assumed you've already got **python**, **pip** and **virtualenv** installed)\n\n.. code:: shell\n\n mkdir my_new_app && cd my_new_app\n virtualenv -p `which python3` env\n . env/bin/activate\n pip install aiohttp-devtools create-aio-app\n\n\nWe're now ready to build our new application with ``create-aio-app`` and we'll name the\nproject ``my_new_app`` after the current directory.\n\nWe're going to explicitly choose no database here to make this tutorial easier, but you can remove that option\nand choose to use a proper database if you like.\n\nYou can just hit return to choose the default for all the options.\n\n\n.. code:: shell\n\n create-aio-app my_new_app --without-postgres\n\nThat's it, your app is now created. You might want to have a look through the local directory's file tree.\n\nBefore you can run your app you'll need to install the other requirements, luckily they've already been listed in\n``requirements/development.txt`` by ``create-aio-app``, to install simply run\n\n.. code:: shell\n\n pip install -r requirements/development.txt\n\nYou can then run your app with just:\n\n.. code:: shell\n\n adev runserver\n\nWith that:\n\n* your app should be being served at ``localhost:8000`` (you can go and play with it in a browser).\n* Your static files are being served at ``localhost:8001``, adev has configured your app to know that so it should be rendering properly.\n* any changes to your app's code (``.py`` files) should cause the server to reload, changes to any files\n (``.py`` as well as ``.jinja``, ``.js``, ``.css`` etc.) will cause livereload to prompt your browser to reload the required pages.\n\n**That's it, go develop.**\n\n.. |Coverage| image:: https://codecov.io/gh/aio-libs/aiohttp-devtools/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/aio-libs/aiohttp-devtools\n.. |pypi| image:: https://img.shields.io/pypi/v/aiohttp-devtools.svg\n :target: https://pypi.python.org/pypi/aiohttp-devtools\n.. |license| image:: https://img.shields.io/pypi/l/aiohttp-devtools.svg\n :target: https://github.com/aio-libs/aiohttp-devtools\n.. _Changes.txt: /CHANGES.txt\n.. _livereload: https://github.com/livereload/livereload-js\n.. _aiohttp: http://aiohttp.readthedocs.io/en/stable/\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Dev tools for aiohttp",
"version": "1.1.1",
"project_urls": {
"CI: AppVeyor": "https://ci.appveyor.com/project/aio-libs/aiohttp-devtools",
"CI: Travis": "https://travis-ci.com/aio-libs/aiohttp-devtools",
"Coverage: codecov": "https://codecov.io/github/aio-libs/aiohttp-devtools",
"GitHub: issues": "https://github.com/aio-libs/aiohttp-devtools/issues",
"GitHub: repo": "https://github.com/aio-libs/aiohttp-devtools",
"Homepage": "https://github.com/aio-libs/aiohttp-devtools"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7bbe700b5df01e762e2464b644c03d4825c3837731a19568731c38eaf5c3f0b5",
"md5": "78df8a04351c6da975eee60ef1ad12cd",
"sha256": "9911da1dafe60b3c7011c88f6cfff130093e8dbc0168c99f008716d63cfadf80"
},
"downloads": -1,
"filename": "aiohttp_devtools-1.1.1-py38.py39.py310.py311-none-any.whl",
"has_sig": false,
"md5_digest": "78df8a04351c6da975eee60ef1ad12cd",
"packagetype": "bdist_wheel",
"python_version": "py38.py39.py310.py311",
"requires_python": ">=3.8",
"size": 31631,
"upload_time": "2023-11-19T16:26:41",
"upload_time_iso_8601": "2023-11-19T16:26:41.690402Z",
"url": "https://files.pythonhosted.org/packages/7b/be/700b5df01e762e2464b644c03d4825c3837731a19568731c38eaf5c3f0b5/aiohttp_devtools-1.1.1-py38.py39.py310.py311-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "45dcb3f41aab488d024f4cff584241e4c9b9e2309750e391d5116cd6d640e3bc",
"md5": "91cd70860263ff0cb1381aa234d957bf",
"sha256": "735ab26b5f135a4058181924ccc839a3ca155bc1ce8aa0bd0e8c521591a9eb65"
},
"downloads": -1,
"filename": "aiohttp-devtools-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "91cd70860263ff0cb1381aa234d957bf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 37833,
"upload_time": "2023-11-19T16:26:43",
"upload_time_iso_8601": "2023-11-19T16:26:43.306899Z",
"url": "https://files.pythonhosted.org/packages/45/dc/b3f41aab488d024f4cff584241e4c9b9e2309750e391d5116cd6d640e3bc/aiohttp-devtools-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-19 16:26:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aio-libs",
"github_project": "aiohttp-devtools",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "aiohttp-devtools"
}