urlpattern 0.2.0__tar.gz → 0.3.1__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.
- {urlpattern-0.2.0 → urlpattern-0.3.1}/.devcontainer/devcontainer.json +3 -2
- {urlpattern-0.2.0 → urlpattern-0.3.1}/.vscode/extensions.json +0 -1
- {urlpattern-0.2.0 → urlpattern-0.3.1}/Cargo.lock +64 -62
- {urlpattern-0.2.0 → urlpattern-0.3.1}/Cargo.toml +6 -3
- {urlpattern-0.2.0 → urlpattern-0.3.1}/PKG-INFO +51 -19
- {urlpattern-0.2.0 → urlpattern-0.3.1}/README.md +50 -18
- urlpattern-0.3.1/src/lib.rs +424 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/tests/test_lib.py +15 -8
- {urlpattern-0.2.0 → urlpattern-0.3.1}/urlpattern.pyi +1 -1
- urlpattern-0.2.0/src/lib.rs +0 -370
- {urlpattern-0.2.0 → urlpattern-0.3.1}/.github/dependabot.yml +0 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/.github/workflows/CI.yml +0 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/.gitignore +0 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/.vscode/settings.json +0 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/LICENSE +0 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/pyproject.toml +0 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/tests/__init__.py +0 -0
- {urlpattern-0.2.0 → urlpattern-0.3.1}/tests/urlpatterntestdata.json +0 -0
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
"name": "Python 3",
|
|
5
5
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
6
6
|
"image": "mcr.microsoft.com/devcontainers/python:3-3.14-trixie",
|
|
7
|
-
|
|
8
|
-
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
9
7
|
"features": {
|
|
10
8
|
"ghcr.io/devcontainers/features/rust:1": {}
|
|
11
9
|
},
|
|
12
10
|
|
|
11
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
12
|
+
// "features": {},
|
|
13
|
+
|
|
13
14
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
14
15
|
// "forwardPorts": [],
|
|
15
16
|
|
|
@@ -13,9 +13,9 @@ dependencies = [
|
|
|
13
13
|
|
|
14
14
|
[[package]]
|
|
15
15
|
name = "displaydoc"
|
|
16
|
-
version = "0.2.
|
|
16
|
+
version = "0.2.6"
|
|
17
17
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
-
checksum = "
|
|
18
|
+
checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f"
|
|
19
19
|
dependencies = [
|
|
20
20
|
"proc-macro2",
|
|
21
21
|
"quote",
|
|
@@ -39,12 +39,13 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
|
39
39
|
|
|
40
40
|
[[package]]
|
|
41
41
|
name = "icu_collections"
|
|
42
|
-
version = "2.
|
|
42
|
+
version = "2.2.0"
|
|
43
43
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
44
|
-
checksum = "
|
|
44
|
+
checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
|
|
45
45
|
dependencies = [
|
|
46
46
|
"displaydoc",
|
|
47
47
|
"potential_utf",
|
|
48
|
+
"utf8_iter",
|
|
48
49
|
"yoke",
|
|
49
50
|
"zerofrom",
|
|
50
51
|
"zerovec",
|
|
@@ -52,9 +53,9 @@ dependencies = [
|
|
|
52
53
|
|
|
53
54
|
[[package]]
|
|
54
55
|
name = "icu_locale_core"
|
|
55
|
-
version = "2.
|
|
56
|
+
version = "2.2.0"
|
|
56
57
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
-
checksum = "
|
|
58
|
+
checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
|
|
58
59
|
dependencies = [
|
|
59
60
|
"displaydoc",
|
|
60
61
|
"litemap",
|
|
@@ -65,9 +66,9 @@ dependencies = [
|
|
|
65
66
|
|
|
66
67
|
[[package]]
|
|
67
68
|
name = "icu_normalizer"
|
|
68
|
-
version = "2.
|
|
69
|
+
version = "2.2.0"
|
|
69
70
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
-
checksum = "
|
|
71
|
+
checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
|
|
71
72
|
dependencies = [
|
|
72
73
|
"icu_collections",
|
|
73
74
|
"icu_normalizer_data",
|
|
@@ -79,15 +80,15 @@ dependencies = [
|
|
|
79
80
|
|
|
80
81
|
[[package]]
|
|
81
82
|
name = "icu_normalizer_data"
|
|
82
|
-
version = "2.
|
|
83
|
+
version = "2.2.0"
|
|
83
84
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
-
checksum = "
|
|
85
|
+
checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
|
|
85
86
|
|
|
86
87
|
[[package]]
|
|
87
88
|
name = "icu_properties"
|
|
88
|
-
version = "2.
|
|
89
|
+
version = "2.2.0"
|
|
89
90
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
-
checksum = "
|
|
91
|
+
checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
|
|
91
92
|
dependencies = [
|
|
92
93
|
"icu_collections",
|
|
93
94
|
"icu_locale_core",
|
|
@@ -99,15 +100,15 @@ dependencies = [
|
|
|
99
100
|
|
|
100
101
|
[[package]]
|
|
101
102
|
name = "icu_properties_data"
|
|
102
|
-
version = "2.
|
|
103
|
+
version = "2.2.0"
|
|
103
104
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
104
|
-
checksum = "
|
|
105
|
+
checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
|
|
105
106
|
|
|
106
107
|
[[package]]
|
|
107
108
|
name = "icu_provider"
|
|
108
|
-
version = "2.
|
|
109
|
+
version = "2.2.0"
|
|
109
110
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
-
checksum = "
|
|
111
|
+
checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
|
|
111
112
|
dependencies = [
|
|
112
113
|
"displaydoc",
|
|
113
114
|
"icu_locale_core",
|
|
@@ -131,9 +132,9 @@ dependencies = [
|
|
|
131
132
|
|
|
132
133
|
[[package]]
|
|
133
134
|
name = "idna_adapter"
|
|
134
|
-
version = "1.2.
|
|
135
|
+
version = "1.2.2"
|
|
135
136
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
136
|
-
checksum = "
|
|
137
|
+
checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
|
|
137
138
|
dependencies = [
|
|
138
139
|
"icu_normalizer",
|
|
139
140
|
"icu_properties",
|
|
@@ -141,21 +142,21 @@ dependencies = [
|
|
|
141
142
|
|
|
142
143
|
[[package]]
|
|
143
144
|
name = "libc"
|
|
144
|
-
version = "0.2.
|
|
145
|
+
version = "0.2.186"
|
|
145
146
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
-
checksum = "
|
|
147
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
147
148
|
|
|
148
149
|
[[package]]
|
|
149
150
|
name = "litemap"
|
|
150
|
-
version = "0.8.
|
|
151
|
+
version = "0.8.2"
|
|
151
152
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
152
|
-
checksum = "
|
|
153
|
+
checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
|
|
153
154
|
|
|
154
155
|
[[package]]
|
|
155
156
|
name = "memchr"
|
|
156
|
-
version = "2.8.
|
|
157
|
+
version = "2.8.2"
|
|
157
158
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
-
checksum = "
|
|
159
|
+
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
|
|
159
160
|
|
|
160
161
|
[[package]]
|
|
161
162
|
name = "once_cell"
|
|
@@ -177,9 +178,9 @@ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
|
177
178
|
|
|
178
179
|
[[package]]
|
|
179
180
|
name = "potential_utf"
|
|
180
|
-
version = "0.1.
|
|
181
|
+
version = "0.1.5"
|
|
181
182
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
182
|
-
checksum = "
|
|
183
|
+
checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
|
|
183
184
|
dependencies = [
|
|
184
185
|
"zerovec",
|
|
185
186
|
]
|
|
@@ -195,9 +196,9 @@ dependencies = [
|
|
|
195
196
|
|
|
196
197
|
[[package]]
|
|
197
198
|
name = "pyo3"
|
|
198
|
-
version = "0.
|
|
199
|
+
version = "0.29.0"
|
|
199
200
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
200
|
-
checksum = "
|
|
201
|
+
checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
|
|
201
202
|
dependencies = [
|
|
202
203
|
"libc",
|
|
203
204
|
"once_cell",
|
|
@@ -209,18 +210,18 @@ dependencies = [
|
|
|
209
210
|
|
|
210
211
|
[[package]]
|
|
211
212
|
name = "pyo3-build-config"
|
|
212
|
-
version = "0.
|
|
213
|
+
version = "0.29.0"
|
|
213
214
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
214
|
-
checksum = "
|
|
215
|
+
checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
|
|
215
216
|
dependencies = [
|
|
216
217
|
"target-lexicon",
|
|
217
218
|
]
|
|
218
219
|
|
|
219
220
|
[[package]]
|
|
220
221
|
name = "pyo3-ffi"
|
|
221
|
-
version = "0.
|
|
222
|
+
version = "0.29.0"
|
|
222
223
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
223
|
-
checksum = "
|
|
224
|
+
checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
|
|
224
225
|
dependencies = [
|
|
225
226
|
"libc",
|
|
226
227
|
"pyo3-build-config",
|
|
@@ -228,9 +229,9 @@ dependencies = [
|
|
|
228
229
|
|
|
229
230
|
[[package]]
|
|
230
231
|
name = "pyo3-macros"
|
|
231
|
-
version = "0.
|
|
232
|
+
version = "0.29.0"
|
|
232
233
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
-
checksum = "
|
|
234
|
+
checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
|
|
234
235
|
dependencies = [
|
|
235
236
|
"proc-macro2",
|
|
236
237
|
"pyo3-macros-backend",
|
|
@@ -240,13 +241,12 @@ dependencies = [
|
|
|
240
241
|
|
|
241
242
|
[[package]]
|
|
242
243
|
name = "pyo3-macros-backend"
|
|
243
|
-
version = "0.
|
|
244
|
+
version = "0.29.0"
|
|
244
245
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
245
|
-
checksum = "
|
|
246
|
+
checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
|
|
246
247
|
dependencies = [
|
|
247
248
|
"heck",
|
|
248
249
|
"proc-macro2",
|
|
249
|
-
"pyo3-build-config",
|
|
250
250
|
"quote",
|
|
251
251
|
"syn",
|
|
252
252
|
]
|
|
@@ -262,9 +262,9 @@ dependencies = [
|
|
|
262
262
|
|
|
263
263
|
[[package]]
|
|
264
264
|
name = "regex"
|
|
265
|
-
version = "1.12.
|
|
265
|
+
version = "1.12.4"
|
|
266
266
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
267
|
-
checksum = "
|
|
267
|
+
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
|
268
268
|
dependencies = [
|
|
269
269
|
"aho-corasick",
|
|
270
270
|
"memchr",
|
|
@@ -285,9 +285,9 @@ dependencies = [
|
|
|
285
285
|
|
|
286
286
|
[[package]]
|
|
287
287
|
name = "regex-syntax"
|
|
288
|
-
version = "0.8.
|
|
288
|
+
version = "0.8.11"
|
|
289
289
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
290
|
-
checksum = "
|
|
290
|
+
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
291
291
|
|
|
292
292
|
[[package]]
|
|
293
293
|
name = "serde"
|
|
@@ -321,9 +321,9 @@ dependencies = [
|
|
|
321
321
|
|
|
322
322
|
[[package]]
|
|
323
323
|
name = "smallvec"
|
|
324
|
-
version = "1.15.
|
|
324
|
+
version = "1.15.2"
|
|
325
325
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
326
|
-
checksum = "
|
|
326
|
+
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
|
|
327
327
|
|
|
328
328
|
[[package]]
|
|
329
329
|
name = "stable_deref_trait"
|
|
@@ -361,9 +361,9 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
|
361
361
|
|
|
362
362
|
[[package]]
|
|
363
363
|
name = "tinystr"
|
|
364
|
-
version = "0.8.
|
|
364
|
+
version = "0.8.3"
|
|
365
365
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
366
|
-
checksum = "
|
|
366
|
+
checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
|
|
367
367
|
dependencies = [
|
|
368
368
|
"displaydoc",
|
|
369
369
|
"zerovec",
|
|
@@ -389,9 +389,11 @@ dependencies = [
|
|
|
389
389
|
|
|
390
390
|
[[package]]
|
|
391
391
|
name = "urlpattern"
|
|
392
|
-
version = "0.
|
|
392
|
+
version = "0.3.1"
|
|
393
393
|
dependencies = [
|
|
394
394
|
"pyo3",
|
|
395
|
+
"regex",
|
|
396
|
+
"url",
|
|
395
397
|
"urlpattern 0.6.0",
|
|
396
398
|
]
|
|
397
399
|
|
|
@@ -415,15 +417,15 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|
|
415
417
|
|
|
416
418
|
[[package]]
|
|
417
419
|
name = "writeable"
|
|
418
|
-
version = "0.6.
|
|
420
|
+
version = "0.6.3"
|
|
419
421
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
420
|
-
checksum = "
|
|
422
|
+
checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
|
|
421
423
|
|
|
422
424
|
[[package]]
|
|
423
425
|
name = "yoke"
|
|
424
|
-
version = "0.8.
|
|
426
|
+
version = "0.8.3"
|
|
425
427
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
426
|
-
checksum = "
|
|
428
|
+
checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
|
|
427
429
|
dependencies = [
|
|
428
430
|
"stable_deref_trait",
|
|
429
431
|
"yoke-derive",
|
|
@@ -432,9 +434,9 @@ dependencies = [
|
|
|
432
434
|
|
|
433
435
|
[[package]]
|
|
434
436
|
name = "yoke-derive"
|
|
435
|
-
version = "0.8.
|
|
437
|
+
version = "0.8.2"
|
|
436
438
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
437
|
-
checksum = "
|
|
439
|
+
checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
|
|
438
440
|
dependencies = [
|
|
439
441
|
"proc-macro2",
|
|
440
442
|
"quote",
|
|
@@ -444,18 +446,18 @@ dependencies = [
|
|
|
444
446
|
|
|
445
447
|
[[package]]
|
|
446
448
|
name = "zerofrom"
|
|
447
|
-
version = "0.1.
|
|
449
|
+
version = "0.1.8"
|
|
448
450
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
449
|
-
checksum = "
|
|
451
|
+
checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
|
|
450
452
|
dependencies = [
|
|
451
453
|
"zerofrom-derive",
|
|
452
454
|
]
|
|
453
455
|
|
|
454
456
|
[[package]]
|
|
455
457
|
name = "zerofrom-derive"
|
|
456
|
-
version = "0.1.
|
|
458
|
+
version = "0.1.7"
|
|
457
459
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
458
|
-
checksum = "
|
|
460
|
+
checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
|
|
459
461
|
dependencies = [
|
|
460
462
|
"proc-macro2",
|
|
461
463
|
"quote",
|
|
@@ -465,9 +467,9 @@ dependencies = [
|
|
|
465
467
|
|
|
466
468
|
[[package]]
|
|
467
469
|
name = "zerotrie"
|
|
468
|
-
version = "0.2.
|
|
470
|
+
version = "0.2.4"
|
|
469
471
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
470
|
-
checksum = "
|
|
472
|
+
checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
|
|
471
473
|
dependencies = [
|
|
472
474
|
"displaydoc",
|
|
473
475
|
"yoke",
|
|
@@ -476,9 +478,9 @@ dependencies = [
|
|
|
476
478
|
|
|
477
479
|
[[package]]
|
|
478
480
|
name = "zerovec"
|
|
479
|
-
version = "0.11.
|
|
481
|
+
version = "0.11.6"
|
|
480
482
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
481
|
-
checksum = "
|
|
483
|
+
checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
|
|
482
484
|
dependencies = [
|
|
483
485
|
"yoke",
|
|
484
486
|
"zerofrom",
|
|
@@ -487,9 +489,9 @@ dependencies = [
|
|
|
487
489
|
|
|
488
490
|
[[package]]
|
|
489
491
|
name = "zerovec-derive"
|
|
490
|
-
version = "0.11.
|
|
492
|
+
version = "0.11.3"
|
|
491
493
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
492
|
-
checksum = "
|
|
494
|
+
checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
|
|
493
495
|
dependencies = [
|
|
494
496
|
"proc-macro2",
|
|
495
497
|
"quote",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "urlpattern"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.1"
|
|
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."
|
|
@@ -12,8 +12,11 @@ readme = "README.md"
|
|
|
12
12
|
|
|
13
13
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
14
14
|
[lib]
|
|
15
|
+
name = "urlpattern"
|
|
15
16
|
crate-type = ["cdylib"]
|
|
16
17
|
|
|
17
18
|
[dependencies]
|
|
18
|
-
pyo3 = "0.
|
|
19
|
-
|
|
19
|
+
pyo3 = "0.29.0"
|
|
20
|
+
regex = "1.12.4"
|
|
21
|
+
url = "2.5.8"
|
|
22
|
+
urlpattern = "0.6.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: urlpattern
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -35,17 +35,15 @@ Project-URL: Repository, https://github.com/urlpattern/python-urlpattern.git
|
|
|
35
35
|
[](https://pypi.org/project/urlpattern/)
|
|
36
36
|
[](https://pypi.org/project/urlpattern/)
|
|
37
37
|
[](https://github.com/astral-sh/ruff)
|
|
38
|
-
[](https://github.com/urlpattern/python-urlpattern/actions)
|
|
38
|
+
[](https://github.com/urlpattern/python-urlpattern/actions/workflows/CI.yml)
|
|
39
39
|
|
|
40
40
|
An implementation of [the URL Pattern Standard](https://urlpattern.spec.whatwg.org/) for Python written in Rust.
|
|
41
41
|
|
|
42
42
|
## Introduction
|
|
43
43
|
|
|
44
|
-
The URL Pattern Standard is a web standard for URL pattern matching. It is useful on the server side when serving different pages based on the URL (a.k.a. routing). It provides pattern matching syntax like `/users/:id`, similar to [route parameters in Express](https://expressjs.com/en/guide/routing.html#route-parameters) or [Path-to-RegExp](https://github.com/pillarjs/path-to-regexp). You can use it as a foundation to build your own web server or framework.
|
|
45
|
-
|
|
46
44
|
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).
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
It is useful on the server side when serving different pages based on the URL (a.k.a. routing). It provides pattern matching syntax like `/users/:id`, similar to [route parameters in Express](https://expressjs.com/en/guide/routing.html#route-parameters) or [Path-to-RegExp](https://github.com/pillarjs/path-to-regexp). You can use it as a foundation to build your own web server or framework.
|
|
49
47
|
|
|
50
48
|
## Installation
|
|
51
49
|
|
|
@@ -63,11 +61,9 @@ py -m pip install urlpattern
|
|
|
63
61
|
|
|
64
62
|
## Usage
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
For various usage examples, you can also check [Chrome for Developers](https://developer.chrome.com/docs/web-platform/urlpattern) or [MDN](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) (you need to convert JavaScript into Python).
|
|
64
|
+
This library aims to expose an interface as close as possible to the URL Pattern Standard, but some differences are unavoidable because it is designed for Python, not JavaScript. For the exact details, please refer to [urlpattern.pyi](https://github.com/urlpattern/python-urlpattern/blob/main/urlpattern.pyi).
|
|
69
65
|
|
|
70
|
-
|
|
66
|
+
Most JavaScript examples from [Chrome for Developers](https://developer.chrome.com/docs/web-platform/urlpattern) and [MDN](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) can be adapted to Python without much difficulty.
|
|
71
67
|
|
|
72
68
|
### `test`
|
|
73
69
|
|
|
@@ -75,8 +71,15 @@ For various usage examples, you can also check [Chrome for Developers](https://d
|
|
|
75
71
|
from urlpattern import URLPattern
|
|
76
72
|
|
|
77
73
|
pattern = URLPattern("https://example.com/admin/*")
|
|
78
|
-
print(pattern.test("https://example.com/admin/main/"))
|
|
79
|
-
print(pattern.test("https://example.com/main/"))
|
|
74
|
+
print(pattern.test("https://example.com/admin/main/"))
|
|
75
|
+
print(pattern.test("https://example.com/main/"))
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Output:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
True
|
|
82
|
+
False
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
### `exec`
|
|
@@ -86,7 +89,13 @@ from urlpattern import URLPattern
|
|
|
86
89
|
|
|
87
90
|
pattern = URLPattern({"pathname": "/users/:id/"})
|
|
88
91
|
result = pattern.exec({"pathname": "/users/4163/"})
|
|
89
|
-
print(result["pathname"]["groups"]["id"])
|
|
92
|
+
print(result["pathname"]["groups"]["id"])
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Output:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
4163
|
|
90
99
|
```
|
|
91
100
|
|
|
92
101
|
### `baseURL`
|
|
@@ -95,11 +104,19 @@ print(result["pathname"]["groups"]["id"]) # output: 4163
|
|
|
95
104
|
from urlpattern import URLPattern
|
|
96
105
|
|
|
97
106
|
pattern = URLPattern("b", "https://example.com/a/")
|
|
98
|
-
print(pattern.test("a/b", "https://example.com/"))
|
|
99
|
-
print(pattern.test("b", "https://example.com/a/"))
|
|
107
|
+
print(pattern.test("a/b", "https://example.com/"))
|
|
108
|
+
print(pattern.test("b", "https://example.com/a/"))
|
|
100
109
|
print(
|
|
101
110
|
pattern.test({"pathname": "b", "baseURL": "https://example.com/a/"})
|
|
102
|
-
)
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Output:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
True
|
|
118
|
+
True
|
|
119
|
+
True
|
|
103
120
|
```
|
|
104
121
|
|
|
105
122
|
### `ignoreCase`
|
|
@@ -108,12 +125,21 @@ print(
|
|
|
108
125
|
from urlpattern import URLPattern
|
|
109
126
|
|
|
110
127
|
pattern = URLPattern("https://example.com/test")
|
|
111
|
-
print(pattern.test("https://example.com/test"))
|
|
112
|
-
print(pattern.test("https://example.com/TeST"))
|
|
128
|
+
print(pattern.test("https://example.com/test"))
|
|
129
|
+
print(pattern.test("https://example.com/TeST"))
|
|
113
130
|
|
|
114
131
|
pattern = URLPattern("https://example.com/test", {"ignoreCase": True})
|
|
115
|
-
print(pattern.test("https://example.com/test"))
|
|
116
|
-
print(pattern.test("https://example.com/TeST"))
|
|
132
|
+
print(pattern.test("https://example.com/test"))
|
|
133
|
+
print(pattern.test("https://example.com/TeST"))
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Output:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
True
|
|
140
|
+
False
|
|
141
|
+
True
|
|
142
|
+
True
|
|
117
143
|
```
|
|
118
144
|
|
|
119
145
|
### A simple WSGI app
|
|
@@ -158,3 +184,9 @@ Due to limitations in the dependency [denoland/rust-urlpattern](https://github.c
|
|
|
158
184
|
|
|
159
185
|
Check `pytest.skip` in [`tests/test_lib.py`](https://github.com/urlpattern/python-urlpattern/blob/main/tests/test_lib.py).
|
|
160
186
|
|
|
187
|
+
## Why camelCase?
|
|
188
|
+
|
|
189
|
+
As seen in names like `baseURL` and `hasRegExpGroups`, this library does not follow Python's [PEP 8 naming conventions](https://peps.python.org/pep-0008/#function-and-variable-names). Instead, it follows [the standard](https://urlpattern.spec.whatwg.org/) naming as closely as possible.
|
|
190
|
+
|
|
191
|
+
Like [`xml.dom`](https://docs.python.org/3/library/xml.dom.html), Python wrappers around web standards typically preserve the original camelCase rather than converting names to snake_case, and this library follows that convention as well.
|
|
192
|
+
|
|
@@ -3,17 +3,15 @@
|
|
|
3
3
|
[](https://pypi.org/project/urlpattern/)
|
|
4
4
|
[](https://pypi.org/project/urlpattern/)
|
|
5
5
|
[](https://github.com/astral-sh/ruff)
|
|
6
|
-
[](https://github.com/urlpattern/python-urlpattern/actions)
|
|
6
|
+
[](https://github.com/urlpattern/python-urlpattern/actions/workflows/CI.yml)
|
|
7
7
|
|
|
8
8
|
An implementation of [the URL Pattern Standard](https://urlpattern.spec.whatwg.org/) for Python written in Rust.
|
|
9
9
|
|
|
10
10
|
## Introduction
|
|
11
11
|
|
|
12
|
-
The URL Pattern Standard is a web standard for URL pattern matching. It is useful on the server side when serving different pages based on the URL (a.k.a. routing). It provides pattern matching syntax like `/users/:id`, similar to [route parameters in Express](https://expressjs.com/en/guide/routing.html#route-parameters) or [Path-to-RegExp](https://github.com/pillarjs/path-to-regexp). You can use it as a foundation to build your own web server or framework.
|
|
13
|
-
|
|
14
12
|
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
13
|
|
|
16
|
-
|
|
14
|
+
It is useful on the server side when serving different pages based on the URL (a.k.a. routing). It provides pattern matching syntax like `/users/:id`, similar to [route parameters in Express](https://expressjs.com/en/guide/routing.html#route-parameters) or [Path-to-RegExp](https://github.com/pillarjs/path-to-regexp). You can use it as a foundation to build your own web server or framework.
|
|
17
15
|
|
|
18
16
|
## Installation
|
|
19
17
|
|
|
@@ -31,11 +29,9 @@ py -m pip install urlpattern
|
|
|
31
29
|
|
|
32
30
|
## Usage
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
For various usage examples, you can also check [Chrome for Developers](https://developer.chrome.com/docs/web-platform/urlpattern) or [MDN](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) (you need to convert JavaScript into Python).
|
|
32
|
+
This library aims to expose an interface as close as possible to the URL Pattern Standard, but some differences are unavoidable because it is designed for Python, not JavaScript. For the exact details, please refer to [urlpattern.pyi](https://github.com/urlpattern/python-urlpattern/blob/main/urlpattern.pyi).
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
Most JavaScript examples from [Chrome for Developers](https://developer.chrome.com/docs/web-platform/urlpattern) and [MDN](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) can be adapted to Python without much difficulty.
|
|
39
35
|
|
|
40
36
|
### `test`
|
|
41
37
|
|
|
@@ -43,8 +39,15 @@ For various usage examples, you can also check [Chrome for Developers](https://d
|
|
|
43
39
|
from urlpattern import URLPattern
|
|
44
40
|
|
|
45
41
|
pattern = URLPattern("https://example.com/admin/*")
|
|
46
|
-
print(pattern.test("https://example.com/admin/main/"))
|
|
47
|
-
print(pattern.test("https://example.com/main/"))
|
|
42
|
+
print(pattern.test("https://example.com/admin/main/"))
|
|
43
|
+
print(pattern.test("https://example.com/main/"))
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Output:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
True
|
|
50
|
+
False
|
|
48
51
|
```
|
|
49
52
|
|
|
50
53
|
### `exec`
|
|
@@ -54,7 +57,13 @@ from urlpattern import URLPattern
|
|
|
54
57
|
|
|
55
58
|
pattern = URLPattern({"pathname": "/users/:id/"})
|
|
56
59
|
result = pattern.exec({"pathname": "/users/4163/"})
|
|
57
|
-
print(result["pathname"]["groups"]["id"])
|
|
60
|
+
print(result["pathname"]["groups"]["id"])
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Output:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
4163
|
|
58
67
|
```
|
|
59
68
|
|
|
60
69
|
### `baseURL`
|
|
@@ -63,11 +72,19 @@ print(result["pathname"]["groups"]["id"]) # output: 4163
|
|
|
63
72
|
from urlpattern import URLPattern
|
|
64
73
|
|
|
65
74
|
pattern = URLPattern("b", "https://example.com/a/")
|
|
66
|
-
print(pattern.test("a/b", "https://example.com/"))
|
|
67
|
-
print(pattern.test("b", "https://example.com/a/"))
|
|
75
|
+
print(pattern.test("a/b", "https://example.com/"))
|
|
76
|
+
print(pattern.test("b", "https://example.com/a/"))
|
|
68
77
|
print(
|
|
69
78
|
pattern.test({"pathname": "b", "baseURL": "https://example.com/a/"})
|
|
70
|
-
)
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Output:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
True
|
|
86
|
+
True
|
|
87
|
+
True
|
|
71
88
|
```
|
|
72
89
|
|
|
73
90
|
### `ignoreCase`
|
|
@@ -76,12 +93,21 @@ print(
|
|
|
76
93
|
from urlpattern import URLPattern
|
|
77
94
|
|
|
78
95
|
pattern = URLPattern("https://example.com/test")
|
|
79
|
-
print(pattern.test("https://example.com/test"))
|
|
80
|
-
print(pattern.test("https://example.com/TeST"))
|
|
96
|
+
print(pattern.test("https://example.com/test"))
|
|
97
|
+
print(pattern.test("https://example.com/TeST"))
|
|
81
98
|
|
|
82
99
|
pattern = URLPattern("https://example.com/test", {"ignoreCase": True})
|
|
83
|
-
print(pattern.test("https://example.com/test"))
|
|
84
|
-
print(pattern.test("https://example.com/TeST"))
|
|
100
|
+
print(pattern.test("https://example.com/test"))
|
|
101
|
+
print(pattern.test("https://example.com/TeST"))
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Output:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
True
|
|
108
|
+
False
|
|
109
|
+
True
|
|
110
|
+
True
|
|
85
111
|
```
|
|
86
112
|
|
|
87
113
|
### A simple WSGI app
|
|
@@ -125,3 +151,9 @@ with make_server("", 8000, app) as httpd:
|
|
|
125
151
|
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/).
|
|
126
152
|
|
|
127
153
|
Check `pytest.skip` in [`tests/test_lib.py`](https://github.com/urlpattern/python-urlpattern/blob/main/tests/test_lib.py).
|
|
154
|
+
|
|
155
|
+
## Why camelCase?
|
|
156
|
+
|
|
157
|
+
As seen in names like `baseURL` and `hasRegExpGroups`, this library does not follow Python's [PEP 8 naming conventions](https://peps.python.org/pep-0008/#function-and-variable-names). Instead, it follows [the standard](https://urlpattern.spec.whatwg.org/) naming as closely as possible.
|
|
158
|
+
|
|
159
|
+
Like [`xml.dom`](https://docs.python.org/3/library/xml.dom.html), Python wrappers around web standards typically preserve the original camelCase rather than converting names to snake_case, and this library follows that convention as well.
|