yggdryl 0.1.0__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.
- yggdryl-0.1.0/Cargo.lock +349 -0
- yggdryl-0.1.0/Cargo.toml +24 -0
- yggdryl-0.1.0/PKG-INFO +50 -0
- yggdryl-0.1.0/README.md +31 -0
- yggdryl-0.1.0/bindings/python/Cargo.toml +27 -0
- yggdryl-0.1.0/bindings/python/README.md +31 -0
- yggdryl-0.1.0/bindings/python/src/lib.rs +256 -0
- yggdryl-0.1.0/bindings/python/tests/test_uri.py +99 -0
- yggdryl-0.1.0/crates/yggdryl/Cargo.toml +17 -0
- yggdryl-0.1.0/crates/yggdryl/README.md +26 -0
- yggdryl-0.1.0/crates/yggdryl/src/lib.rs +666 -0
- yggdryl-0.1.0/pyproject.toml +30 -0
yggdryl-0.1.0/Cargo.lock
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "aho-corasick"
|
|
7
|
+
version = "1.1.4"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"memchr",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "autocfg"
|
|
16
|
+
version = "1.5.1"
|
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
19
|
+
|
|
20
|
+
[[package]]
|
|
21
|
+
name = "bitflags"
|
|
22
|
+
version = "2.13.0"
|
|
23
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
+
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
|
|
25
|
+
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "cfg-if"
|
|
28
|
+
version = "1.0.4"
|
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "convert_case"
|
|
34
|
+
version = "0.6.0"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
|
|
37
|
+
dependencies = [
|
|
38
|
+
"unicode-segmentation",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "ctor"
|
|
43
|
+
version = "0.2.9"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"quote",
|
|
48
|
+
"syn",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "heck"
|
|
53
|
+
version = "0.5.0"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
56
|
+
|
|
57
|
+
[[package]]
|
|
58
|
+
name = "indoc"
|
|
59
|
+
version = "2.0.7"
|
|
60
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
61
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
62
|
+
dependencies = [
|
|
63
|
+
"rustversion",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
[[package]]
|
|
67
|
+
name = "libc"
|
|
68
|
+
version = "0.2.186"
|
|
69
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
71
|
+
|
|
72
|
+
[[package]]
|
|
73
|
+
name = "libloading"
|
|
74
|
+
version = "0.8.9"
|
|
75
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
76
|
+
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
77
|
+
dependencies = [
|
|
78
|
+
"cfg-if",
|
|
79
|
+
"windows-link",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[[package]]
|
|
83
|
+
name = "memchr"
|
|
84
|
+
version = "2.8.2"
|
|
85
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
+
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
|
|
87
|
+
|
|
88
|
+
[[package]]
|
|
89
|
+
name = "memoffset"
|
|
90
|
+
version = "0.9.1"
|
|
91
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
92
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
93
|
+
dependencies = [
|
|
94
|
+
"autocfg",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[[package]]
|
|
98
|
+
name = "napi"
|
|
99
|
+
version = "2.16.17"
|
|
100
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
+
checksum = "55740c4ae1d8696773c78fdafd5d0e5fe9bc9f1b071c7ba493ba5c413a9184f3"
|
|
102
|
+
dependencies = [
|
|
103
|
+
"bitflags",
|
|
104
|
+
"ctor",
|
|
105
|
+
"napi-derive",
|
|
106
|
+
"napi-sys",
|
|
107
|
+
"once_cell",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[[package]]
|
|
111
|
+
name = "napi-build"
|
|
112
|
+
version = "2.3.2"
|
|
113
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
114
|
+
checksum = "c9c366d2c8c60b86fa632df75f745509b52f9128f91a6bad4c796e44abb505e1"
|
|
115
|
+
|
|
116
|
+
[[package]]
|
|
117
|
+
name = "napi-derive"
|
|
118
|
+
version = "2.16.13"
|
|
119
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
120
|
+
checksum = "7cbe2585d8ac223f7d34f13701434b9d5f4eb9c332cccce8dee57ea18ab8ab0c"
|
|
121
|
+
dependencies = [
|
|
122
|
+
"cfg-if",
|
|
123
|
+
"convert_case",
|
|
124
|
+
"napi-derive-backend",
|
|
125
|
+
"proc-macro2",
|
|
126
|
+
"quote",
|
|
127
|
+
"syn",
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[[package]]
|
|
131
|
+
name = "napi-derive-backend"
|
|
132
|
+
version = "1.0.75"
|
|
133
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
134
|
+
checksum = "1639aaa9eeb76e91c6ae66da8ce3e89e921cd3885e99ec85f4abacae72fc91bf"
|
|
135
|
+
dependencies = [
|
|
136
|
+
"convert_case",
|
|
137
|
+
"once_cell",
|
|
138
|
+
"proc-macro2",
|
|
139
|
+
"quote",
|
|
140
|
+
"regex",
|
|
141
|
+
"semver",
|
|
142
|
+
"syn",
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
[[package]]
|
|
146
|
+
name = "napi-sys"
|
|
147
|
+
version = "2.4.0"
|
|
148
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
149
|
+
checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3"
|
|
150
|
+
dependencies = [
|
|
151
|
+
"libloading",
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
[[package]]
|
|
155
|
+
name = "once_cell"
|
|
156
|
+
version = "1.21.4"
|
|
157
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
159
|
+
|
|
160
|
+
[[package]]
|
|
161
|
+
name = "portable-atomic"
|
|
162
|
+
version = "1.13.1"
|
|
163
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
164
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
165
|
+
|
|
166
|
+
[[package]]
|
|
167
|
+
name = "proc-macro2"
|
|
168
|
+
version = "1.0.106"
|
|
169
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
170
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
171
|
+
dependencies = [
|
|
172
|
+
"unicode-ident",
|
|
173
|
+
]
|
|
174
|
+
|
|
175
|
+
[[package]]
|
|
176
|
+
name = "pyo3"
|
|
177
|
+
version = "0.22.6"
|
|
178
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
179
|
+
checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
|
|
180
|
+
dependencies = [
|
|
181
|
+
"cfg-if",
|
|
182
|
+
"indoc",
|
|
183
|
+
"libc",
|
|
184
|
+
"memoffset",
|
|
185
|
+
"once_cell",
|
|
186
|
+
"portable-atomic",
|
|
187
|
+
"pyo3-build-config",
|
|
188
|
+
"pyo3-ffi",
|
|
189
|
+
"pyo3-macros",
|
|
190
|
+
"unindent",
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
[[package]]
|
|
194
|
+
name = "pyo3-build-config"
|
|
195
|
+
version = "0.22.6"
|
|
196
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
197
|
+
checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
|
|
198
|
+
dependencies = [
|
|
199
|
+
"once_cell",
|
|
200
|
+
"target-lexicon",
|
|
201
|
+
]
|
|
202
|
+
|
|
203
|
+
[[package]]
|
|
204
|
+
name = "pyo3-ffi"
|
|
205
|
+
version = "0.22.6"
|
|
206
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
207
|
+
checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
|
|
208
|
+
dependencies = [
|
|
209
|
+
"libc",
|
|
210
|
+
"pyo3-build-config",
|
|
211
|
+
]
|
|
212
|
+
|
|
213
|
+
[[package]]
|
|
214
|
+
name = "pyo3-macros"
|
|
215
|
+
version = "0.22.6"
|
|
216
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
217
|
+
checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
|
|
218
|
+
dependencies = [
|
|
219
|
+
"proc-macro2",
|
|
220
|
+
"pyo3-macros-backend",
|
|
221
|
+
"quote",
|
|
222
|
+
"syn",
|
|
223
|
+
]
|
|
224
|
+
|
|
225
|
+
[[package]]
|
|
226
|
+
name = "pyo3-macros-backend"
|
|
227
|
+
version = "0.22.6"
|
|
228
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
229
|
+
checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
|
|
230
|
+
dependencies = [
|
|
231
|
+
"heck",
|
|
232
|
+
"proc-macro2",
|
|
233
|
+
"pyo3-build-config",
|
|
234
|
+
"quote",
|
|
235
|
+
"syn",
|
|
236
|
+
]
|
|
237
|
+
|
|
238
|
+
[[package]]
|
|
239
|
+
name = "quote"
|
|
240
|
+
version = "1.0.46"
|
|
241
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
242
|
+
checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
|
|
243
|
+
dependencies = [
|
|
244
|
+
"proc-macro2",
|
|
245
|
+
]
|
|
246
|
+
|
|
247
|
+
[[package]]
|
|
248
|
+
name = "regex"
|
|
249
|
+
version = "1.12.4"
|
|
250
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
251
|
+
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
|
252
|
+
dependencies = [
|
|
253
|
+
"aho-corasick",
|
|
254
|
+
"memchr",
|
|
255
|
+
"regex-automata",
|
|
256
|
+
"regex-syntax",
|
|
257
|
+
]
|
|
258
|
+
|
|
259
|
+
[[package]]
|
|
260
|
+
name = "regex-automata"
|
|
261
|
+
version = "0.4.14"
|
|
262
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
263
|
+
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
|
264
|
+
dependencies = [
|
|
265
|
+
"aho-corasick",
|
|
266
|
+
"memchr",
|
|
267
|
+
"regex-syntax",
|
|
268
|
+
]
|
|
269
|
+
|
|
270
|
+
[[package]]
|
|
271
|
+
name = "regex-syntax"
|
|
272
|
+
version = "0.8.11"
|
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
+
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
275
|
+
|
|
276
|
+
[[package]]
|
|
277
|
+
name = "rustversion"
|
|
278
|
+
version = "1.0.22"
|
|
279
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
280
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
281
|
+
|
|
282
|
+
[[package]]
|
|
283
|
+
name = "semver"
|
|
284
|
+
version = "1.0.28"
|
|
285
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
286
|
+
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
|
287
|
+
|
|
288
|
+
[[package]]
|
|
289
|
+
name = "syn"
|
|
290
|
+
version = "2.0.118"
|
|
291
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
292
|
+
checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
|
|
293
|
+
dependencies = [
|
|
294
|
+
"proc-macro2",
|
|
295
|
+
"quote",
|
|
296
|
+
"unicode-ident",
|
|
297
|
+
]
|
|
298
|
+
|
|
299
|
+
[[package]]
|
|
300
|
+
name = "target-lexicon"
|
|
301
|
+
version = "0.12.16"
|
|
302
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
303
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
304
|
+
|
|
305
|
+
[[package]]
|
|
306
|
+
name = "unicode-ident"
|
|
307
|
+
version = "1.0.24"
|
|
308
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
309
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
310
|
+
|
|
311
|
+
[[package]]
|
|
312
|
+
name = "unicode-segmentation"
|
|
313
|
+
version = "1.13.3"
|
|
314
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
315
|
+
checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
|
|
316
|
+
|
|
317
|
+
[[package]]
|
|
318
|
+
name = "unindent"
|
|
319
|
+
version = "0.2.4"
|
|
320
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
321
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
322
|
+
|
|
323
|
+
[[package]]
|
|
324
|
+
name = "windows-link"
|
|
325
|
+
version = "0.2.1"
|
|
326
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
327
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
328
|
+
|
|
329
|
+
[[package]]
|
|
330
|
+
name = "yggdryl"
|
|
331
|
+
version = "0.1.0"
|
|
332
|
+
|
|
333
|
+
[[package]]
|
|
334
|
+
name = "yggdryl-node"
|
|
335
|
+
version = "0.1.0"
|
|
336
|
+
dependencies = [
|
|
337
|
+
"napi",
|
|
338
|
+
"napi-build",
|
|
339
|
+
"napi-derive",
|
|
340
|
+
"yggdryl",
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
[[package]]
|
|
344
|
+
name = "yggdryl-python"
|
|
345
|
+
version = "0.1.0"
|
|
346
|
+
dependencies = [
|
|
347
|
+
"pyo3",
|
|
348
|
+
"yggdryl",
|
|
349
|
+
]
|
yggdryl-0.1.0/Cargo.toml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
resolver = "2"
|
|
3
|
+
members = ["crates/yggdryl", "bindings/python"]
|
|
4
|
+
|
|
5
|
+
[workspace.package]
|
|
6
|
+
version = "0.1.0"
|
|
7
|
+
edition = "2021"
|
|
8
|
+
license = "Apache-2.0"
|
|
9
|
+
authors = ["yggdryl contributors"]
|
|
10
|
+
repository = "https://github.com/Platob/yggdryl"
|
|
11
|
+
homepage = "https://github.com/Platob/yggdryl"
|
|
12
|
+
description = "yggdryl — a Rust-core URI/URL library with Python and Node extensions"
|
|
13
|
+
keywords = ["uri", "url", "parser", "ffi", "yggdryl"]
|
|
14
|
+
|
|
15
|
+
[workspace.dependencies]
|
|
16
|
+
# The Rust core crate. Bindings depend on it under the alias `yggdryl-core`
|
|
17
|
+
# (see each binding's Cargo.toml) so the dependency's extern name doesn't collide
|
|
18
|
+
# with the cdylib they themselves expose as `yggdryl`.
|
|
19
|
+
yggdryl = { path = "crates/yggdryl", version = "0.1.0" }
|
|
20
|
+
|
|
21
|
+
[profile.release]
|
|
22
|
+
lto = true
|
|
23
|
+
codegen-units = 1
|
|
24
|
+
strip = true
|
yggdryl-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yggdryl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
7
|
+
Requires-Dist: pytest>=7.0 ; extra == 'test'
|
|
8
|
+
Provides-Extra: test
|
|
9
|
+
Summary: yggdryl — a Rust-core URI/URL library, exposed to Python
|
|
10
|
+
Keywords: uri,url,parser,rust,yggdryl
|
|
11
|
+
Home-Page: https://github.com/Platob/yggdryl
|
|
12
|
+
Author: yggdryl contributors
|
|
13
|
+
License: Apache-2.0
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
16
|
+
Project-URL: Homepage, https://github.com/Platob/yggdryl
|
|
17
|
+
Project-URL: Repository, https://github.com/Platob/yggdryl
|
|
18
|
+
|
|
19
|
+
# yggdryl (Python)
|
|
20
|
+
|
|
21
|
+
Python bindings for [**yggdryl**](https://github.com/Platob/yggdryl), backed by
|
|
22
|
+
the Rust `yggdryl` core crate.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install maturin
|
|
28
|
+
maturin develop # build & install into the current virtualenv
|
|
29
|
+
# or build a wheel:
|
|
30
|
+
maturin build --release
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import yggdryl
|
|
37
|
+
|
|
38
|
+
uri = yggdryl.Uri("urn:isbn:0451450523")
|
|
39
|
+
print(uri.scheme) # urn
|
|
40
|
+
print(uri.path) # isbn:0451450523
|
|
41
|
+
|
|
42
|
+
url = yggdryl.Url("https://user:pw@example.com:8443/api?v=1#top")
|
|
43
|
+
print(url.host) # example.com
|
|
44
|
+
print(url.port) # 8443
|
|
45
|
+
print(url.username) # user
|
|
46
|
+
print(str(url)) # https://user:pw@example.com:8443/api?v=1#top
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Invalid input raises `ValueError`.
|
|
50
|
+
|
yggdryl-0.1.0/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# yggdryl (Python)
|
|
2
|
+
|
|
3
|
+
Python bindings for [**yggdryl**](https://github.com/Platob/yggdryl), backed by
|
|
4
|
+
the Rust `yggdryl` core crate.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install maturin
|
|
10
|
+
maturin develop # build & install into the current virtualenv
|
|
11
|
+
# or build a wheel:
|
|
12
|
+
maturin build --release
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import yggdryl
|
|
19
|
+
|
|
20
|
+
uri = yggdryl.Uri("urn:isbn:0451450523")
|
|
21
|
+
print(uri.scheme) # urn
|
|
22
|
+
print(uri.path) # isbn:0451450523
|
|
23
|
+
|
|
24
|
+
url = yggdryl.Url("https://user:pw@example.com:8443/api?v=1#top")
|
|
25
|
+
print(url.host) # example.com
|
|
26
|
+
print(url.port) # 8443
|
|
27
|
+
print(url.username) # user
|
|
28
|
+
print(str(url)) # https://user:pw@example.com:8443/api?v=1#top
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Invalid input raises `ValueError`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "yggdryl-python"
|
|
3
|
+
version.workspace = true
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
license.workspace = true
|
|
6
|
+
authors.workspace = true
|
|
7
|
+
repository.workspace = true
|
|
8
|
+
homepage.workspace = true
|
|
9
|
+
description = "Python extension for yggdryl, backed by the Rust core"
|
|
10
|
+
publish = false
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
|
|
13
|
+
[lib]
|
|
14
|
+
# The compiled artifact is imported from Python as `yggdryl`.
|
|
15
|
+
name = "yggdryl"
|
|
16
|
+
crate-type = ["cdylib"]
|
|
17
|
+
path = "src/lib.rs"
|
|
18
|
+
|
|
19
|
+
[dependencies]
|
|
20
|
+
# The core crate is named `yggdryl`; alias it to `yggdryl-core` here so its
|
|
21
|
+
# extern name (`yggdryl_core`) doesn't clash with this cdylib, also named
|
|
22
|
+
# `yggdryl`.
|
|
23
|
+
yggdryl-core = { package = "yggdryl", path = "../../crates/yggdryl", version = "0.1.0" }
|
|
24
|
+
|
|
25
|
+
[dependencies.pyo3]
|
|
26
|
+
version = "0.22"
|
|
27
|
+
features = ["extension-module"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# yggdryl (Python)
|
|
2
|
+
|
|
3
|
+
Python bindings for [**yggdryl**](https://github.com/Platob/yggdryl), backed by
|
|
4
|
+
the Rust `yggdryl` core crate.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install maturin
|
|
10
|
+
maturin develop # build & install into the current virtualenv
|
|
11
|
+
# or build a wheel:
|
|
12
|
+
maturin build --release
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
import yggdryl
|
|
19
|
+
|
|
20
|
+
uri = yggdryl.Uri("urn:isbn:0451450523")
|
|
21
|
+
print(uri.scheme) # urn
|
|
22
|
+
print(uri.path) # isbn:0451450523
|
|
23
|
+
|
|
24
|
+
url = yggdryl.Url("https://user:pw@example.com:8443/api?v=1#top")
|
|
25
|
+
print(url.host) # example.com
|
|
26
|
+
print(url.port) # 8443
|
|
27
|
+
print(url.username) # user
|
|
28
|
+
print(str(url)) # https://user:pw@example.com:8443/api?v=1#top
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Invalid input raises `ValueError`.
|