Skip to content

Commit

Permalink
Deprecate runner module; remove path_norm
Browse files Browse the repository at this point in the history
aiohttp now has normalize_path_middleware
  • Loading branch information
sloria committed Mar 16, 2017
1 parent 45cca16 commit 4bfafb0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 312 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -2,6 +2,12 @@
Changelog
*********

3.0.0 (unreleased)
==================

- [runner] *Backwards-incompatible*: The `runner` module is deprecated. Install `aiohttp-devtools` and use the `adev runserver` command instead.
- [path_norm] *Backwards-incompatible*: The `path_norm` module is removed, as it is now available in `aiohttp` in `aiohttp.web_middlewares.normalize_path_middleware`.

2.0.1 (2016-04-03)
==================

Expand Down
12 changes: 1 addition & 11 deletions README.rst
Expand Up @@ -14,9 +14,8 @@ aiohttp_utils


* Method-based handlers ("resources")
* Routing utilities
* Content negotiation with JSON rendering by default
* Local development server with auto-reloading
* And more

**Everything is optional**. You can use as much (or as little) of this toolkit as you need.

Expand Down Expand Up @@ -46,15 +45,6 @@ aiohttp_utils
}
)
if __name__ == '__main__':
# Development server
run(
app,
app_uri='hello.app:app',
reload=True,
port=8000
)
Install
=======
::
Expand Down
133 changes: 0 additions & 133 deletions aiohttp_utils/path_norm.py

This file was deleted.

5 changes: 5 additions & 0 deletions aiohttp_utils/runner.py
Expand Up @@ -14,6 +14,8 @@
.. warning::
Auto-reloading functionality is currently **experimental**.
"""
import warnings

from aiohttp import web
from aiohttp.worker import GunicornWebWorker as BaseWorker
from gunicorn.app.wsgiapp import WSGIApplication as BaseApplication
Expand Down Expand Up @@ -63,6 +65,9 @@ def __init__(
reload: bool=None,
**options
):
warnings.warn('aiohttp_utils.runner is deprecated. '
'Install aiohttp-devtools and use '
'the "adev runserver" command instead.', DeprecationWarning)
self.app = app
self.app_uri = app_uri
self.host = host
Expand Down
14 changes: 1 addition & 13 deletions docs/index.rst
Expand Up @@ -7,9 +7,8 @@ Release v\ |version|. (:ref:`Changelog <changelog>`)


* Method-based handlers ("resources")
* Routing utilities
* Content negotiation with JSON rendering by default
* Local development server with auto-reloading
* And more

**Everything is optional**. You can use as much (or as little) of this toolkit as you need.

Expand Down Expand Up @@ -39,15 +38,6 @@ Release v\ |version|. (:ref:`Changelog <changelog>`)
}
)
if __name__ == '__main__':
# Development server
run(
app,
app_uri='hello.app:app',
reload=True,
port=8000
)
Install
-------
::
Expand All @@ -66,9 +56,7 @@ Below are usage guides for each of the modules.
:maxdepth: 1

modules/negotiation
modules/path_norm
modules/routing
modules/runner

Project info
------------
Expand Down
16 changes: 4 additions & 12 deletions examples/kitchen_sink.py
Expand Up @@ -6,9 +6,10 @@
- path normalization, and
- local development server with reloading.
Start the app with
Start the app with the `adev runserver` command from aiohttp-devtools
::
$ python examples/resources_with_negotiation.py
$ pip install aiohttp-devtools
$ adev runserver examples/kitchen_sink.py
Try it out:
::
Expand All @@ -20,7 +21,7 @@
from asyncio import coroutine

from aiohttp import web
from aiohttp_utils import Response, routing, negotiation, run, path_norm
from aiohttp_utils import Response, routing, negotiation

app = web.Application(router=routing.ResourceRouter())

Expand All @@ -44,12 +45,3 @@ def get(self, request):
route('/', HelloResource())

negotiation.setup(app)
path_norm.setup(app)

if __name__ == "__main__":
run(
app,
app_uri="examples.kitchen_sink:app",
reload=True,
port=8000
)
16 changes: 4 additions & 12 deletions examples/mako_example.py
@@ -1,10 +1,10 @@
"""Example of using content negotiation to simultaneously support HTML and JSON representations,
using Mako for templating. Also demonstrates app configuration.
Start the app with
Start the app with the `adev runserver` command from aiohttp-devtools
::
$ pip install mako
$ python examples/mako_example.py
$ pip install aiohttp-devtools
$ adev runserver examples/mako_example.py
Try it out:
::
Expand All @@ -17,7 +17,7 @@
from asyncio import coroutine

from aiohttp import web
from aiohttp_utils import Response, negotiation, run
from aiohttp_utils import Response, negotiation

from mako.lookup import TemplateLookup

Expand Down Expand Up @@ -84,11 +84,3 @@ def render_mako(request, data):
app.update(CONFIG)
negotiation.setup(app)
app.router.add_route('GET', '/', index, template='index.html')

if __name__ == "__main__":
run(
app,
app_uri='examples.mako_example:app',
reload=True,
port=8000,
)

0 comments on commit 4bfafb0

Please sign in to comment.