electblake commited on
Commit
fed3258
·
1 Parent(s): 9f51ad0

Add Ruff development configuration

Browse files
.agents/references/gradio/2026-07-20/README.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # gradio
2
+
3
+ - Topic: `gradio`
4
+ - Capture Date: `2026-07-20`
5
+ - Scope: TODO
.agents/references/gradio/2026-07-20/REFERENCE_INDEX.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Reference Index
2
+
3
+ - `README.md`: bundle scope
4
+ - `SOURCE_URLS.md`: verified sources
5
+ - `REFERENCE_SUMMARY.md`: findings and version notes
6
+ - `fixtures/`: user-provided artifacts
7
+ - `<domain>/`: mirrored markdown references by domain
.agents/references/gradio/2026-07-20/REFERENCE_SUMMARY.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Reference Summary
2
+
3
+ - Reference Date: `2026-07-20`
4
+ - Official Version: TODO
5
+ - Key Findings:
6
+ - TODO
7
+ - Compatibility Notes:
8
+ - TODO
.agents/references/gradio/2026-07-20/SOURCE_URLS.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Source URLs
2
+
3
+ - TODO: add every official URL used in this bundle
.vscode/extensions.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "recommendations": [
3
+ "charliermarsh.ruff"
4
+ ]
5
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "[python]": {
3
+ "editor.codeActionsOnSave": {
4
+ "source.fixAll.ruff": "explicit",
5
+ "source.organizeImports.ruff": "explicit"
6
+ },
7
+ "editor.defaultFormatter": "charliermarsh.ruff",
8
+ "editor.formatOnSave": true
9
+ },
10
+ "python.analysis.typeCheckingMode": "basic",
11
+ "ruff.configuration": "${workspaceFolder}/pyproject.toml",
12
+ "ruff.nativeServer": "on"
13
+ }
app/nuextract.py CHANGED
@@ -30,13 +30,13 @@ def run_nuextract(messages, **chat_template_kwargs):
30
  ).to(model.device)
31
 
32
  with torch.inference_mode():
33
- generated_ids = model.generate(
34
  **inputs,
35
  max_new_tokens=4096,
36
  do_sample=False,
37
  )
38
 
