Commit Graph

1279 Commits

Author SHA1 Message Date
Marcelo Trylesinski 4ca0a8757a
Downgrade mkdocs-material (#2439) 2024-01-23 01:29:01 -07:00
Marcelo Trylesinski e54be85aba
Check if "extensions" in scope before checking the extension (#2438) 2024-01-23 08:42:18 +01:00
Marcelo Trylesinski 8d09cf4b69
Version 0.36.0 (#2432)
* Version 0.36.0

* Update release-notes.md
2024-01-22 20:36:10 +00:00
Giovanni Barillari 7936e86f0a
Add support for ASGI `pathsend` extension (#2435)
* add support for ASGI `pathsend` extension

* add test for ASGI `pathsend`
2024-01-22 02:44:40 -07:00
Marcelo Trylesinski 6bfe9fea04
Use `__future__.annotations` (#2433)
* Use `__future__.annotations`

* fix linter
2024-01-20 18:57:59 +01:00
Marcelo Trylesinski b5126b2063
Raise `WebSocketDisconnect` when `WebSocket.send()` excepts `IOError` (#2425)
* Raise `WebSocketDisconnect` when `WebSocket.send()` excepts `IOError`

* Restrict the IOError
2024-01-20 08:08:22 -07:00
Marcelo Trylesinski 3ae161ed8f
Cancel `WebSocketTestSession` on close (#2427)
* Cancel `WebSocketTestSession` on close

* Undo some noise

* Fix test

* Undo pyproject

* Undo anyio bump

* Undo changes on test_authentication

* Always call cancel scope
2024-01-20 06:59:47 -07:00
Mathias Hauser 13c66c9294
Raise `FileNotFoundError` when the `env_file` parameter on `Config` is not valid (#2422)
* raise error on missing env file

* format

---------

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2024-01-20 12:06:50 +00:00
Marcelo Trylesinski d2d9192966
Add PyPI versions supported (#2431) 2024-01-20 03:43:45 -07:00
dependabot[bot] 363e4fb194
Bump the python-packages group with 5 updates (#2418)
Bumps the python-packages group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [mypy](https://github.com/python/mypy) | `1.7.1` | `1.8.0` |
| [ruff](https://github.com/astral-sh/ruff) | `0.1.9` | `0.1.13` |
| [pytest](https://github.com/pytest-dev/pytest) | `7.4.0` | `7.4.4` |
| [trio](https://github.com/python-trio/trio) | `0.23.2` | `0.24.0` |
| [mkdocs-material](https://github.com/squidfunk/mkdocs-material) | `9.1.17` | `9.5.3` |


Updates `mypy` from 1.7.1 to 1.8.0
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.7.1...v1.8.0)

Updates `ruff` from 0.1.9 to 0.1.13
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.1.9...v0.1.13)

Updates `pytest` from 7.4.0 to 7.4.4
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.4.0...7.4.4)

Updates `trio` from 0.23.2 to 0.24.0
- [Release notes](https://github.com/python-trio/trio/releases)
- [Commits](https://github.com/python-trio/trio/compare/v0.23.2...v0.24.0)

Updates `mkdocs-material` from 9.1.17 to 9.5.3
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.17...9.5.3)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-packages
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-packages
- dependency-name: trio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 04:02:01 -07:00
Marcelo Trylesinski 53808c4b26
Group dependencies on dependabot updates (#2415) 2024-01-13 18:48:51 +08:00
Marcelo Trylesinski 8d7630bda1
Add type hint on `test_websockets.py` (#2411)
* Add type hint on `test_websockets.py`

* Add type ignore on mock_receive
2024-01-12 03:06:48 -07:00
Marcelo Trylesinski c8176050aa
Version 0.35.1 (#2410) 2024-01-11 19:57:49 +00:00
Marcelo Trylesinski 6c4ffeee01
Make `typing-extensions` optional again (#2409) 2024-01-11 12:55:30 -07:00
Sebastián Ramírez 3734e85c18
♻️ Do not use the deprecated `method` parameter in `FileResponse` inside of `StaticFiles` (#2406)
* ♻️ Do not use the deprecated `method` parameter in `FileResponse` inside of` StaticFile`

*  Add test for warning FileResponse with method argument

* 🔊 Remove warning filter for FileResponse with method
2024-01-11 08:17:18 -07:00
Marcelo Trylesinski 1081520b75
Version 0.35.0 (#2404)
* Version 0.35.0

* Update release-notes.md
2024-01-11 07:29:36 -07:00
Sebastián Ramírez c3c6314759
♻️ Refactor logic to handle `root_path` to keep compatibility with ASGI and compatibility with other non-Starlette-specific libraries like a2wsgi (#2400)
*  Add util to get route path from scope

* ♻️ Refactor extracting the local route_path from the scope, and creating the child scope with its own root_pat, this allows sub-apps (e.g. WSGIMiddleware) to know
where it was mounted, and from which path prefix starts the path its sub-app should handle

* ♻️ Refactor datastructures and request to be conformant with the ASGI spec, respecting root_path

*  Add and update tests for root_path with mounted apps that don't know about Starlette internals (e.g. the route_root_path extension scope key that was added in

*  Update test for root_path, TestClient was not requiring paths under a root_path to pass the root_path, which is what clients would have to do if the app is
mounted.

* 🎨 Fix formatting

* 🎨 Remove type ignore

* 🔥 Remove unnecessary comment

*  Update (deprecated) WSGIMiddleware to be compatible with the updated root_path, taking pieces from a2wsgi

* 🎨 Fix types

*  Update test for WSGIMiddleware with root_path

* 🔥 Remove logic/features not in the original (deprecated) WSGIMiddleware

---------

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Co-authored-by: Aber <me@abersheeran.com>
2024-01-09 12:45:30 +08:00
dependabot[bot] 8f2307d31f
Bump trio from 0.22.2 to 0.23.2 (#2395)
* Bump trio from 0.22.2 to 0.23.2

Bumps [trio](https://github.com/python-trio/trio) from 0.22.2 to 0.23.2.
- [Release notes](https://github.com/python-trio/trio/releases)
- [Commits](https://github.com/python-trio/trio/compare/v0.22.2...v0.23.2)

---
updated-dependencies:
- dependency-name: trio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove AnyIO from requirements.txt

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2024-01-08 21:26:34 +00:00
dependabot[bot] d28d491a34
Bump ruff from 0.1.6 to 0.1.9 (#2396)
* Bump ruff from 0.1.6 to 0.1.9

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.6 to 0.1.9.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.1.6...v0.1.9)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix code

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2024-01-08 08:49:23 +00:00
dependabot[bot] 5f9da0b656
Bump coverage from 7.3.2 to 7.4.0 (#2397) 2024-01-01 21:36:25 +01:00
dependabot[bot] 04684c22e8
Bump typing-extensions from 4.8.0 to 4.9.0 (#2393)
Bumps [typing-extensions](https://github.com/python/typing_extensions) from 4.8.0 to 4.9.0.
- [Release notes](https://github.com/python/typing_extensions/releases)
- [Changelog](https://github.com/python/typing_extensions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/python/typing_extensions/compare/4.8.0...4.9.0)

---
updated-dependencies:
- dependency-name: typing-extensions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 13:18:57 -07:00
dependabot[bot] 89247598c9
Bump importlib-metadata from 6.9.0 to 7.0.1 (#2394)
Bumps [importlib-metadata](https://github.com/python/importlib_metadata) from 6.9.0 to 7.0.1.
- [Release notes](https://github.com/python/importlib_metadata/releases)
- [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
- [Commits](https://github.com/python/importlib_metadata/compare/v6.9.0...v7.0.1)

---
updated-dependencies:
- dependency-name: importlib-metadata
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 13:03:12 -07:00
dependabot[bot] d57f1bb91d
Bump actions/setup-python from 4 to 5 (#2392)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 12:35:32 -07:00
Amin Alaee 483849a466
Turn `scope["client"]` to `None` on `TestClient` (#2377)
* Remove client scope from testclient

* remove test

* Update testclient.py

---------

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-25 02:33:09 -07:00
James Braza 966f0fc857
Use `Iterable` instead `Iterator` on `iterate_in_threadpool` (#2362)
* Fixed AsyncContentStream to be AsyncIterator

* Updating isinstance check too

* Standardizing on Iterable/AsyncIterable

* Moved iterate_in_threadpool to make an iter internally

* Added test of iterate_in_threadpool accepting an Iterable

* Renamed arg to iterator, and fixed type hint in return to be AsyncIterator

---------

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-20 14:59:58 -07:00
Paweł Rubin 866a15f79c
Add `*args` to `Middleware` and improve its type hints (#2381)
Co-authored-by: Paweł Rubin <pawel.rubin@ocado.com>
2023-12-20 22:09:17 +01:00
Marcelo Trylesinski 23c81da94b
Version 0.34.0 (#2368) 2023-12-16 08:36:01 -07:00
Amin Alaee 80818a4c47
Remove databases package from config docs (#2092)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-16 15:05:39 +00:00
Vageeshan Mankala 13651500aa
Add sentry to the third party packages (#2279)
* Update third-party-packages.md

* Update third-party-packages.md

* improve wording

---------

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-16 15:02:19 +00:00
Diego Fioravanti a2a3df31f2
Clarify that wildcard and credentials are mutually exclusive (#2210)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-16 14:41:37 +00:00
Bernardo Gomes 1b766f4449
Add example on how to use `SessionMiddleware` (#2251)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-16 14:24:57 +00:00
neolooong 3c8ab8e74a
Take weak ETags in consideration on `StaticFiles` (#2334)
Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-16 07:13:21 -07:00
Marcelo Trylesinski efa03ebd64
Merge URLs properly on TestClient (#2376) 2023-12-16 06:55:20 -07:00
Marcelo Trylesinski 9a213c1321
Use `ParamSpec` for `run_in_threadpool` (#2375) 2023-12-16 12:51:24 +00:00
Marcelo Trylesinski 6715eb4f4f
Deprecate `FileResponse(method=...)` parameter (#2366) 2023-12-16 12:47:54 +00:00
dependabot[bot] 1ed1737e32
Bump mypy from 1.5.1 to 1.7.1 (#2357)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-13 12:56:11 +00:00
Samuel Colvin d29d9938aa
Add `UploadFile.__repr__` (#2360) 2023-12-05 00:34:41 -07:00
dependabot[bot] 3df3df1d79
Bump importlib-metadata from 6.8.0 to 6.9.0 (#2356) 2023-12-02 09:02:23 +01:00
dependabot[bot] 008e720a93
Bump coverage from 7.3.1 to 7.3.2 (#2355)
Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.3.1 to 7.3.2.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](https://github.com/nedbat/coveragepy/compare/7.3.1...7.3.2)

---
updated-dependencies:
- dependency-name: coverage
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 13:44:50 -06:00
dependabot[bot] fb86842790
Bump ruff from 0.1.4 to 0.1.6 (#2359)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.4 to 0.1.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.1.4...v0.1.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 13:39:40 -06:00
Marcelo Trylesinski bf2d4e1485
Version 0.33.0 (#2354) 2023-12-01 06:38:58 -07:00
夏悠然 a1ee8b4f45
Set `ensure_ascii=False` on `json.dumps()` for `WebSocket.send_json()` (#2341)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
2023-12-01 13:23:06 +00:00
Marcelo Trylesinski 811dacc062
Add middleware per `Router` (#2351) 2023-12-01 12:58:30 +00:00
Marcelo Trylesinski e8f0dcd54e
Do not overwrite `"path"` and `"root_path"` scope keys (#2352) 2023-12-01 05:55:46 -07:00
Marcelo Trylesinski 164b350216
Add middleware per `Route`/`WebSocketRoute` (#2349) 2023-12-01 03:35:14 -07:00
Ofek Lev 1fd4b20edc
Update link to itsdangerous (#2343)
* Update link to itsdangerous

* here too
2023-11-23 02:01:17 +00:00
Ofek Lev 480c8f4a21
Fix typo in docs (#2344) 2023-11-22 12:26:45 -06:00
Amin Alaee 93494a46ee
Replace black with ruff formatter (#2330) 2023-11-08 17:43:38 +01:00
Marcelo Trylesinski 2c066afa75
Version 0.32.0.post1 (#2327) 2023-11-05 23:28:32 -07:00
David Ventura 6dd0207537
Add Starlette-StaticResources to third-party-packages (#2286) 2023-11-06 02:36:15 +00:00