doc-redaction 2.2.7__tar.gz → 2.2.8__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 (111) hide show
  1. {doc_redaction-2.2.7/doc_redaction.egg-info → doc_redaction-2.2.8}/PKG-INFO +2 -3
  2. {doc_redaction-2.2.7 → doc_redaction-2.2.8/doc_redaction.egg-info}/PKG-INFO +2 -3
  3. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction.egg-info/requires.txt +1 -1
  4. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/pyproject.toml +2 -2
  5. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_gradio_upload_staging.py +36 -0
  6. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/simplified_api.py +2 -2
  7. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/MANIFEST.in +0 -0
  8. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/README.md +0 -0
  9. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/README_PYPI.md +0 -0
  10. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/agent_routes.py +0 -0
  11. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/app.py +0 -0
  12. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/cli_redact.py +0 -0
  13. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/__init__.py +0 -0
  14. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/api.py +0 -0
  15. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/assets/favicon.png +0 -0
  16. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/cli_api.py +0 -0
  17. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/cli_redact.py +0 -0
  18. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/data_anonymise.py +0 -0
  19. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/Bold minimalist professional cover letter.docx +0 -0
  20. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/Difficult handwritten note.jpg +0 -0
  21. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/Example-cv-university-graduaty-hr-role-with-photo-2.pdf +0 -0
  22. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/Lambeth_2030-Our_Future_Our_Lambeth.pdf.csv +0 -0
  23. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/Partnership-Agreement-Toolkit_0_0.pdf +0 -0
  24. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/Partnership-Agreement-Toolkit_test_deny_list_para_single_spell.csv +0 -0
  25. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/combined_case_notes.csv +0 -0
  26. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/combined_case_notes.xlsx +0 -0
  27. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/doubled_output_joined.pdf +0 -0
  28. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_complaint_letter.jpg +0 -0
  29. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_of_emails_sent_to_a_professor_before_applying.pdf +0 -0
  30. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_outputs/Partnership-Agreement-Toolkit_0_0.pdf_ocr_output.csv +0 -0
  31. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_outputs/Partnership-Agreement-Toolkit_0_0.pdf_review_file.csv +0 -0
  32. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_outputs/Partnership-Agreement-Toolkit_0_0_ocr_results_with_words_textract.csv +0 -0
  33. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_outputs/doubled_output_joined.pdf_ocr_output.csv +0 -0
  34. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_outputs/example_of_emails_sent_to_a_professor_before_applying_ocr_output_textract.csv +0 -0
  35. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_outputs/example_of_emails_sent_to_a_professor_before_applying_ocr_results_with_words_textract.csv +0 -0
  36. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/example_outputs/example_of_emails_sent_to_a_professor_before_applying_review_file.csv +0 -0
  37. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/graduate-job-example-cover-letter.pdf +0 -0
  38. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/partnership_toolkit_redact_custom_deny_list.csv +0 -0
  39. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/partnership_toolkit_redact_some_pages.csv +0 -0
  40. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/test_allow_list_graduate.csv +0 -0
  41. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/example_data/test_allow_list_partnership.csv +0 -0
  42. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/file_conversion.py +0 -0
  43. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/file_redaction.py +0 -0
  44. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/find_duplicate_pages.py +0 -0
  45. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/find_duplicate_tabular.py +0 -0
  46. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/gradio_app.py +0 -0
  47. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/helper_functions.py +0 -0
  48. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/install_deps.py +0 -0
  49. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/lambda_entrypoint.py +0 -0
  50. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/redaction_review.py +0 -0
  51. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction/summaries.py +0 -0
  52. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction.egg-info/SOURCES.txt +0 -0
  53. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction.egg-info/dependency_links.txt +0 -0
  54. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction.egg-info/entry_points.txt +0 -0
  55. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/doc_redaction.egg-info/top_level.txt +0 -0
  56. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/intros/long_intro.txt +0 -0
  57. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/intros/short_intro.txt +0 -0
  58. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/intros/short_intro_responsible.txt +0 -0
  59. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/lambda_entrypoint.py +0 -0
  60. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/load_dynamo_logs.py +0 -0
  61. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/load_s3_logs.py +0 -0
  62. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/mcp_doc_redaction/__init__.py +0 -0
  63. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/mcp_doc_redaction/artifact_bundle.py +0 -0
  64. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/mcp_doc_redaction/gradio_transport.py +0 -0
  65. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/mcp_doc_redaction/schemas.py +0 -0
  66. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/mcp_doc_redaction/server.py +0 -0
  67. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/setup.cfg +0 -0
  68. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_agent_apply_review_redactions.py +0 -0
  69. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_annotation_color_parsing.py +0 -0
  70. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_cli_smoke.py +0 -0
  71. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_gradio_doc_redact_simple.py +0 -0
  72. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_gradio_summarise_simple.py +0 -0
  73. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_gradio_transport_sse.py +0 -0
  74. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_gui_only.py +0 -0
  75. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_mcp_doc_redaction_bundle.py +0 -0
  76. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_mcp_doc_redaction_extract_paths.py +0 -0
  77. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_package_api_smoke.py +0 -0
  78. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_placeholder_bbox_scaling.py +0 -0
  79. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_redaction_overlay_export.py +0 -0
  80. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_redaction_types.py +0 -0
  81. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/test/test_review_ocr_visualisation_export.py +0 -0
  82. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/__init__.py +0 -0
  83. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/apply_hf_zero_gpu_readme_frontmatter.py +0 -0
  84. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/auth.py +0 -0
  85. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/aws_functions.py +0 -0
  86. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/aws_textract.py +0 -0
  87. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/cli_usage_logger.py +0 -0
  88. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/config.py +0 -0
  89. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/custom_csvlogger.py +0 -0
  90. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/custom_image_analyser_engine.py +0 -0
  91. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/data_anonymise.py +0 -0
  92. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/file_conversion.py +0 -0
  93. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/file_redaction.py +0 -0
  94. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/find_duplicate_pages.py +0 -0
  95. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/find_duplicate_tabular.py +0 -0
  96. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/helper_functions.py +0 -0
  97. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/llm_entity_detection.py +0 -0
  98. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/llm_entity_detection_prompts.py +0 -0
  99. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/llm_funcs.py +0 -0
  100. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/load_spacy_model_custom_recognisers.py +0 -0
  101. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/presidio_analyzer_custom.py +0 -0
  102. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/preview_redaction_boxes.py +0 -0
  103. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/quickstart.py +0 -0
  104. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/redaction_review.py +0 -0
  105. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/redaction_types.py +0 -0
  106. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/run_vlm.py +0 -0
  107. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/secure_path_utils.py +0 -0
  108. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/secure_regex_utils.py +0 -0
  109. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/summaries.py +0 -0
  110. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/textract_batch_call.py +0 -0
  111. {doc_redaction-2.2.7 → doc_redaction-2.2.8}/tools/word_segmenter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doc_redaction
