urlpattern 0.1.7__tar.gz → 0.1.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.
@@ -280,7 +280,7 @@ dependencies = [
280
280
 
281
281
  [[package]]
282
282
  name = "python-urlpattern"
283
- version = "0.1.7"
283
+ version = "0.1.8"
284
284
  dependencies = [
285
285
  "pyo3",
286
286
  "urlpattern",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "python-urlpattern"
3
- version = "0.1.7"
3
+ version = "0.1.8"
4
4
  authors = ["방성범 (Bang Seongbeom) <bangseongbeom@gmail.com>"]
5
5
  edition = "2024"
6
6
  description = "An implementation of the URL Pattern Standard for Python written in Rust."
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: urlpattern
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
7
7
  Classifier: Operating System :: OS Independent
8
8
  Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
9
10
  Classifier: Programming Language :: Python :: 3.8
10
11
  Classifier: Programming Language :: Python :: 3.9
11
12
  Classifier: Programming Language :: Python :: 3.10
@@ -13,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
13
14
  Classifier: Programming Language :: Python :: 3.12
14
15
  Classifier: Programming Language :: Python :: 3.13
15
16
  Classifier: Programming Language :: Python :: 3.14
16
- Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: Free Threading
17
18
  Classifier: Programming Language :: Python :: Implementation :: CPython
18
19
  Classifier: Programming Language :: Python :: Implementation :: PyPy
19
20
  Classifier: Programming Language :: Rust
@@ -44,6 +45,8 @@ The URL Pattern Standard is a web standard for URL pattern matching. It is usefu
44
45
 
45
46
  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
 
48
+ The naming conventions follow [the standard](https://urlpattern.spec.whatwg.org/) as closely as possible, similar to [xml.dom](https://docs.python.org/3/library/xml.dom.html).
49
+
47
50
  ## Installation
48
51
 
49
52
  On Linux/UNIX or macOS:
@@ -86,6 +89,16 @@ result = pattern.exec({"pathname": "/users/4163/"})
86
89
  print(result["pathname"]["groups"]["id"]) # output: 4163
87
90
  ```
88
91
 
92
+ ### `baseURL`
93
+
94
+ ```py
95
+ from urlpattern import URLPattern
96
+
97
+ pattern = URLPattern({"pathname": "/admin/*"}, "https://example.com")
98
+ print(pattern.test({"pathname": "/admin/main/"}, "https://example.com")) # output: True
99
+ print(pattern.test("/admin/main/", "https://example.com")) # output: True
100
+ ```
101
+
89
102
  ### `ignoreCase`
90
103
 
91
104
  ```py
@@ -100,7 +113,7 @@ print(pattern.test("https://example.com/test")) # output: True
100
113
  print(pattern.test("https://example.com/TeST")) # output: True
101
114
  ```
102
115
 
103
- ### Simple WSGI app
116
+ ### A simple WSGI app
104
117
 
105
118
  ```py
106
119
  from wsgiref.simple_server import make_server
@@ -13,6 +13,8 @@ The URL Pattern Standard is a web standard for URL pattern matching. It is usefu
13
13
 
14
14
  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).
15
15
 
16
+ The naming conventions follow [the standard](https://urlpattern.spec.whatwg.org/) as closely as possible, similar to [xml.dom](https://docs.python.org/3/library/xml.dom.html).
17
+
16
18
  ## Installation
17
19
 
18
20
  On Linux/UNIX or macOS:
@@ -55,6 +57,16 @@ result = pattern.exec({"pathname": "/users/4163/"})
55
57
  print(result["pathname"]["groups"]["id"]) # output: 4163
56
58
  ```
57
59
 
60
+ ### `baseURL`
61
+
62
+ ```py
63
+ from urlpattern import URLPattern
64
+
65
+ pattern = URLPattern({"pathname": "/admin/*"}, "https://example.com")
66
+ print(pattern.test({"pathname": "/admin/main/"}, "https://example.com")) # output: True
67
+ print(pattern.test("/admin/main/", "https://example.com")) # output: True
68
+ ```
69
+
58
70
  ### `ignoreCase`
59
71
 
60
72
  ```py
@@ -69,7 +81,7 @@ print(pattern.test("https://example.com/test")) # output: True
69
81
  print(pattern.test("https://example.com/TeST")) # output: True
70
82
  ```
71
83
 
72
- ### Simple WSGI app
84
+ ### A simple WSGI app
73
85
 
74
86
  ```py
75
87
  from wsgiref.simple_server import make_server
@@ -15,6 +15,7 @@ classifiers = [
15
15
  "License :: OSI Approved :: MIT License",
16
16
  "Operating System :: OS Independent",
17
17
  "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
18
19
  "Programming Language :: Python :: 3.8",
19
20
  "Programming Language :: Python :: 3.9",
20
21
  "Programming Language :: Python :: 3.10",
@@ -22,7 +23,7 @@ classifiers = [
22
23
  "Programming Language :: Python :: 3.12",
23
24
  "Programming Language :: Python :: 3.13",
24
25
  "Programming Language :: Python :: 3.14",
25
- "Programming Language :: Python :: 3 :: Only",
26
+ "Programming Language :: Python :: Free Threading",
26
27
  "Programming Language :: Python :: Implementation :: CPython",
27
28
  "Programming Language :: Python :: Implementation :: PyPy",
28
29
  "Programming Language :: Rust",
@@ -35,6 +36,3 @@ dynamic = ["version"]
35
36
  Homepage = "https://github.com/urlpattern/python-urlpattern"
36
37
  Repository = "https://github.com/urlpattern/python-urlpattern.git"
37
38
  Issues = "https://github.com/urlpattern/python-urlpattern/issues"
38
-
39
- [tool.maturin]
40
- features = ["pyo3/extension-module"]
@@ -0,0 +1,107 @@
1
+ from typing import Optional, TypedDict, Union, overload
2
+
3
+ from typing_extensions import TypeAlias
4
+
5
+ URLPatternInput: TypeAlias = Union[str, URLPatternInit]
6
+
7
+ class URLPatternOptions(TypedDict, total=False):
8
+ ignoreCase: bool
9
+
10
+ class URLPattern:
11
+ @overload
12
+ def __init__(
13
+ self,
14
+ input: str,
15
+ baseURL: str,
16
+ options: URLPatternOptions = {},
17
+ ) -> None: ...
18
+ @overload
19
+ def __init__(
20
+ self,
21
+ input: str,
22
+ baseURL: str,
23
+ options: None,
24
+ ) -> None: ...
25
+ @overload
26
+ def __init__(
27
+ self,
28
+ input: URLPatternInit,
29
+ baseURL: str,
30
+ options: URLPatternOptions = {},
31
+ ) -> None: ...
32
+ @overload
33
+ def __init__(
34
+ self,
35
+ input: URLPatternInit,
36
+ baseURL: str,
37
+ options: None,
38
+ ) -> None: ...
39
+ @overload
40
+ def __init__(self, input: str, options: URLPatternOptions = {}) -> None: ...
41
+ @overload
42
+ def __init__(self, input: str, options: None) -> None: ...
43
+ @overload
44
+ def __init__(
45
+ self, input: URLPatternInit = {}, options: URLPatternOptions = {}
46
+ ) -> None: ...
47
+ @overload
48
+ def __init__(self, input: URLPatternInit, options: None) -> None: ...
49
+ @overload
50
+ def test(self, input: str, baseURL: Optional[str] = None) -> bool: ...
51
+ @overload
52
+ def test(
53
+ self, input: URLPatternInit = {}, baseURL: Optional[str] = None
54
+ ) -> bool: ...
55
+ @overload
56
+ def exec(
57
+ self, input: str, baseURL: Optional[str] = None
58
+ ) -> Optional[URLPatternResult]: ...
59
+ @overload
60
+ def exec(
61
+ self, input: URLPatternInit = {}, baseURL: Optional[str] = None
62
+ ) -> Optional[URLPatternResult]: ...
63
+ @property
64
+ def protocol(self) -> str: ...
65
+ @property
66
+ def username(self) -> str: ...
67
+ @property
68
+ def password(self) -> str: ...
69
+ @property
70
+ def hostname(self) -> str: ...
71
+ @property
72
+ def port(self) -> str: ...
73
+ @property
74
+ def pathname(self) -> str: ...
75
+ @property
76
+ def search(self) -> str: ...
77
+ @property
78
+ def hash(self) -> str: ...
79
+
80
+ class URLPatternInit(TypedDict, total=False):
81
+ protocol: str
82
+ username: str
83
+ password: str
84
+ hostname: str
85
+ port: str
86
+ pathname: str
87
+ search: str
88
+ hash: str
89
+ baseURL: str
90
+
91
+ class URLPatternResult(TypedDict):
92
+ inputs: list[URLPatternInput]
93
+
94
+ protocol: URLPatternComponentResult
95
+ username: URLPatternComponentResult
96
+ password: URLPatternComponentResult
97
+ hostname: URLPatternComponentResult
98
+ port: URLPatternComponentResult
99
+ pathname: URLPatternComponentResult
100
+ search: URLPatternComponentResult
101
+ hash: URLPatternComponentResult
102
+
103
+ class URLPatternComponentResult(TypedDict):
104
+ input: str
105
+ groups: dict[str, str]
106
+
107
+ URLPatternCompatible: TypeAlias = Union[str, URLPatternInit, URLPattern]
@@ -1,68 +0,0 @@
1
- from typing_extensions import TypeAlias, TypedDict, overload
2
-
3
- URLPatternInput: TypeAlias = str | URLPatternInit
4
-
5
- class URLPatternOptions(TypedDict, total=False):
6
- ignoreCase: bool
7
-
8
- class URLPattern:
9
- @overload
10
- def __init__(
11
- self,
12
- input: URLPatternInput,
13
- baseURL: str,
14
- options: URLPatternOptions | None = None,
15
- ): ...
16
- @overload
17
- def __init__(
18
- self, input: URLPatternInput, options: URLPatternOptions | None = None
19
- ): ...
20
- def test(self, input: URLPatternInput = {}, baseURL: str | None = None) -> bool: ...
21
- def exec(
22
- self, input: URLPatternInput = {}, baseURL: str | None = None
23
- ) -> URLPatternResult | None: ...
24
- @property
25
- def protocol(self) -> str: ...
26
- @property
27
- def username(self) -> str: ...
28
- @property
29
- def password(self) -> str: ...
30
- @property
31
- def hostname(self) -> str: ...
32
- @property
33
- def port(self) -> str: ...
34
- @property
35
- def pathname(self) -> str: ...
36
- @property
37
- def search(self) -> str: ...
38
- @property
39
- def hash(self) -> str: ...
40
-
41
- class URLPatternInit(TypedDict, total=False):
42
- protocol: str
43
- username: str
44
- password: str
45
- hostname: str
46
- port: str
47
- pathname: str
48
- search: str
49
- hash: str
50
- baseURL: str
51
-
52
- class URLPatternResult(TypedDict):
53
- inputs: list[URLPatternInput]
54
-
55
- protocol: URLPatternComponentResult
56
- username: URLPatternComponentResult
57
- password: URLPatternComponentResult
58
- hostname: URLPatternComponentResult
59
- port: URLPatternComponentResult
60
- pathname: URLPatternComponentResult
61
- search: URLPatternComponentResult
62
- hash: URLPatternComponentResult
63
-
64
- class URLPatternComponentResult(TypedDict):
65
- input: str
66
- groups: dict[str, str]
67
-
68
- URLPatternCompatible: TypeAlias = str | URLPatternInit | URLPattern
File without changes
File without changes
File without changes
File without changes
File without changes