nginx-lint-plugin 0.20.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.
Files changed (27) hide show
  1. nginx_lint_plugin-0.20.0/.gitignore +11 -0
  2. nginx_lint_plugin-0.20.0/Cargo.lock +439 -0
  3. nginx_lint_plugin-0.20.0/Cargo.toml +37 -0
  4. nginx_lint_plugin-0.20.0/LICENSE +21 -0
  5. nginx_lint_plugin-0.20.0/Makefile +42 -0
  6. nginx_lint_plugin-0.20.0/PKG-INFO +164 -0
  7. nginx_lint_plugin-0.20.0/README.md +141 -0
  8. nginx_lint_plugin-0.20.0/pyproject.toml +72 -0
  9. nginx_lint_plugin-0.20.0/python/componentize_py_types.py +32 -0
  10. nginx_lint_plugin-0.20.0/python/nginx_lint_plugin/__init__.py +100 -0
  11. nginx_lint_plugin-0.20.0/python/nginx_lint_plugin/builders.py +133 -0
  12. nginx_lint_plugin-0.20.0/python/nginx_lint_plugin/config_builder.py +368 -0
  13. nginx_lint_plugin-0.20.0/python/nginx_lint_plugin/include_context.py +41 -0
  14. nginx_lint_plugin-0.20.0/python/nginx_lint_plugin/py.typed +0 -0
  15. nginx_lint_plugin-0.20.0/python/nginx_lint_plugin/testing.py +304 -0
  16. nginx_lint_plugin-0.20.0/python/nginx_lint_plugin/wit/nginx-lint-plugin.wit +333 -0
  17. nginx_lint_plugin-0.20.0/python/wit_world/__init__.py +30 -0
  18. nginx_lint_plugin-0.20.0/python/wit_world/imports/__init__.py +0 -0
  19. nginx_lint_plugin-0.20.0/python/wit_world/imports/config_api.py +286 -0
  20. nginx_lint_plugin-0.20.0/python/wit_world/imports/data_types.py +89 -0
  21. nginx_lint_plugin-0.20.0/python/wit_world/imports/parser_types.py +71 -0
  22. nginx_lint_plugin-0.20.0/python/wit_world/imports/types.py +51 -0
  23. nginx_lint_plugin-0.20.0/python/wit_world/py.typed +0 -0
  24. nginx_lint_plugin-0.20.0/src/lib.rs +309 -0
  25. nginx_lint_plugin-0.20.0/tests/test_apply_fixes.py +203 -0
  26. nginx_lint_plugin-0.20.0/tests/test_builders.py +86 -0
  27. nginx_lint_plugin-0.20.0/tests/test_config_builder.py +134 -0
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ /target
3
+ /dist
4
+ # maturin develop drops the compiled module into the source tree
5
+ *.so
6
+ *.pyd
7
+ # generated by `make bindings` (see the TS SDK for the same convention)
8
+ python/wit_world/
9
+ python/componentize_py_types.py
10
+ /.bindings-tmp
11
+ python/nginx_lint_plugin/wit/
@@ -0,0 +1,439 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "countme"
13
+ version = "3.0.1"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636"
16
+
17
+ [[package]]
18
+ name = "dyn-clone"
19
+ version = "1.0.20"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
22
+
23
+ [[package]]
24
+ name = "equivalent"
25
+ version = "1.0.2"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
28
+
29
+ [[package]]
30
+ name = "hashbrown"
31
+ version = "0.14.5"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
34
+
35
+ [[package]]
36
+ name = "hashbrown"
37
+ version = "0.17.1"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
40
+
41
+ [[package]]
42
+ name = "heck"
43
+ version = "0.5.0"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
46
+
47
+ [[package]]
48
+ name = "indexmap"
49
+ version = "2.14.1"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "07aa2048142242915a31d35844fb311e0e53fcca590c3a0a40dcf1b841fa09eb"
52
+ dependencies = [
53
+ "equivalent",
54
+ "hashbrown 0.17.1",
55
+ ]
56
+
57
+ [[package]]
58
+ name = "itoa"
59
+ version = "1.0.18"
60
+ source = "registry+https://github.com/rust-lang/crates.io-index"
61
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
62
+
63
+ [[package]]
64
+ name = "libc"
65
+ version = "0.2.189"
66
+ source = "registry+https://github.com/rust-lang/crates.io-index"
67
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
68
+
69
+ [[package]]
70
+ name = "memchr"
71
+ version = "2.8.3"
72
+ source = "registry+https://github.com/rust-lang/crates.io-index"
73
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
74
+
75
+ [[package]]
76
+ name = "memoffset"
77
+ version = "0.9.1"
78
+ source = "registry+https://github.com/rust-lang/crates.io-index"
79
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
80
+ dependencies = [
81
+ "autocfg",
82
+ ]
83
+
84
+ [[package]]
85
+ name = "nginx-lint-common"
86
+ version = "0.20.0"
87
+ dependencies = [
88
+ "nginx-lint-parser",
89
+ "schemars",
90
+ "serde",
91
+ "serde_json",
92
+ "thiserror",
93
+ "toml",
94
+ ]
95
+
96
+ [[package]]
97
+ name = "nginx-lint-parser"
98
+ version = "0.20.0"
99
+ dependencies = [
100
+ "rowan",
101
+ "serde",
102
+ "thiserror",
103
+ ]
104
+
105
+ [[package]]
106
+ name = "nginx-lint-plugin-py"
107
+ version = "0.20.0"
108
+ dependencies = [
109
+ "nginx-lint-common",
110
+ "nginx-lint-parser",
111
+ "pyo3",
112
+ "serde",
113
+ "serde_json",
114
+ ]
115
+
116
+ [[package]]
117
+ name = "once_cell"
118
+ version = "1.21.4"
119
+ source = "registry+https://github.com/rust-lang/crates.io-index"
120
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
121
+
122
+ [[package]]
123
+ name = "portable-atomic"
124
+ version = "1.15.0"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
127
+
128
+ [[package]]
129
+ name = "proc-macro2"
130
+ version = "1.0.107"
131
+ source = "registry+https://github.com/rust-lang/crates.io-index"
132
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
133
+ dependencies = [
134
+ "unicode-ident",
135
+ ]
136
+
137
+ [[package]]
138
+ name = "pyo3"
139
+ version = "0.29.2"
140
+ source = "registry+https://github.com/rust-lang/crates.io-index"
141
+ checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
142
+ dependencies = [
143
+ "libc",
144
+ "once_cell",
145
+ "portable-atomic",
146
+ "pyo3-build-config",
147
+ "pyo3-ffi",
148
+ "pyo3-macros",
149
+ ]
150
+
151
+ [[package]]
152
+ name = "pyo3-build-config"
153
+ version = "0.29.2"
154
+ source = "registry+https://github.com/rust-lang/crates.io-index"
155
+ checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
156
+ dependencies = [
157
+ "target-lexicon",
158
+ ]
159
+
160
+ [[package]]
161
+ name = "pyo3-ffi"
162
+ version = "0.29.2"
163
+ source = "registry+https://github.com/rust-lang/crates.io-index"
164
+ checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
165
+ dependencies = [
166
+ "libc",
167
+ "pyo3-build-config",
168
+ ]
169
+
170
+ [[package]]
171
+ name = "pyo3-macros"
172
+ version = "0.29.2"
173
+ source = "registry+https://github.com/rust-lang/crates.io-index"
174
+ checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
175
+ dependencies = [
176
+ "proc-macro2",
177
+ "pyo3-macros-backend",
178
+ "quote",
179
+ "syn 2.0.119",
180
+ ]
181
+
182
+ [[package]]
183
+ name = "pyo3-macros-backend"
184
+ version = "0.29.2"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
187
+ dependencies = [
188
+ "heck",
189
+ "proc-macro2",
190
+ "quote",
191
+ "syn 2.0.119",
192
+ ]
193
+
194
+ [[package]]
195
+ name = "quote"
196
+ version = "1.0.47"
197
+ source = "registry+https://github.com/rust-lang/crates.io-index"
198
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
199
+ dependencies = [
200
+ "proc-macro2",
201
+ ]
202
+
203
+ [[package]]
204
+ name = "ref-cast"
205
+ version = "1.0.27"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3"
208
+ dependencies = [
209
+ "ref-cast-impl",
210
+ ]
211
+
212
+ [[package]]
213
+ name = "ref-cast-impl"
214
+ version = "1.0.27"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a"
217
+ dependencies = [
218
+ "proc-macro2",
219
+ "quote",
220
+ "syn 3.0.4",
221
+ ]
222
+
223
+ [[package]]
224
+ name = "rowan"
225
+ version = "0.17.0"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "14b574c58582fa59fa43a2feb6608b8744184659f08a2e0117e4b8224d95ed61"
228
+ dependencies = [
229
+ "countme",
230
+ "hashbrown 0.14.5",
231
+ "memoffset",
232
+ "rustc-hash",
233
+ "text-size",
234
+ ]
235
+
236
+ [[package]]
237
+ name = "rustc-hash"
238
+ version = "1.1.0"
239
+ source = "registry+https://github.com/rust-lang/crates.io-index"
240
+ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
241
+
242
+ [[package]]
243
+ name = "schemars"
244
+ version = "1.2.2"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+ checksum = "687274d293b6cdc6e73e0fee520bf2049650090d7164f87672d212a3c530cf4a"
247
+ dependencies = [
248
+ "dyn-clone",
249
+ "ref-cast",
250
+ "schemars_derive",
251
+ "serde",
252
+ "serde_json",
253
+ ]
254
+
255
+ [[package]]
256
+ name = "schemars_derive"
257
+ version = "1.2.2"
258
+ source = "registry+https://github.com/rust-lang/crates.io-index"
259
+ checksum = "d98c67716b46af2f0b8cf752abc930f6f9aecfbf671ecfb531db8a31dbe4e2ba"
260
+ dependencies = [
261
+ "proc-macro2",
262
+ "quote",
263
+ "serde_derive_internals",
264
+ "syn 3.0.4",
265
+ ]
266
+
267
+ [[package]]
268
+ name = "serde"
269
+ version = "1.0.229"
270
+ source = "registry+https://github.com/rust-lang/crates.io-index"
271
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
272
+ dependencies = [
273
+ "serde_core",
274
+ "serde_derive",
275
+ ]
276
+
277
+ [[package]]
278
+ name = "serde_core"
279
+ version = "1.0.229"
280
+ source = "registry+https://github.com/rust-lang/crates.io-index"
281
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
282
+ dependencies = [
283
+ "serde_derive",
284
+ ]
285
+
286
+ [[package]]
287
+ name = "serde_derive"
288
+ version = "1.0.229"
289
+ source = "registry+https://github.com/rust-lang/crates.io-index"
290
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
291
+ dependencies = [
292
+ "proc-macro2",
293
+ "quote",
294
+ "syn 3.0.4",
295
+ ]
296
+
297
+ [[package]]
298
+ name = "serde_derive_internals"
299
+ version = "0.30.0"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd"
302
+ dependencies = [
303
+ "proc-macro2",
304
+ "quote",
305
+ "syn 3.0.4",
306
+ ]
307
+
308
+ [[package]]
309
+ name = "serde_json"
310
+ version = "1.0.151"
311
+ source = "registry+https://github.com/rust-lang/crates.io-index"
312
+ checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
313
+ dependencies = [
314
+ "itoa",
315
+ "memchr",
316
+ "serde",
317
+ "serde_core",
318
+ "zmij",
319
+ ]
320
+
321
+ [[package]]
322
+ name = "serde_spanned"
323
+ version = "1.1.1"
324
+ source = "registry+https://github.com/rust-lang/crates.io-index"
325
+ checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
326
+ dependencies = [
327
+ "serde_core",
328
+ ]
329
+
330
+ [[package]]
331
+ name = "syn"
332
+ version = "2.0.119"
333
+ source = "registry+https://github.com/rust-lang/crates.io-index"
334
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
335
+ dependencies = [
336
+ "proc-macro2",
337
+ "quote",
338
+ "unicode-ident",
339
+ ]
340
+
341
+ [[package]]
342
+ name = "syn"
343
+ version = "3.0.4"
344
+ source = "registry+https://github.com/rust-lang/crates.io-index"
345
+ checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
346
+ dependencies = [
347
+ "proc-macro2",
348
+ "quote",
349
+ "unicode-ident",
350
+ ]
351
+
352
+ [[package]]
353
+ name = "target-lexicon"
354
+ version = "0.13.5"
355
+ source = "registry+https://github.com/rust-lang/crates.io-index"
356
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
357
+
358
+ [[package]]
359
+ name = "text-size"
360
+ version = "1.1.1"
361
+ source = "registry+https://github.com/rust-lang/crates.io-index"
362
+ checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233"
363
+
364
+ [[package]]
365
+ name = "thiserror"
366
+ version = "2.0.20"
367
+ source = "registry+https://github.com/rust-lang/crates.io-index"
368
+ checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
369
+ dependencies = [
370
+ "thiserror-impl",
371
+ ]
372
+
373
+ [[package]]
374
+ name = "thiserror-impl"
375
+ version = "2.0.20"
376
+ source = "registry+https://github.com/rust-lang/crates.io-index"
377
+ checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
378
+ dependencies = [
379
+ "proc-macro2",
380
+ "quote",
381
+ "syn 3.0.4",
382
+ ]
383
+
384
+ [[package]]
385
+ name = "toml"
386
+ version = "1.1.4+spec-1.1.0"
387
+ source = "registry+https://github.com/rust-lang/crates.io-index"
388
+ checksum = "3aace63f4bbcdfc2c965b059de67119c89c4017a70d633be6c104910f67056f5"
389
+ dependencies = [
390
+ "indexmap",
391
+ "serde_core",
392
+ "serde_spanned",
393
+ "toml_datetime",
394
+ "toml_parser",
395
+ "toml_writer",
396
+ "winnow",
397
+ ]
398
+
399
+ [[package]]
400
+ name = "toml_datetime"
401
+ version = "1.1.1+spec-1.1.0"
402
+ source = "registry+https://github.com/rust-lang/crates.io-index"
403
+ checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
404
+ dependencies = [
405
+ "serde_core",
406
+ ]
407
+
408
+ [[package]]
409
+ name = "toml_parser"
410
+ version = "1.1.3+spec-1.1.0"
411
+ source = "registry+https://github.com/rust-lang/crates.io-index"
412
+ checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
413
+ dependencies = [
414
+ "winnow",
415
+ ]
416
+
417
+ [[package]]
418
+ name = "toml_writer"
419
+ version = "1.1.2+spec-1.1.0"
420
+ source = "registry+https://github.com/rust-lang/crates.io-index"
421
+ checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
422
+
423
+ [[package]]
424
+ name = "unicode-ident"
425
+ version = "1.0.24"
426
+ source = "registry+https://github.com/rust-lang/crates.io-index"
427
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
428
+
429
+ [[package]]
430
+ name = "winnow"
431
+ version = "1.0.4"
432
+ source = "registry+https://github.com/rust-lang/crates.io-index"
433
+ checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
434
+
435
+ [[package]]
436
+ name = "zmij"
437
+ version = "1.0.23"
438
+ source = "registry+https://github.com/rust-lang/crates.io-index"
439
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
@@ -0,0 +1,37 @@
1
+ [package]
2
+ name = "nginx-lint-plugin-py"
3
+ # Keep in sync with the repository version (like the TS SDK's package.json);
4
+ # maturin uses this as the wheel version (pyproject declares version dynamic)
5
+ version = "0.20.0"
6
+ edition = "2024"
7
+ license = "MIT"
8
+ description = "Python SDK for nginx-lint WASM plugins (native parser module)"
9
+ readme = "README.md"
10
+
11
+ # The compiled module is nginx_lint_plugin._native (see pyproject.toml)
12
+ [lib]
13
+ name = "_native"
14
+ crate-type = ["cdylib"]
15
+
16
+ [dependencies]
17
+ # By version rather than by path, and pinned exactly: these crates are
18
+ # released in lockstep with this one, and a path dependency makes
19
+ # `maturin sdist` vendor them next to the repository's root Cargo.toml,
20
+ # which is unusable on its own and fails every source install. The working
21
+ # tree is still what builds here — see ../.cargo/config.toml.
22
+ nginx-lint-common = "=0.20.0"
23
+ nginx-lint-parser = "=0.20.0"
24
+ # abi3-py311: one wheel per platform covers every Python >= 3.11,
25
+ # instead of one per platform x interpreter version. Keep pyo3 new enough
26
+ # for the newest released CPython — an older one hard-errors on a newer
27
+ # interpreter even with abi3, which breaks `make install` for contributors.
28
+ # Renovate does not update this manifest (see renovate.json), so bumping it
29
+ # is a manual job.
30
+ pyo3 = { version = "0.29", features = ["extension-module", "abi3-py311"] }
31
+ serde = { version = "1", features = ["derive"] }
32
+ serde_json = "1"
33
+
34
+ # Deliberately not part of the main workspace: building requires a local
35
+ # Python interpreter (via maturin), which the main workspace's CI does not
36
+ # assume.
37
+ [workspace]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Keiji Yoshimi
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.
@@ -0,0 +1,42 @@
1
+ WIT_DIR := ../../../wit
2
+ PY_DIR := python
3
+ PKG_DIR := $(PY_DIR)/nginx_lint_plugin
4
+ TMP_DIR := .bindings-tmp
5
+
6
+ .PHONY: bindings copy-wit install develop test clean
7
+
8
+ # Ship the WIT inside the package (like the TS SDK's `files: [..., "wit"]`)
9
+ # so plugin authors who only `pip install nginx-lint-plugin` can still run
10
+ # componentize-py, which requires the interface definition. The copy is
11
+ # generated, not committed; nginx_lint_plugin.wit_dir() resolves it.
12
+ copy-wit:
13
+ mkdir -p $(PKG_DIR)/wit
14
+ cp $(WIT_DIR)/nginx-lint-plugin.wit $(PKG_DIR)/wit/
15
+
16
+ # Generate the componentize-py bindings from the WIT. They are not committed
17
+ # (same convention as the TS SDK, which regenerates on every npm run build),
18
+ # so this must run before installing or testing from a fresh checkout.
19
+ # componentize-py refuses to write into an existing directory, hence the
20
+ # temporary one.
21
+ bindings:
22
+ rm -rf $(TMP_DIR) $(PY_DIR)/wit_world $(PY_DIR)/componentize_py_types.py
23
+ componentize-py -d $(WIT_DIR) -w plugin bindings $(TMP_DIR)
24
+ cp -R $(TMP_DIR)/wit_world $(PY_DIR)/
25
+ cp $(TMP_DIR)/componentize_py_types.py $(PY_DIR)/
26
+ # PEP 561 marker: without it type checkers ignore the generated annotations
27
+ touch $(PY_DIR)/wit_world/py.typed
28
+ rm -rf $(TMP_DIR)
29
+
30
+ install: bindings copy-wit
31
+ python -m pip install .
32
+
33
+ # Editable install for SDK development (rebuilds the native module)
34
+ develop: bindings copy-wit
35
+ maturin develop
36
+
37
+ test:
38
+ pytest
39
+
40
+ clean:
41
+ rm -rf $(TMP_DIR) $(PY_DIR)/wit_world $(PY_DIR)/componentize_py_types.py \
42
+ $(PKG_DIR)/wit target dist __pycache__