urlpattern 0.3.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.
@@ -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
 
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "recommendations": [
3
3
  "charliermarsh.ruff",
4
- "github.vscode-github-actions",
5
4
  "ms-python.python",
6
5
  "redhat.vscode-yaml",
7
6
  "rust-lang.rust-analyzer",
@@ -13,9 +13,9 @@ dependencies = [
13
13
 
14
14
  [[package]]
15
15
  name = "displaydoc"
16
- version = "0.2.5"
16
+ version = "0.2.6"
17
17
  source = "registry+https://github.com/rust-lang/crates.io-index"
18
- checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
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.1.1"
42
+ version = "2.2.0"
43
43
  source = "registry+https://github.com/rust-lang/crates.io-index"
44
- checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
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.1.1"
56
+ version = "2.2.0"
56
57
  source = "registry+https://github.com/rust-lang/crates.io-index"
57
- checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
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.1.1"
69
+ version = "2.2.0"
69
70
  source = "registry+https://github.com/rust-lang/crates.io-index"
70
- checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"
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.1.1"
83
+ version = "2.2.0"
83
84
  source = "registry+https://github.com/rust-lang/crates.io-index"
84
- checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
85
+ checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
85
86
 
86
87
  [[package]]
87
88
  name = "icu_properties"
88
- version = "2.1.2"
89
+ version = "2.2.0"
89
90
  source = "registry+https://github.com/rust-lang/crates.io-index"
90
- checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"
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.1.2"
103
+ version = "2.2.0"
103
104
  source = "registry+https://github.com/rust-lang/crates.io-index"
104
- checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"
105
+ checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
105
106
 
106
107
  [[package]]
107
108
  name = "icu_provider"
108
- version = "2.1.1"
109
+ version = "2.2.0"
109
110
  source = "registry+https://github.com/rust-lang/crates.io-index"
110
- checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
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.1"
135
+ version = "1.2.2"
135
136
  source = "registry+https://github.com/rust-lang/crates.io-index"
136
- checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
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.183"
145
+ version = "0.2.186"
145
146
  source = "registry+https://github.com/rust-lang/crates.io-index"
146
- checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
147
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
147
148
 
148
149
  [[package]]
149
150
  name = "litemap"
150
- version = "0.8.1"
151
+ version = "0.8.2"
151
152
  source = "registry+https://github.com/rust-lang/crates.io-index"
152
- checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
153
+ checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
153
154
 
154
155
  [[package]]
155
156
  name = "memchr"
156
- version = "2.8.0"
157
+ version = "2.8.2"
157
158
  source = "registry+https://github.com/rust-lang/crates.io-index"
158
- checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
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.4"
181
+ version = "0.1.5"
181
182
  source = "registry+https://github.com/rust-lang/crates.io-index"
182
- checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
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.28.2"
199
+ version = "0.29.0"
199
200
  source = "registry+https://github.com/rust-lang/crates.io-index"
200
- checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1"
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.28.2"
213
+ version = "0.29.0"
213
214
  source = "registry+https://github.com/rust-lang/crates.io-index"
214
- checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7"
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.28.2"
222
+ version = "0.29.0"
222
223
  source = "registry+https://github.com/rust-lang/crates.io-index"
223
- checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc"
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.28.2"
232
+ version = "0.29.0"
232
233
  source = "registry+https://github.com/rust-lang/crates.io-index"
233
- checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e"
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.28.2"
244
+ version = "0.29.0"
244
245
  source = "registry+https://github.com/rust-lang/crates.io-index"
245
- checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a"
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.3"
265
+ version = "1.12.4"
266
266
  source = "registry+https://github.com/rust-lang/crates.io-index"
267
- checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
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.10"
288
+ version = "0.8.11"
289
289
  source = "registry+https://github.com/rust-lang/crates.io-index"
290
- checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
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.1"
324
+ version = "1.15.2"
325
325
  source = "registry+https://github.com/rust-lang/crates.io-index"
326
- checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
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.2"
364
+ version = "0.8.3"
365
365
  source = "registry+https://github.com/rust-lang/crates.io-index"
366
- checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
366
+ checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
367
367
  dependencies = [
368
368
  "displaydoc",
369
369
  "zerovec",
@@ -389,7 +389,7 @@ dependencies = [
389
389
 
390
390
  [[package]]
391
391
  name = "urlpattern"
392
- version = "0.3.0"
392
+ version = "0.3.1"
393
393
  dependencies = [
394
394
  "pyo3",
395
395
  "regex",
@@ -417,15 +417,15 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
417
417
 
418
418
  [[package]]
419
419
  name = "writeable"
420
- version = "0.6.2"
420
+ version = "0.6.3"
421
421
  source = "registry+https://github.com/rust-lang/crates.io-index"
422
- checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
422
+ checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
423
423
 
424
424
  [[package]]
425
425
  name = "yoke"
426
- version = "0.8.1"
426
+ version = "0.8.3"
427
427
  source = "registry+https://github.com/rust-lang/crates.io-index"
428
- checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
428
+ checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
429
429
  dependencies = [
430
430
  "stable_deref_trait",
431
431
  "yoke-derive",
@@ -434,9 +434,9 @@ dependencies = [
434
434
 
435
435
  [[package]]
436
436
  name = "yoke-derive"
437
- version = "0.8.1"
437
+ version = "0.8.2"
438
438
  source = "registry+https://github.com/rust-lang/crates.io-index"
439
- checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
439
+ checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
440
440
  dependencies = [
441
441
  "proc-macro2",
442
442
  "quote",
@@ -446,18 +446,18 @@ dependencies = [
446
446
 
447
447
  [[package]]
448
448
  name = "zerofrom"
449
- version = "0.1.6"
449
+ version = "0.1.8"
450
450
  source = "registry+https://github.com/rust-lang/crates.io-index"
451
- checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
451
+ checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
452
452
  dependencies = [
453
453
  "zerofrom-derive",
454
454
  ]
455
455
 
456
456
  [[package]]
457
457
  name = "zerofrom-derive"
458
- version = "0.1.6"
458
+ version = "0.1.7"
459
459
  source = "registry+https://github.com/rust-lang/crates.io-index"
460
- checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
460
+ checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
461
461
  dependencies = [
462
462
  "proc-macro2",
463
463
  "quote",
@@ -467,9 +467,9 @@ dependencies = [
467
467
 
468
468
  [[package]]
469
469
  name = "zerotrie"
470
- version = "0.2.3"
470
+ version = "0.2.4"
471
471
  source = "registry+https://github.com/rust-lang/crates.io-index"
472
- checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
472
+ checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
473
473
  dependencies = [
474
474
  "displaydoc",
475
475
  "yoke",
@@ -478,9 +478,9 @@ dependencies = [
478
478
 
479
479
  [[package]]
480
480
  name = "zerovec"
481
- version = "0.11.5"
481
+ version = "0.11.6"
482
482
  source = "registry+https://github.com/rust-lang/crates.io-index"
483
- checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
483
+ checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
484
484
  dependencies = [
485
485
  "yoke",
486
486
  "zerofrom",
@@ -489,9 +489,9 @@ dependencies = [
489
489
 
490
490
  [[package]]
491
491
  name = "zerovec-derive"
492
- version = "0.11.2"
492
+ version = "0.11.3"
493
493
  source = "registry+https://github.com/rust-lang/crates.io-index"
494
- checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
494
+ checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
495
495
  dependencies = [
496
496
  "proc-macro2",
497
497
  "quote",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "urlpattern"
3
- version = "0.3.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,10 +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
- deno-urlpattern = { version = "0.6.0", package = "urlpattern" }
19
- pyo3 = "0.28.2"
20
- regex = "1.12.3"
19
+ pyo3 = "0.29.0"
20
+ regex = "1.12.4"
21
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.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
  [![PyPI - Version](https://img.shields.io/pypi/v/urlpattern)](https://pypi.org/project/urlpattern/)
36
36
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/urlpattern)](https://pypi.org/project/urlpattern/)
37
37
  [![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)
38
- [![CI](https://github.com/urlpattern/python-urlpattern/actions/workflows/CI.yml/badge.svg)](https://github.com/urlpattern/python-urlpattern/actions)
38
+ [![CI](https://github.com/urlpattern/python-urlpattern/actions/workflows/CI.yml/badge.svg)](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
- 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).
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
- Check [urlpattern.pyi](https://github.com/urlpattern/python-urlpattern/blob/main/urlpattern.pyi) or the examples below.
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
- ## Examples
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/")) # output: True
79
- print(pattern.test("https://example.com/main/")) # output: False
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"]) # output: 4163
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/")) # output: True
99
- print(pattern.test("b", "https://example.com/a/")) # output: True
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
- ) # output: True
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")) # output: True
112
- print(pattern.test("https://example.com/TeST")) # output: False
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")) # output: True
116
- print(pattern.test("https://example.com/TeST")) # output: True
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
@@ -160,7 +186,7 @@ Check `pytest.skip` in [`tests/test_lib.py`](https://github.com/urlpattern/pytho
160
186
 
161
187
  ## Why camelCase?
162
188
 
163
- In this library, some names such as `baseURL` and `hasRegExpGroups` do not use snake_case.
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.
164
190
 
165
- 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. This library follows that convention as well.
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.
166
192
 
@@ -3,17 +3,15 @@
3
3
  [![PyPI - Version](https://img.shields.io/pypi/v/urlpattern)](https://pypi.org/project/urlpattern/)
4
4
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/urlpattern)](https://pypi.org/project/urlpattern/)
5
5
  [![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)
6
- [![CI](https://github.com/urlpattern/python-urlpattern/actions/workflows/CI.yml/badge.svg)](https://github.com/urlpattern/python-urlpattern/actions)
6
+ [![CI](https://github.com/urlpattern/python-urlpattern/actions/workflows/CI.yml/badge.svg)](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
- 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).
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
- Check [urlpattern.pyi](https://github.com/urlpattern/python-urlpattern/blob/main/urlpattern.pyi) or the examples below.
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
- ## Examples
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/")) # output: True
47
- print(pattern.test("https://example.com/main/")) # output: False
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"]) # output: 4163
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/")) # output: True
67
- print(pattern.test("b", "https://example.com/a/")) # output: True
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
- ) # output: True
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")) # output: True
80
- print(pattern.test("https://example.com/TeST")) # output: False
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")) # output: True
84
- print(pattern.test("https://example.com/TeST")) # output: True
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
@@ -128,6 +154,6 @@ Check `pytest.skip` in [`tests/test_lib.py`](https://github.com/urlpattern/pytho
128
154
 
129
155
  ## Why camelCase?
130
156
 
131
- In this library, some names such as `baseURL` and `hasRegExpGroups` do not use snake_case.
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.
132
158
 
133
- 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. This library follows that convention as well.
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.