39
- generated_ids = generated_ids[:, inputs.input_ids.shape[1]:]
40
  return processor.batch_decode(
41
  generated_ids,
42
  skip_special_tokens=True,
@@ -45,10 +45,7 @@ def run_nuextract(messages, **chat_template_kwargs):
45
 
46
 
47
  sample_path = (
48
- Path(__file__).parents[1]
49
- / "data"
50
- / "samples"
51
- / "Screenshot 2026-07-18 171416.png"
52
  )
53
  sample_image = Image.open(sample_path).convert("RGB")
54
  messages = [
 
30
  ).to(model.device)
31
 
32
  with torch.inference_mode():
33
+ generated_ids = model.generate( # pyright: ignore[reportAttributeAccessIssue]
34
  **inputs,
35
  max_new_tokens=4096,
36
  do_sample=False,
37
  )
38
 
39
+ generated_ids = generated_ids[:, inputs.input_ids.shape[1] :]
40
  return processor.batch_decode(
41
  generated_ids,
42
  skip_special_tokens=True,
 
45
 
46
 
47
  sample_path = (
48
+ Path(__file__).parents[1] / "data" / "samples" / "Screenshot 2026-07-18 171416.png"
 
 
 
49
  )
50
  sample_image = Image.open(sample_path).convert("RGB")
51
  messages = [
pyproject.toml CHANGED
@@ -18,6 +18,18 @@ dependencies = [
18
  "transformers",
19
  ]
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  [tool.uv.sources]
22
  torch = { index = "pytorch-cu130" }
23
  flash-attn = { url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.9.28/flash_attn-2.8.3+cu130torch2.9-cp312-cp312-win_amd64.whl" }
 
18
  "transformers",
19
  ]
20
 
21
+ [dependency-groups]
22
+ dev = [
23
+ "ruff>=0.15.22",
24
+ ]
25
+
26
+ [tool.ruff]
27
+ target-version = "py312"
28
+ extend-exclude = ["notebooks"]
29
+
30
+ [tool.ruff.lint]
31
+ select = ["B", "E4", "E7", "E9", "F", "I", "SIM", "UP"]
32
+
33
  [tool.uv.sources]
34
  torch = { index = "pytorch-cu130" }
35
  flash-attn = { url = "https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.9.28/flash_attn-2.8.3+cu130torch2.9-cp312-cp312-win_amd64.whl" }
uv.lock CHANGED
@@ -710,6 +710,11 @@ dependencies = [
710
  { name = "transformers" },
711
  ]
712
 
 
 
 
 
 
713
  [package.metadata]
714
  requires-dist = [
715
  { name = "accelerate", specifier = ">=1.14.0" },
@@ -725,6 +730,9 @@ requires-dist = [
725
  { name = "transformers" },
726
  ]
727
 
 
 
 
728
  [[package]]
729
  name = "numpy"
730
  version = "2.4.4"
@@ -1251,6 +1259,31 @@ wheels = [
1251
  { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" },
1252
  ]
1253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1254
  [[package]]
1255
  name = "safehttpx"
1256
  version = "0.1.7"
 
710
  { name = "transformers" },
711
  ]
712
 
713
+ [package.dev-dependencies]
714
+ dev = [
715
+ { name = "ruff" },
716
+ ]
717
+
718
  [package.metadata]
719
  requires-dist = [
720
  { name = "accelerate", specifier = ">=1.14.0" },
 
730
  { name = "transformers" },
731
  ]
732
 
733
+ [package.metadata.requires-dev]
734
+ dev = [{ name = "ruff", specifier = ">=0.15.22" }]
735
+
736
  [[package]]
737
  name = "numpy"
738
  version = "2.4.4"
 
1259
  { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" },
1260
  ]
1261
 
1262
+ [[package]]
1263
+ name = "ruff"
1264
+ version = "0.15.22"
1265
+ source = { registry = "https://pypi.org/simple" }
1266
+ sdist = { url = "https://files.pythonhosted.org/packages/3a/06/ae069393fc66e8ff33036d4b368003833bf6e88ccf182e17e7a2f1c754fd/ruff-0.15.22.tar.gz", hash = "sha256:3f15175b1fb580126f58285a5dae6b2ea89000136d980c64499211f116b54809", size = 4785063, upload-time = "2026-07-16T15:14:13.244Z" }
1267
+ wheels = [
1268
+ { url = "https://files.pythonhosted.org/packages/23/18/ee54b7ae1e121be7a28ea6da4b67564ebb0530e183a54415ab7e3bcd2c4e/ruff-0.15.22-py3-none-linux_armv6l.whl", hash = "sha256:44423e73493737f5e7c5b41d475483898ff37afcdae38bc3da5085e29af1c2d8", size = 10781258, upload-time = "2026-07-16T15:13:19.452Z" },
1269
+ { url = "https://files.pythonhosted.org/packages/2f/d2/2520cb14761ddbeaf57642a76942fc36adcbdbe53b4532241995f6fc485c/ruff-0.15.22-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b82c6482946e9eda7ff2e091d25b8bad3f718684e1916d41bd56873cee05b697", size = 10999477, upload-time = "2026-07-16T15:13:23.318Z" },
1270
+ { url = "https://files.pythonhosted.org/packages/c9/10/74e53572aa758dfaa678c2a2646b5c5515d884b7ca56be4d2ce03ca4b560/ruff-0.15.22-py3-none-macosx_11_0_arm64.whl", hash = "sha256:11c1c715af53a09f714e011106bffc419751ec8232fcb5da42173284ea3fec6f", size = 10466716, upload-time = "2026-07-16T15:13:26.162Z" },
1271
+ { url = "https://files.pythonhosted.org/packages/1e/cc/44eaaf0844e028182f2d0a8f2190d0f359159aed0a9e5ab861d892f1ae2a/ruff-0.15.22-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:742a29cf29bddb7c8327895d6a10e0e6c5b38a96dd407af9b5d0857f809c0576", size = 10892644, upload-time = "2026-07-16T15:13:29.229Z" },
1272
+ { url = "https://files.pythonhosted.org/packages/9f/21/8edf559014d2b0f82beea19cfb713993ad802ccda16868769979c6090a84/ruff-0.15.22-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72af58b951b0ae395935ae79763dc349bc0eb706319d28f7a33ad2cfb3cfc178", size = 10576719, upload-time = "2026-07-16T15:13:32.35Z" },
1273
+ { url = "https://files.pythonhosted.org/packages/bf/1e/3a13abd392a3b50b62e5938a831f9ab6e588358cacad5c18545b716d2182/ruff-0.15.22-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62d425005c1835eb24e2ee4161cb90e8db263415f4a71c8c72c33abaa6c0c224", size = 11376494, upload-time = "2026-07-16T15:13:35.958Z" },
1274
+ { url = "https://files.pythonhosted.org/packages/bf/3e/422d3d95bcf04dd78e1aeac22184d4f9a8fb2c01865d39d44618484a0317/ruff-0.15.22-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e8b9b3f8779a4f08c969defc3c8c35abffaa757e601ed5ae66d6d1db6519969a", size = 12208370, upload-time = "2026-07-16T15:13:39.185Z" },
1275
+ { url = "https://files.pythonhosted.org/packages/1e/91/5d065a0e0a02bf4813f5119ad278462eed081d2b832eb7c021ade0ec9e65/ruff-0.15.22-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1e0dd1b2e4d3d585f897a0d137cbf4eaf6223bef4e8ce34d6bb12556c5f9249e", size = 11581098, upload-time = "2026-07-16T15:13:42.132Z" },
1276
+ { url = "https://files.pythonhosted.org/packages/f6/f9/a0d4871d12fae702eb1f41b686caf05f1f8b124dc6db6f784f53d74918fa/ruff-0.15.22-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:365523eb91d9224e1bcb03b022fbf0facb8f9e23792a2c53d9d4b3924bdbdebb", size = 11399422, upload-time = "2026-07-16T15:13:45.2Z" },
1277
+ { url = "https://files.pythonhosted.org/packages/18/80/c843a5176cddbceb0b7e8dd41cf9993490796c1c469348d384f5a5c13c56/ruff-0.15.22-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:fabfd168afdf29fee5be98b831efa9683c94d7c5a3b58b9ce5a2e38444589a74", size = 11381683, upload-time = "2026-07-16T15:13:48.46Z" },
1278
+ { url = "https://files.pythonhosted.org/packages/d4/00/8485de0ae92239438a36cfc51350db9b9e85c9ebdfaea91b18e422706662/ruff-0.15.22-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:225dbf095a87f1d9f90f5fd7924d2613ee452a75a4308c63a8f50f761787aa7c", size = 10850295, upload-time = "2026-07-16T15:13:51.655Z" },
1279
+ { url = "https://files.pythonhosted.org/packages/fa/91/24977ec2ec72eaf15e4394ace2959fdff2dd1e14f03e005e838023407169/ruff-0.15.22-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1877d63b9d24ed278744f1523fd11b85540566d54641f97c566d7d9dc5ca5296", size = 10579640, upload-time = "2026-07-16T15:13:54.79Z" },
1280
+ { url = "https://files.pythonhosted.org/packages/9c/47/9b51216951974df1f263ac19da550d34252e0ed7218c25f10c5ef9ed7517/ruff-0.15.22-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a1606c510bd7215680d32efab38965f7cdec3ef69f5170a3f4791404ffdd5262", size = 11105077, upload-time = "2026-07-16T15:13:57.915Z" },
1281
+ { url = "https://files.pythonhosted.org/packages/c2/47/20e9d4a3b8016778acea5fc32bb50d35d207500a17ddb529ffa6996feef8/ruff-0.15.22-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:630479b18625f5ffc373f77603a22a9f8ac0acd7ff0501178b5db28ec71e9c64", size = 11490980, upload-time = "2026-07-16T15:14:01.032Z" },
1282
+ { url = "https://files.pythonhosted.org/packages/4d/76/3f72d8fc38c1cb77b38c56a70da9d0c17700cc1cc50f9649c9d3c8f5ba71/ruff-0.15.22-py3-none-win32.whl", hash = "sha256:e5ba0e4a13fd14abbed2a77b517a3911290c6c6c59ef67784328d1668fab76cf", size = 10789165, upload-time = "2026-07-16T15:14:04.16Z" },
1283
+ { url = "https://files.pythonhosted.org/packages/cb/46/4965251734c2b6fcdca1b1b187d20bcac3af0ee5b083b89c910bb961ce3a/ruff-0.15.22-py3-none-win_amd64.whl", hash = "sha256:9be63ba1eb936acd2d1342fb8337c356353706fce233b2a15a09a97037e6acde", size = 11938297, upload-time = "2026-07-16T15:14:07.316Z" },
1284
+ { url = "https://files.pythonhosted.org/packages/57/c9/e69b1ff4c8b69093ef08b8919ab767af0569666865b39c30a8795d88d3c6/ruff-0.15.22-py3-none-win_arm64.whl", hash = "sha256:e1168075b72158510839f250027659cdd78476f40507dd517892304c41318661", size = 11298172, upload-time = "2026-07-16T15:14:10.51Z" },
1285
+ ]
1286
+
1287
  [[package]]
1288
  name = "safehttpx"
1289
  version = "0.1.7"