http-router 4.1.2__tar.gz → 5.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {http-router-4.1.2 → http_router-5.0.8}/PKG-INFO +5 -5
- {http-router-4.1.2 → http_router-5.0.8}/README.rst +1 -1
- {http-router-4.1.2 → http_router-5.0.8}/http_router/router.py +7 -10
- {http-router-4.1.2 → http_router-5.0.8}/http_router/routes.py +2 -2
- {http-router-4.1.2 → http_router-5.0.8}/http_router/utils.py +3 -3
- {http-router-4.1.2 → http_router-5.0.8}/http_router.egg-info/PKG-INFO +5 -5
- {http-router-4.1.2 → http_router-5.0.8}/http_router.egg-info/requires.txt +1 -3
- {http-router-4.1.2 → http_router-5.0.8}/pyproject.toml +6 -6
- {http-router-4.1.2 → http_router-5.0.8}/http_router/__init__.py +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router/exceptions.py +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router/py.typed +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router/router.pxd +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router/router.pyx +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router/routes.pxd +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router/routes.pyx +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router/types.py +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router.egg-info/SOURCES.txt +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router.egg-info/dependency_links.txt +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/http_router.egg-info/top_level.txt +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/setup.cfg +0 -0
- {http-router-4.1.2 → http_router-5.0.8}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: http-router
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.8
|
|
4
4
|
Summary: A simple router system for HTTP applications
|
|
5
5
|
Author-email: Kirill Klenov <horneds@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -13,15 +13,15 @@ Classifier: Intended Audience :: Developers
|
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Programming Language :: Python
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
21
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
22
|
Classifier: Programming Language :: Cython
|
|
23
23
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
24
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
25
|
Description-Content-Type: text/x-rst
|
|
26
26
|
Provides-Extra: tests
|
|
27
27
|
Requires-Dist: ruff; extra == "tests"
|
|
@@ -30,8 +30,8 @@ Requires-Dist: pytest-benchmark; extra == "tests"
|
|
|
30
30
|
Requires-Dist: pytest-mypy; implementation_name == "cpython" and extra == "tests"
|
|
31
31
|
Provides-Extra: dev
|
|
32
32
|
Requires-Dist: bump2version; extra == "dev"
|
|
33
|
-
Requires-Dist: refurb; python_version >= "3.9" and extra == "dev"
|
|
34
33
|
Requires-Dist: tox; extra == "dev"
|
|
34
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
35
35
|
|
|
36
36
|
HTTP Router
|
|
37
37
|
###########
|
|
@@ -67,7 +67,7 @@ The main goal of the library to bind targets to http routes and match them.
|
|
|
67
67
|
Requirements
|
|
68
68
|
=============
|
|
69
69
|
|
|
70
|
-
- python 3.
|
|
70
|
+
- python 3.9, 3.10, 3.11, 3.12, 3.13, pypy3
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
.. _installation:
|
|
@@ -7,10 +7,7 @@ from typing import (
|
|
|
7
7
|
Any,
|
|
8
8
|
Callable,
|
|
9
9
|
ClassVar,
|
|
10
|
-
DefaultDict,
|
|
11
|
-
List,
|
|
12
10
|
Optional,
|
|
13
|
-
Type,
|
|
14
11
|
)
|
|
15
12
|
|
|
16
13
|
from .exceptions import InvalidMethodError, NotFoundError, RouterError
|
|
@@ -23,9 +20,9 @@ if TYPE_CHECKING:
|
|
|
23
20
|
class Router:
|
|
24
21
|
"""Route HTTP queries."""
|
|
25
22
|
|
|
26
|
-
NotFoundError: ClassVar[
|
|
27
|
-
RouterError: ClassVar[
|
|
28
|
-
InvalidMethodError: ClassVar[
|
|
23
|
+
NotFoundError: ClassVar[type[Exception]] = NotFoundError
|
|
24
|
+
RouterError: ClassVar[type[Exception]] = RouterError
|
|
25
|
+
InvalidMethodError: ClassVar[type[Exception]] = InvalidMethodError
|
|
29
26
|
|
|
30
27
|
def __init__(
|
|
31
28
|
self,
|
|
@@ -44,8 +41,8 @@ class Router:
|
|
|
44
41
|
self.trim_last_slash = trim_last_slash
|
|
45
42
|
self.validator = validator or (lambda _: True)
|
|
46
43
|
self.converter = converter or (lambda v: v)
|
|
47
|
-
self.plain:
|
|
48
|
-
self.dynamic:
|
|
44
|
+
self.plain: defaultdict[str, list[Route]] = defaultdict(list)
|
|
45
|
+
self.dynamic: list[Route] = []
|
|
49
46
|
|
|
50
47
|
def __call__(self, path: str, method: str = "GET") -> RouteMatch:
|
|
51
48
|
"""Found a target for the given path and method."""
|
|
@@ -90,7 +87,7 @@ class Router:
|
|
|
90
87
|
*paths: TPath,
|
|
91
88
|
methods: Optional[TMethodsArg] = None,
|
|
92
89
|
**opts,
|
|
93
|
-
) ->
|
|
90
|
+
) -> list[Route]:
|
|
94
91
|
"""Bind a target to self."""
|
|
95
92
|
if opts:
|
|
96
93
|
target = partial(target, **opts)
|
|
@@ -150,7 +147,7 @@ class Router:
|
|
|
150
147
|
|
|
151
148
|
return wrapper
|
|
152
149
|
|
|
153
|
-
def routes(self) ->
|
|
150
|
+
def routes(self) -> list[Route]:
|
|
154
151
|
"""Get a list of self routes."""
|
|
155
152
|
return sorted(
|
|
156
153
|
self.dynamic + [r for routes in self.plain.values() for r in routes],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import TYPE_CHECKING, Any, Callable,
|
|
3
|
+
from typing import TYPE_CHECKING, Any, Callable, Mapping, Optional, Pattern, cast
|
|
4
4
|
from urllib.parse import unquote
|
|
5
5
|
|
|
6
6
|
from .router import Router
|
|
@@ -69,7 +69,7 @@ class DynamicRoute(Route):
|
|
|
69
69
|
methods: Optional[TMethods] = None,
|
|
70
70
|
target: Any = None,
|
|
71
71
|
pattern: Optional[Pattern] = None,
|
|
72
|
-
params: Optional[
|
|
72
|
+
params: Optional[dict] = None,
|
|
73
73
|
):
|
|
74
74
|
if pattern is None:
|
|
75
75
|
path, pattern, params = parse_path(path)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
|
-
from typing import TYPE_CHECKING,
|
|
4
|
+
from typing import TYPE_CHECKING, Optional, Pattern
|
|
5
5
|
from uuid import UUID
|
|
6
6
|
|
|
7
7
|
if TYPE_CHECKING:
|
|
@@ -24,13 +24,13 @@ VAR_TYPES = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
def parse_path(path: TPath) ->
|
|
27
|
+
def parse_path(path: TPath) -> tuple[str, Optional[Pattern], dict[str, Callable]]:
|
|
28
28
|
"""Prepare the given path to regexp it."""
|
|
29
29
|
if isinstance(path, Pattern):
|
|
30
30
|
return path.pattern, path, {}
|
|
31
31
|
|
|
32
32
|
src, regex, path = path.strip(" "), "^", ""
|
|
33
|
-
params:
|
|
33
|
+
params: dict[str, Callable] = {}
|
|
34
34
|
idx, cur, group = 0, 0, None
|
|
35
35
|
while cur < len(src):
|
|
36
36
|
sym = src[cur]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: http-router
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.8
|
|
4
4
|
Summary: A simple router system for HTTP applications
|
|
5
5
|
Author-email: Kirill Klenov <horneds@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -13,15 +13,15 @@ Classifier: Intended Audience :: Developers
|
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
14
14
|
Classifier: Programming Language :: Python
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
21
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
22
|
Classifier: Programming Language :: Cython
|
|
23
23
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
24
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
25
|
Description-Content-Type: text/x-rst
|
|
26
26
|
Provides-Extra: tests
|
|
27
27
|
Requires-Dist: ruff; extra == "tests"
|
|
@@ -30,8 +30,8 @@ Requires-Dist: pytest-benchmark; extra == "tests"
|
|
|
30
30
|
Requires-Dist: pytest-mypy; implementation_name == "cpython" and extra == "tests"
|
|
31
31
|
Provides-Extra: dev
|
|
32
32
|
Requires-Dist: bump2version; extra == "dev"
|
|
33
|
-
Requires-Dist: refurb; python_version >= "3.9" and extra == "dev"
|
|
34
33
|
Requires-Dist: tox; extra == "dev"
|
|
34
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
35
35
|
|
|
36
36
|
HTTP Router
|
|
37
37
|
###########
|
|
@@ -67,7 +67,7 @@ The main goal of the library to bind targets to http routes and match them.
|
|
|
67
67
|
Requirements
|
|
68
68
|
=============
|
|
69
69
|
|
|
70
|
-
- python 3.
|
|
70
|
+
- python 3.9, 3.10, 3.11, 3.12, 3.13, pypy3
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
.. _installation:
|
|
@@ -3,10 +3,10 @@ requires = ["setuptools", "wheel", "Cython"]
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "http-router"
|
|
6
|
-
version = "
|
|
6
|
+
version = "5.0.8"
|
|
7
7
|
description = "A simple router system for HTTP applications"
|
|
8
8
|
readme = "README.rst"
|
|
9
|
-
requires-python = ">=3.
|
|
9
|
+
requires-python = ">=3.9"
|
|
10
10
|
license = { "text" = "MIT License" }
|
|
11
11
|
authors = [{ name = "Kirill Klenov", email = "horneds@gmail.com" }]
|
|
12
12
|
keywords = ["http", "router", "web", "framework"]
|
|
@@ -16,11 +16,11 @@ classifiers = [
|
|
|
16
16
|
"License :: OSI Approved :: MIT License",
|
|
17
17
|
"Programming Language :: Python",
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
19
|
-
"Programming Language :: Python :: 3.8",
|
|
20
19
|
"Programming Language :: Python :: 3.9",
|
|
21
20
|
"Programming Language :: Python :: 3.10",
|
|
22
21
|
"Programming Language :: Python :: 3.11",
|
|
23
22
|
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
24
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
25
25
|
"Programming Language :: Cython",
|
|
26
26
|
"Topic :: Internet :: WWW/HTTP",
|
|
@@ -33,7 +33,7 @@ documentation = "https://github.com/klen/http-router"
|
|
|
33
33
|
|
|
34
34
|
[project.optional-dependencies]
|
|
35
35
|
tests = ["ruff", "pytest", "pytest-benchmark", "pytest-mypy; implementation_name == 'cpython'"]
|
|
36
|
-
dev = ["bump2version", "
|
|
36
|
+
dev = ["bump2version", "tox", "pre-commit"]
|
|
37
37
|
|
|
38
38
|
[tool.setuptools]
|
|
39
39
|
packages = ['http_router']
|
|
@@ -54,7 +54,7 @@ packages = ["http_router"]
|
|
|
54
54
|
[tool.tox]
|
|
55
55
|
legacy_tox_ini = """
|
|
56
56
|
[tox]
|
|
57
|
-
envlist =
|
|
57
|
+
envlist = py39,py310,py311,py312,py313,pypy310
|
|
58
58
|
|
|
59
59
|
[testenv]
|
|
60
60
|
deps = -e .[tests]
|
|
@@ -70,7 +70,7 @@ commands =
|
|
|
70
70
|
[tool.ruff]
|
|
71
71
|
fix = false
|
|
72
72
|
line-length = 100
|
|
73
|
-
target-version = "
|
|
73
|
+
target-version = "py39"
|
|
74
74
|
exclude = [".venv", "docs", "examples"]
|
|
75
75
|
|
|
76
76
|
[tool.ruff.lint]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|