urlpattern 0.1.3__cp311-cp311-win_amd64.whl

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.
urlpattern/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .urlpattern import *
2
+
3
+ __doc__ = urlpattern.__doc__
4
+ if hasattr(urlpattern, "__all__"):
5
+ __all__ = urlpattern.__all__
@@ -0,0 +1,58 @@
1
+ from typing_extensions import TypeAlias, TypedDict, overload
2
+
3
+ URLPatternInput: TypeAlias = str | URLPatternInit
4
+
5
+ class URLPattern:
6
+ @overload
7
+ def __init__(self, input: URLPatternInput, baseURL: str): ...
8
+ @overload
9
+ def __init__(self, input: URLPatternInput = {}): ...
10
+ def test(self, input: URLPatternInput = {}, baseURL: str | None = None) -> bool: ...
11
+ def exec(
12
+ self, input: URLPatternInput = {}, baseURL: str | None = None
13
+ ) -> URLPatternResult | None: ...
14
+ @property
15
+ def protocol(self) -> str: ...
16
+ @property
17
+ def username(self) -> str: ...
18
+ @property
19
+ def password(self) -> str: ...
20
+ @property
21
+ def hostname(self) -> str: ...
22
+ @property
23
+ def port(self) -> str: ...
24
+ @property
25
+ def pathname(self) -> str: ...
26
+ @property
27
+ def search(self) -> str: ...
28
+ @property
29
+ def hash(self) -> str: ...
30
+
31
+ class URLPatternInit(TypedDict, total=False):
32
+ protocol: str
33
+ username: str
34
+ password: str
35
+ hostname: str
36
+ port: str
37
+ pathname: str
38
+ search: str
39
+ hash: str
40
+ baseURL: str
41
+
42
+ class URLPatternResult(TypedDict):
43
+ inputs: list[URLPatternInput]
44
+
45
+ protocol: URLPatternComponentResult
46
+ username: URLPatternComponentResult
47
+ password: URLPatternComponentResult
48
+ hostname: URLPatternComponentResult
49
+ port: URLPatternComponentResult
50
+ pathname: URLPatternComponentResult
51
+ search: URLPatternComponentResult
52
+ hash: URLPatternComponentResult
53
+
54
+ class URLPatternComponentResult(TypedDict):
55
+ input: str
56
+ groups: dict[str, str]
57
+
58
+ URLPatternCompatible: TypeAlias = str | URLPatternInit | URLPattern
urlpattern/py.typed ADDED
File without changes
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.4
2
+ Name: urlpattern
3
+ Version: 0.1.3
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Rust
16
+ Classifier: Programming Language :: Python :: Implementation :: CPython
17
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
18
+ Classifier: Topic :: Internet :: WWW/HTTP
19
+ Classifier: Typing :: Typed
20
+ License-File: LICENSE
21
+ Summary: An implementation of the URL Pattern Standard for Python written in Rust
22
+ Keywords: urlpattern
23
+ Author: 방성범 (Bang Seongbeom) <bangseongbeom@gmail.com>
24
+ Author-email: "방성범 (Bang Seongbeom)" <bangseongbeom@gmail.com>
25
+ License: MIT
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
28
+ Project-URL: Homepage, https://github.com/urlpattern/python-urlpattern
29
+ Project-URL: Repository, https://github.com/urlpattern/python-urlpattern.git
30
+ Project-URL: Issues, https://github.com/urlpattern/python-urlpattern/issues
31
+
32
+ # URL Pattern
33
+
34
+ [![PyPI - Version](https://img.shields.io/pypi/v/urlpattern)](https://pypi.org/project/urlpattern/)
35
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/urlpattern)](https://pypi.org/project/urlpattern/)
36
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
37
+ [![CI](https://github.com/urlpattern/python-urlpattern/actions/workflows/CI.yml/badge.svg)](https://github.com/urlpattern/python-urlpattern/actions)
38
+
39
+ An implementation of [the URL Pattern Standard](https://urlpattern.spec.whatwg.org/) for Python written in Rust
40
+
41
+ ## Introduction
42
+
43
+ It provides a pattern matching syntax like `/users/:id/`, similar to [Express](https://expressjs.com/) or [Path-to-RegExp](https://github.com/pillarjs/path-to-regexp) in Node.js. You can use it as a foundation to build your own web server or framework.
44
+
45
+ It's a thin wrapper of [denoland/rust-urlpattern](https://github.com/denoland/rust-urlpattern) with [PyO3](https://github.com/PyO3/pyo3) + [Maturin](https://github.com/PyO3/maturin).
46
+
47
+ ## Examples
48
+
49
+ ```py
50
+ from urlpattern import URLPattern
51
+
52
+ pattern = URLPattern("https://example.com/admin/*")
53
+ print(pattern.test("https://example.com/admin/main/")) # output: True
54
+ print(pattern.test("https://example.com/main/")) # output: False
55
+ ```
56
+
57
+ ```py
58
+ from urlpattern import URLPattern
59
+
60
+ pattern = URLPattern({"pathname": "/users/:id/"})
61
+ result = pattern.exec({"pathname": "/users/4163/"})
62
+ print(result["pathname"]["groups"]["id"]) # output: 4163
63
+ ```
64
+
65
+ ## Installation
66
+
67
+ On Linux/UNIX or macOS:
68
+
69
+ ```sh
70
+ pip install urlpattern
71
+ ```
72
+
73
+ On Windows:
74
+
75
+ ```sh
76
+ py -m pip install urlpattern
77
+ ```
78
+
79
+ ## Limitations
80
+
81
+ Due to limitations in the dependency [denoland/rust-urlpattern](https://github.com/denoland/rust-urlpattern), it may not support all features specified in [the standard](https://urlpattern.spec.whatwg.org/).
82
+
83
+ Check the limitations in [`tests/test_lib.py`](tests/test_lib.py).
84
+
@@ -0,0 +1,8 @@
1
+ urlpattern-0.1.3.dist-info/METADATA,sha256=f-uzzATGZSQb-CnLbrXdJhqWPXozHp2amC0705JzsOg,3466
2
+ urlpattern-0.1.3.dist-info/WHEEL,sha256=tAGdc4C2KTz7B2CZ8Jf3DcKSAviAbCg44UH9ma2gYww,96
3
+ urlpattern-0.1.3.dist-info/licenses/LICENSE,sha256=_qapitbsCkJk_1XOkLpKwq-BiN5jH65q65PF4jnvJhg,1102
4
+ urlpattern/__init__.py,sha256=Yh9wWY3jN3l1xnfDMxdJFCrv7hLaidjhrUcnDS71DIU,123
5
+ urlpattern/__init__.pyi,sha256=YGP5n5_CYjPlN1xdsPeiXYkF8zxMmVp-3t9IhlHURgM,1668
6
+ urlpattern/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ urlpattern/urlpattern.cp311-win_amd64.pyd,sha256=At5Z0hqPsG5-z_9Fo6gZKgGOLm1Q860mW8SuMZN8JUA,2560000
8
+ urlpattern-0.1.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.8.3)
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-cp311-win_amd64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 방성범 (Bang Seongbeom)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.