Repository: huge-success/sanic
Pull request #1537 (2019-03-26 11:14:02)

Add 19.03 release to changelog
I've lifted the list of changes for 19.03 from the releases section on github.
The style is quite different from the 18.12 but conversely that varies a bit from the  0.8.0 section - is that a problem?

codecov[bot]: # [Codecov](https://codecov.io/gh/huge-success/sanic/pull/1537?src=pr&el=h1) Report
> Merging [#1537](https://codecov.io/gh/huge-success/sanic/pull/1537?src=pr&el=desc) into [master](https://codecov.io/gh/huge-success/sanic/commit/dab802fbf416aad5f91cbb813fad23c317f0bf13?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huge-success/sanic/pull/1537/graphs/tree.svg?width=650&token=NqLbJHUqoR&height=150&src=pr)](https://codecov.io/gh/huge-success/sanic/pull/1537?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1537   +/-   ##
=======================================
  Coverage   91.45%   91.45%           
=======================================
  Files          18       18           
  Lines        1791     1791           
  Branches      339      339           
=======================================
  Hits         1638     1638           
  Misses        130      130           
  Partials       23       23
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/huge-success/sanic/pull/1537?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huge-success/sanic/pull/1537?src=pr&el=footer). Last update [dab802f...78dbfbc](https://codecov.io/gh/huge-success/sanic/pull/1537?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

andreymal: >Remove deleted repo from extensions list

I have a small request: make changelogs more detailed. A raw list of closed issues is a bad changelog.
cakemanny: > > Remove deleted repo from extensions list
> 
> I have a small request: make changelogs more detailed. A raw list of closed issues is a bad changelog.

Yes, very good point, I much agree. I'll go through these a bit later today
cakemanny: So, in 63179baa29737b7b4f8da6e157ff5c8407dd16f1 I've started to go through each PR and expand each of items a bit following @andreymal's point (https://github.com/huge-success/sanic/pull/1537#issuecomment-476597716). It's taking a bit of time. Does it look like I'm headed in the right direction?
harshanarayana: @cakemanny Yes you are in the right direction. I think some items may have been missed from your list though. 

```bash
➜ git log 18.12.0..19.3 --oneline | grep '#'
abf8534 fix typo in Asyncio example (#1510)
773a66b Fix typo (#1516)
269100e format: fix linter issue causing travis build failures (fix #1514) (#1515)
2a15583 add Request.not_grouped_args, deprecation warning Request.raw_args (#1476)
d581315 Allow sanic test client to bind to a random port (#1376)
348964f Enable Middleware Support for Blueprint Groups (#1399)
e5c7589 Remove update_current_time refresh (#1502)
4260528 Fix the auto_reloader to work when the executable was launched with a module, rather than a script. (#1501)
34fe26e Add Route Resolution Benchmarking to Unit Test (#1499)
8a59907 Recognizes non-ASCII filenames in RFC 2231, and suport filename length is zero for multipart/form-data. (#1497)
52deeba Merge pull request #1490 from chenjr0719/fix_doc_build
ab56af5 Merge pull request #1489 from tomchristie/patch-1
42bf103 Remove deleted repo (#1487)
c8d2a46 did you mean specific? (#1486)
08794ae Enforce Datetime Type for Expires on Set-Cookie (#1484)
4f70dba sanic-zipkin (#1483)
b926a2c sanic#1480 Allow negative int/number in path (#1481)
52bdd1d Add stream support for bp.add_route() (#1482)
bc7d0f0 Merge pull request #1478 from chenjr0719/fix_doc_build
2758a3a Merge pull request #1472 from xxNB/dev
ef3c9ea Merge pull request #1477 from kyb3r/patch-2
9cf2e1b Merge pull request #1470 from denismakogon/create-server
99f34c9 Merge pull request #1457 from huge-success/max-age-integer
2af229e Merge pull request #1445 from huge-success/r0fls-977
8dd8e99 upgrade pytest version that compatible with pytest-cov, fixes some caplog unit tests (#1464)
96af1fe Merge pull request #1460 from huge-success/18.12-changelog
52de354 Merge pull request #1442 from Amanit/feature/gunicorn-logging
f4f90ca Merge pull request #1449 from chenjr0719/add_amending_request_object_example
cea1547 Merge pull request #1446 from huge-success/ahopkins-patch-1
fd5ae01 Merge pull request #1444 from ja8zyjits/master
19b4283 Merge pull request #1 from ja8zyjits/ja8zyjits-patch-1-readme
ff38a3c Merge pull request #1443 from huge-success/new-readme
72f2e18 Merge pull request #1440 from harshanarayana/fix/Contribution_Guide_Pip_Install
13804dc Merge pull request #1424 from harshanarayana/enh/Documentation_Update
67d51f7 Merge pull request #1423 from yunstanford/request-streaming-support
```

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d92c563..dd866835 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,114 @@
+Version 19.3
+-------------
+19.3.1
+  - Changes:
+    - [#1497](https://github.com/huge-success/sanic/pull/1497)
+      Add support for zero-length and RFC 5987 encoded filename for
+      multipart/form-data requests.
+
+    - [#1484](https://github.com/huge-success/sanic/pull/1484)
+      The type of `expires` attribute of `sanic.cookies.Cookie` is now
+      enforced to be of type `datetime`.
+
+    - [#1482](https://github.com/huge-success/sanic/pull/1482)
+      Add support for the `stream` parameter of `sanic.Sanic.add_route()`
+      available to `sanic.Blueprint.add_route()`.
+
+    - [#1481](https://github.com/huge-success/sanic/pull/1481)
+      Accept negative values for route parameters with type `int` or `number`.
+
+    - [#1476](https://github.com/huge-success/sanic/pull/1476)
+      Deprecated the use of `sanic.request.Request.raw_args` - it has a
+      fundamental flaw in which is drops repeated query string parameters.
+      Added `sanic.request.Request.query_args` as a replacement for the
+      original use-case.
+
+    - [#1472](https://github.com/huge-success/sanic/pull/1472)
+      Remove an unwanted `None` check in Request class `repr` implementation.
+      This changes the default `repr` of a Request from `<Request>` to
+      `<Request: None />`
+
+    - [#1470](https://github.com/huge-success/sanic/pull/1470)
+      Added 2 new parameters to `sanic.app.Sanic.create_server`:
+      - `return_asyncio_server` - whether to return an asyncio.Server.
+      - `asyncio_server_kwargs` - kwargs to pass to `loop.create_server` for
+        the event loop that sanic is using.
+
+      This is a breaking change.
+
+    - [#1499](https://github.com/huge-success/sanic/pull/1499)
+      Added a set of test cases that test and benchmark route resolution.
+
+    - [#1457](https://github.com/huge-success/sanic/pull/1457)
+      The type of the `"max-age"` value in a `sanic.cookies.Cookie` is now
+      enforced to be an integer. Non-integer values are replaced with `0`.
+
+    - [#1445](https://github.com/huge-success/sanic/pull/1445)
+      Added the `endpoint` attribute to an incoming `request`, containing the
+      name of the handler function.
+
+    - [#1423](https://github.com/huge-success/sanic/pull/1423)
+      Improved request streaming. `request.stream` is now a bounded-size buffer
+      instead of an unbounded queue. Callers must now call
+      `await request.stream.read()` instead of `await request.stream.get()`
+      to read each portion of the body.
+
+      This is a breaking change.
+
+  - Fixes:
+    - [#1502](https://github.com/huge-success/sanic/pull/1502)
+      Sanic was prefetching `time.time()` and updating it once per second to
+      avoid excessive `time.time()` calls. The implementation was observed to
+      cause memory leaks in some cases. The benefit of the prefetch appeared
+      to negligible, so this has been removed. Fixes
+      [#1500](https://github.com/huge-success/sanic/pull/1500)
+
+    - [#1501](https://github.com/huge-success/sanic/pull/1501)
+      Fix a bug in the auto-reloader when the process was launched as a module
+      i.e. `python -m init0.mod1` where the sanic server is started
+      in `init0/mod1.py` with `debug` enabled and imports another module in
+      `init0`.
+
+    - [#1376](https://github.com/huge-success/sanic/pull/1376)
+      Allow sanic test client to bind to a random port by specifying
+      `port=None` when constructing a `SanicTestClient`
+
+    - [#1399](https://github.com/huge-success/sanic/pull/1399)
+      Added the ability to specify middleware on a blueprint group, so that all
+      routes produced from the blueprints in the group have the middleware
+      applied.
+
+    - [#1442](https://github.com/huge-success/sanic/pull/1442)
+      Allow the the use the `SANIC_ACCESS_LOG` environment variable to
+      enable/disable the access log when not explicitly passed to `app.run()`.
+      This allows the access log to be disabled for example when running via
+      gunicorn.
+
+  - Developer infrastructure:
+    - [#1529](https://github.com/huge-success/sanic/pull/1529) Update project PyPI credentials
+    - [#1515](https://github.com/huge-success/sanic/pull/1515) fix linter issue causing travis build failures (fix #1514)
+    - [#1490](https://github.com/huge-success/sanic/pull/1490) Fix python version in doc build
+    - [#1478](https://github.com/huge-success/sanic/pull/1478) Upgrade setuptools version and use native docutils in doc build
+    - [#1464](https://github.com/huge-success/sanic/pull/1464) Upgrade pytest, and fix caplog unit tests
+
+  - Typos and Documentation:
+    - [#1516](https://github.com/huge-success/sanic/pull/1516) Fix typo at the exception documentation
+    - [#1510](https://github.com/huge-success/sanic/pull/1510) fix typo in Asyncio example
+    - [#1486](https://github.com/huge-success/sanic/pull/1486) Documentation typo
+    - [#1477](https://github.com/huge-success/sanic/pull/1477) Fix grammar in README.md
+    - [#1489](https://github.com/huge-success/sanic/pull/1489) Added "databases" to the extensions list
+    - [#1483](https://github.com/huge-success/sanic/pull/1483) Add sanic-zipkin to extensions list
+    - [#1487](https://github.com/huge-success/sanic/pull/1487) Removed link to deleted repo, Sanic-OAuth, from the extensions list
+    - [#1460](https://github.com/huge-success/sanic/pull/1460) 18.12 changelog
+    - [#1449](https://github.com/huge-success/sanic/pull/1449) Add example of amending request object
+    - [#1446](https://github.com/huge-success/sanic/pull/1446) Update README
+    - [#1444](https://github.com/huge-success/sanic/pull/1444) Update README
+    - [#1443](https://github.com/huge-success/sanic/pull/1443) Update README, including new logo
+    - [#1440](https://github.com/huge-success/sanic/pull/1440) fix minor type and pip install instruction mismatch
+    - [#1424](https://github.com/huge-success/sanic/pull/1424) Documentation Enhancements
+
+Note: 19.3.0 was skipped for packagement purposes and not released on PyPI
+
 Version 18.12
 -------------
 18.12.0
diff --git a/docs/sanic/changelog.md b/docs/sanic/changelog.md
index 0d92c563..dd866835 100644
--- a/docs/sanic/changelog.md
+++ b/docs/sanic/changelog.md
@@ -1,3 +1,114 @@
+Version 19.3
+-------------
+19.3.1
+  - Changes:
+    - [#1497](https://github.com/huge-success/sanic/pull/1497)
+      Add support for zero-length and RFC 5987 encoded filename for
+      multipart/form-data requests.
+
+    - [#1484](https://github.com/huge-success/sanic/pull/1484)
+      The type of `expires` attribute of `sanic.cookies.Cookie` is now
+      enforced to be of type `datetime`.
+
+    - [#1482](https://github.com/huge-success/sanic/pull/1482)
+      Add support for the `stream` parameter of `sanic.Sanic.add_route()`
+      available to `sanic.Blueprint.add_route()`.
+
+    - [#1481](https://github.com/huge-success/sanic/pull/1481)
+      Accept negative values for route parameters with type `int` or `number`.
+
+    - [#1476](https://github.com/huge-success/sanic/pull/1476)
+      Deprecated the use of `sanic.request.Request.raw_args` - it has a
+      fundamental flaw in which is drops repeated query string parameters.
+      Added `sanic.request.Request.query_args` as a replacement for the
+      original use-case.
+
+    - [#1472](https://github.com/huge-success/sanic/pull/1472)
+      Remove an unwanted `None` check in Request class `repr` implementation.
+      This changes the default `repr` of a Request from `<Request>` to
+      `<Request: None />`
+
+    - [#1470](https://github.com/huge-success/sanic/pull/1470)
+      Added 2 new parameters to `sanic.app.Sanic.create_server`:
+      - `return_asyncio_server` - whether to return an asyncio.Server.
+      - `asyncio_server_kwargs` - kwargs to pass to `loop.create_server` for
+        the event loop that sanic is using.
+
+      This is a breaking change.
+
+    - [#1499](https://github.com/huge-success/sanic/pull/1499)
+      Added a set of test cases that test and benchmark route resolution.
+
+    - [#1457](https://github.com/huge-success/sanic/pull/1457)
+      The type of the `"max-age"` value in a `sanic.cookies.Cookie` is now
+      enforced to be an integer. Non-integer values are replaced with `0`.
+
+    - [#1445](https://github.com/huge-success/sanic/pull/1445)
+      Added the `endpoint` attribute to an incoming `request`, containing the
+      name of the handler function.
+
+    - [#1423](https://github.com/huge-success/sanic/pull/1423)
+      Improved request streaming. `request.stream` is now a bounded-size buffer
+      instead of an unbounded queue. Callers must now call
+      `await request.stream.read()` instead of `await request.stream.get()`
+      to read each portion of the body.
+
+      This is a breaking change.
+
+  - Fixes:
+    - [#1502](https://github.com/huge-success/sanic/pull/1502)
+      Sanic was prefetching `time.time()` and updating it once per second to
+      avoid excessive `time.time()` calls. The implementation was observed to
+      cause memory leaks in some cases. The benefit of the prefetch appeared
+      to negligible, so this has been removed. Fixes
+      [#1500](https://github.com/huge-success/sanic/pull/1500)
+
+    - [#1501](https://github.com/huge-success/sanic/pull/1501)
+      Fix a bug in the auto-reloader when the process was launched as a module
+      i.e. `python -m init0.mod1` where the sanic server is started
+      in `init0/mod1.py` with `debug` enabled and imports another module in
+      `init0`.
+
+    - [#1376](https://github.com/huge-success/sanic/pull/1376)
+      Allow sanic test client to bind to a random port by specifying
+      `port=None` when constructing a `SanicTestClient`
+
+    - [#1399](https://github.com/huge-success/sanic/pull/1399)
+      Added the ability to specify middleware on a blueprint group, so that all
+      routes produced from the blueprints in the group have the middleware
+      applied.
+
+    - [#1442](https://github.com/huge-success/sanic/pull/1442)
+      Allow the the use the `SANIC_ACCESS_LOG` environment variable to
+      enable/disable the access log when not explicitly passed to `app.run()`.
+      This allows the access log to be disabled for example when running via
+      gunicorn.
+
+  - Developer infrastructure:
+    - [#1529](https://github.com/huge-success/sanic/pull/1529) Update project PyPI credentials
+    - [#1515](https://github.com/huge-success/sanic/pull/1515) fix linter issue causing travis build failures (fix #1514)
+    - [#1490](https://github.com/huge-success/sanic/pull/1490) Fix python version in doc build
+    - [#1478](https://github.com/huge-success/sanic/pull/1478) Upgrade setuptools version and use native docutils in doc build
+    - [#1464](https://github.com/huge-success/sanic/pull/1464) Upgrade pytest, and fix caplog unit tests
+
+  - Typos and Documentation:
+    - [#1516](https://github.com/huge-success/sanic/pull/1516) Fix typo at the exception documentation
+    - [#1510](https://github.com/huge-success/sanic/pull/1510) fix typo in Asyncio example
+    - [#1486](https://github.com/huge-success/sanic/pull/1486) Documentation typo
+    - [#1477](https://github.com/huge-success/sanic/pull/1477) Fix grammar in README.md
+    - [#1489](https://github.com/huge-success/sanic/pull/1489) Added "databases" to the extensions list
+    - [#1483](https://github.com/huge-success/sanic/pull/1483) Add sanic-zipkin to extensions list
+    - [#1487](https://github.com/huge-success/sanic/pull/1487) Removed link to deleted repo, Sanic-OAuth, from the extensions list
+    - [#1460](https://github.com/huge-success/sanic/pull/1460) 18.12 changelog
+    - [#1449](https://github.com/huge-success/sanic/pull/1449) Add example of amending request object
+    - [#1446](https://github.com/huge-success/sanic/pull/1446) Update README
+    - [#1444](https://github.com/huge-success/sanic/pull/1444) Update README
+    - [#1443](https://github.com/huge-success/sanic/pull/1443) Update README, including new logo
+    - [#1440](https://github.com/huge-success/sanic/pull/1440) fix minor type and pip install instruction mismatch
+    - [#1424](https://github.com/huge-success/sanic/pull/1424) Documentation Enhancements
+
+Note: 19.3.0 was skipped for packagement purposes and not released on PyPI
+
 Version 18.12
 -------------
 18.12.0
diff --git a/sanic/router.py b/sanic/router.py
index dcf3aeb5..4c1ea0a0 100644
--- a/sanic/router.py
+++ b/sanic/router.py
@@ -18,7 +18,7 @@ Parameter = namedtuple("Parameter", ["name", "cast"])
 REGEX_TYPES = {
     "string": (str, r"[^/]+"),
     "int": (int, r"-?\d+"),
-    "number": (float, r"-?[0-9\\.]+"),
+    "number": (float, r"-?(?:\d+(?:\.\d*)?|\.\d+)"),
     "alpha": (str, r"[A-Za-z]+"),
     "path": (str, r"[^/].*?"),
     "uuid": (


Test patch:
diff --git a/tests/test_routes.py b/tests/test_routes.py
index f3152935..3ccef135 100644
--- a/tests/test_routes.py
+++ b/tests/test_routes.py
@@ -365,9 +365,18 @@ def test_dynamic_route_number(app):
     request, response = app.test_client.get("/weight/1234.56")
     assert response.status == 200
 
+    request, response = app.test_client.get("/weight/.12")
+    assert response.status == 200
+
+    request, response = app.test_client.get("/weight/12.")
+    assert response.status == 200
+
     request, response = app.test_client.get("/weight/1234-56")
     assert response.status == 404
 
+    request, response = app.test_client.get("/weight/12.34.56")
+    assert response.status == 404
+
 
 def test_dynamic_route_regex(app):
     @app.route("/folder/<folder_id:[A-Za-z0-9]{0,4}>")
@@ -672,9 +681,18 @@ def test_dynamic_add_route_number(app):
     request, response = app.test_client.get("/weight/1234.56")
     assert response.status == 200
 
+    request, response = app.test_client.get("/weight/.12")
+    assert response.status == 200
+
+    request, response = app.test_client.get("/weight/12.")
+    assert response.status == 200
+
     request, response = app.test_client.get("/weight/1234-56")
     assert response.status == 404
 
+    request, response = app.test_client.get("/weight/12.34.56")
+    assert response.status == 404
+
 
 def test_dynamic_add_route_regex(app):
     async def handler(request, folder_id):
diff --git a/tests/test_url_building.py b/tests/test_url_building.py
index 5e1c300a..a246aabc 100644
--- a/tests/test_url_building.py
+++ b/tests/test_url_building.py
@@ -223,7 +223,7 @@ def test_fails_with_number_message(app):
 
     expected_error = (
         'Value "foo" for parameter `some_number` '
-        "does not match pattern for type `float`: -?[0-9\\\\.]+"
+        r"does not match pattern for type `float`: -?(?:\d+(?:\.\d*)?|\.\d+)"
     )
 
     assert str(e.value) == expected_error