3
- Version: 2.2.7
3
+ Version: 2.2.8
4
4
  Summary: Redact PDF/image-based documents, Word, or CSV/XLSX files using a Gradio-based GUI interface
5
5
  Author-email: Sean Pedrick-Case <spedrickcase@lambeth.gov.uk>
6
6
  Maintainer-email: Sean Pedrick-Case <spedrickcase@lambeth.gov.uk>
@@ -8,7 +8,6 @@ License-Expression: AGPL-3.0-only
8
8
  Project-URL: Homepage, https://seanpedrick-case.github.io/doc_redaction/
9
9
  Project-URL: Repository, https://github.com/seanpedrick-case/doc_redaction
10
10
  Keywords: redaction,pdf,nlp,documents,document-processing,gradio,pii,pii-detection
11
- Platform: UNKNOWN
12
11
  Classifier: Development Status :: 5 - Production/Stable
13
12
  Classifier: Intended Audience :: Developers
14
13
  Classifier: Intended Audience :: Legal Industry
@@ -48,7 +47,7 @@ Requires-Dist: python-docx<=1.2.0
48
47
  Requires-Dist: polars<=1.38.1
49
48
  Requires-Dist: defusedxml<=0.7.1
50
49
  Requires-Dist: numpy<=2.4.4
51
- Requires-Dist: spaces<=0.48.3
50
+ Requires-Dist: spaces<=0.49.0
52
51
  Requires-Dist: google-genai<=1.73.0
53
52
  Requires-Dist: openai<=2.31.0
54
53
  Requires-Dist: markdown<=3.10.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doc_redaction
3
- Version: 2.2.7
3
+ Version: 2.2.8
4
4
  Summary: Redact PDF/image-based documents, Word, or CSV/XLSX files using a Gradio-based GUI interface
5
5
  Author-email: Sean Pedrick-Case <spedrickcase@lambeth.gov.uk>
6
6
  Maintainer-email: Sean Pedrick-Case <spedrickcase@lambeth.gov.uk>
@@ -8,7 +8,6 @@ License-Expression: AGPL-3.0-only
8
8
  Project-URL: Homepage, https://seanpedrick-case.github.io/doc_redaction/
9
9
  Project-URL: Repository, https://github.com/seanpedrick-case/doc_redaction
10
10
  Keywords: redaction,pdf,nlp,documents,document-processing,gradio,pii,pii-detection
11
- Platform: UNKNOWN
12
11
  Classifier: Development Status :: 5 - Production/Stable
13
12
  Classifier: Intended Audience :: Developers
14
13
  Classifier: Intended Audience :: Legal Industry
@@ -48,7 +47,7 @@ Requires-Dist: python-docx<=1.2.0
48
47
  Requires-Dist: polars<=1.38.1
49
48
  Requires-Dist: defusedxml<=0.7.1
50
49
  Requires-Dist: numpy<=2.4.4
51
- Requires-Dist: spaces<=0.48.3
50
+ Requires-Dist: spaces<=0.49.0
52
51
  Requires-Dist: google-genai<=1.73.0
53
52
  Requires-Dist: openai<=2.31.0
54
53
  Requires-Dist: markdown<=3.10.2
@@ -25,7 +25,7 @@ python-docx<=1.2.0
25
25
  polars<=1.38.1
26
26
  defusedxml<=0.7.1
27
27
  numpy<=2.4.4
28
- spaces<=0.48.3
28
+ spaces<=0.49.0
29
29
  google-genai<=1.73.0
30
30
  openai<=2.31.0
31
31
  markdown<=3.10.2
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "doc_redaction"
7
- version = "2.2.7"
7
+ version = "2.2.8"
8
8
  description = "Redact PDF/image-based documents, Word, or CSV/XLSX files using a Gradio-based GUI interface"
9
9
  readme = "README_PYPI.md"
10
10
  authors = [
@@ -65,7 +65,7 @@ dependencies = [
65
65
  "polars<=1.38.1",
66
66
  "defusedxml<=0.7.1",
67
67
  "numpy<=2.4.4",
68
- "spaces<=0.48.3",
68
+ "spaces<=0.49.0",
69
69
  "google-genai<=1.73.0",
70
70
  "openai<=2.31.0",
71
71
  "markdown<=3.10.2",
@@ -3,10 +3,12 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from pathlib import Path
6
+ from typing import Any
6
7
  from unittest.mock import patch
7
8
 
8
9
  from tools.simplified_api import (
9
10
  _is_gradio_ephemeral_upload_path,
11
+ preview_boxes_api,
10
12
  stage_gradio_upload_if_ephemeral,
11
13
  )
12
14
 
@@ -42,3 +44,37 @@ def test_stage_gradio_upload_skips_normal_paths(tmp_path: Path) -> None:
42
44
  out = stage_gradio_upload_if_ephemeral(str(p))
43
45
  mock_staging.assert_not_called()
44
46
  assert out == str(p)
47
+
48
+
49
+ def test_preview_boxes_api_staging_uses_single_path_arg(tmp_path: Path) -> None:
50
+ """Regression: preview_boxes must not pass a second arg to stage_gradio_upload_if_ephemeral."""
51
+ pdf = tmp_path / "doc.pdf"
52
+ review = tmp_path / "plan_review_file.csv"
53
+ pdf.write_bytes(b"%PDF-1.4")
54
+ review.write_bytes(b"x")
55
+ fake_png = tmp_path / "p1.png"
56
+ fake_png.write_bytes(b"png")
57
+ out_root = tmp_path / "outputs"
58
+ out_root.mkdir()
59
+
60
+ staging_calls: list[tuple[Any, ...]] = []
61
+
62
+ def recording_stage(src: str) -> str:
63
+ staging_calls.append((src,))
64
+ return src
65
+
66
+ with patch("tools.simplified_api.OUTPUT_FOLDER", str(out_root)):
67
+ with patch(
68
+ "tools.preview_redaction_boxes.preview_redaction_boxes",
69
+ return_value=[str(fake_png)],
70
+ ):
71
+ with patch(
72
+ "tools.simplified_api.stage_gradio_upload_if_ephemeral",
73
+ side_effect=recording_stage,
74
+ ):
75
+ zip_path, msg = preview_boxes_api(str(pdf), str(review))
76
+
77
+ assert len(staging_calls) == 2
78
+ assert all(len(c) == 1 for c in staging_calls)
79
+ assert zip_path.endswith("preview_boxes.zip")
80
+ assert "Preview complete" in msg
@@ -1130,8 +1130,8 @@ def preview_boxes_api(
1130
1130
  if not pdf_path or not csv_path:
1131
1131
  return "", "Error: both pdf_file and review_csv_file are required."
1132
1132
 
1133
- pdf_path = stage_gradio_upload_if_ephemeral(pdf_path, INPUT_FOLDER)
1134
- csv_path = stage_gradio_upload_if_ephemeral(csv_path, INPUT_FOLDER)
1133
+ pdf_path = stage_gradio_upload_if_ephemeral(pdf_path)
1134
+ csv_path = stage_gradio_upload_if_ephemeral(csv_path)
1135
1135
 
1136
1136
  page_list: list[int] | None = None
1137
1137
  if pages:
File without changes
File without changes
File without changes
File without changes