docpull 6.8.0__tar.gz → 6.9.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 (262) hide show
  1. {docpull-6.8.0/src/docpull.egg-info → docpull-6.9.0}/PKG-INFO +1 -1
  2. {docpull-6.8.0 → docpull-6.9.0}/pyproject.toml +4 -1
  3. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/__init__.py +1 -1
  4. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/cache/manager.py +36 -4
  5. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/cli.py +53 -2
  6. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/core/fetcher.py +67 -1
  7. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/composite.py +6 -0
  8. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/sitemap.py +41 -3
  9. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/eval_grade.py +4 -2
  10. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/http/client.py +8 -0
  11. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/http/rate_limiter.py +11 -0
  12. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/models/config.py +20 -0
  13. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/models/events.py +2 -0
  14. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pack_tools.py +2 -2
  15. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/manifest.py +27 -0
  16. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/fetch.py +55 -0
  17. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/save.py +5 -0
  18. {docpull-6.8.0 → docpull-6.9.0/src/docpull.egg-info}/PKG-INFO +1 -1
  19. {docpull-6.8.0 → docpull-6.9.0}/src/docpull.egg-info/SOURCES.txt +1 -1
  20. {docpull-6.8.0 → docpull-6.9.0}/tests/test_claim_audit_script.py +0 -22
  21. {docpull-6.8.0 → docpull-6.9.0}/tests/test_reproducible_release_build.py +0 -12
  22. docpull-6.9.0/tests/test_sitemap_lastmod_skip.py +337 -0
  23. docpull-6.8.0/tests/test_ci_policy.py +0 -378
  24. {docpull-6.8.0 → docpull-6.9.0}/LICENSE +0 -0
  25. {docpull-6.8.0 → docpull-6.9.0}/README.md +0 -0
  26. {docpull-6.8.0 → docpull-6.9.0}/setup.cfg +0 -0
  27. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/__main__.py +0 -0
  28. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/_jsonutil.py +0 -0
  29. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/accounting.py +0 -0
  30. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/acquisition_workflows.py +0 -0
  31. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/agent_publish.py +0 -0
  32. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/auth_cli.py +0 -0
  33. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/basis.py +0 -0
  34. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/cache/__init__.py +0 -0
  35. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/cache/frontier.py +0 -0
  36. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/cache/streaming_dedup.py +0 -0
  37. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/change_events.py +0 -0
  38. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/compat_api.py +0 -0
  39. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/compat_jobs.py +0 -0
  40. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_aliases.py +0 -0
  41. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_ci.py +0 -0
  42. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/__init__.py +0 -0
  43. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/_legacy_cli.py +0 -0
  44. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/brand.py +0 -0
  45. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/cli.py +0 -0
  46. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/common.py +0 -0
  47. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/dataset.py +0 -0
  48. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/feed.py +0 -0
  49. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/openapi.py +0 -0
  50. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/package.py +0 -0
  51. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/paper.py +0 -0
  52. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/policy_pack.py +0 -0
  53. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/product.py +0 -0
  54. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/relationship.py +0 -0
  55. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/repo.py +0 -0
  56. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/standards.py +0 -0
  57. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/styleguide.py +0 -0
  58. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/transcript.py +0 -0
  59. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/typed.py +0 -0
  60. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/typed_models.py +0 -0
  61. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/visuals.py +0 -0
  62. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/website.py +0 -0
  63. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/wiki.py +0 -0
  64. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_packs/workflow_cli.py +0 -0
  65. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/context_query.py +0 -0
  66. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/contracts.py +0 -0
  67. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/contracts_cli.py +0 -0
  68. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/__init__.py +0 -0
  69. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/article_cleanup.py +0 -0
  70. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/chunking.py +0 -0
  71. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/ensemble.py +0 -0
  72. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/extractor.py +0 -0
  73. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/filings.py +0 -0
  74. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/markdown.py +0 -0
  75. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/protocols.py +0 -0
  76. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/special_cases.py +0 -0
  77. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/conversion/trafilatura_extractor.py +0 -0
  78. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/core/__init__.py +0 -0
  79. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/__init__.py +0 -0
  80. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/_fetch.py +0 -0
  81. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/crawler.py +0 -0
  82. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/filters.py +0 -0
  83. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/link_extractors/__init__.py +0 -0
  84. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/link_extractors/enhanced.py +0 -0
  85. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/link_extractors/protocols.py +0 -0
  86. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/link_extractors/static.py +0 -0
  87. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery/protocols.py +0 -0
  88. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/discovery_index.py +0 -0
  89. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/doctor.py +0 -0
  90. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/document_parse.py +0 -0
  91. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/document_worker.py +0 -0
  92. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/evidence.py +0 -0
  93. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/export_formats.py +0 -0
  94. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/exports.py +0 -0
  95. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/fixtures/__init__.py +0 -0
  96. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/frozen.py +0 -0
  97. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/graph.py +0 -0
  98. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/http/__init__.py +0 -0
  99. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/http/protocols.py +0 -0
  100. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/integrations/__init__.py +0 -0
  101. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/integrations/_records.py +0 -0
  102. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/integrations/langchain.py +0 -0
  103. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/integrations/llamaindex.py +0 -0
  104. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/judge.py +0 -0
  105. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/local_workflows.py +0 -0
  106. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/mcp/__init__.py +0 -0
  107. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/mcp/server.py +0 -0
  108. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/mcp/sources.py +0 -0
  109. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/mcp/tools.py +0 -0
  110. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/metadata_extractor.py +0 -0
  111. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/models/__init__.py +0 -0
  112. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/models/document.py +0 -0
  113. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/models/profiles.py +0 -0
  114. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/models/run.py +0 -0
  115. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/models/schema.py +0 -0
  116. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/monitor.py +0 -0
  117. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/output_contract.py +0 -0
  118. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pack_reader.py +0 -0
  119. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/__init__.py +0 -0
  120. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/base.py +0 -0
  121. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/__init__.py +0 -0
  122. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/chunk.py +0 -0
  123. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/convert.py +0 -0
  124. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/dedup.py +0 -0
  125. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/metadata.py +0 -0
  126. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/render.py +0 -0
  127. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/save_json.py +0 -0
  128. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/save_ndjson.py +0 -0
  129. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/save_okf.py +0 -0
  130. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/save_sqlite.py +0 -0
  131. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/screen.py +0 -0
  132. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/pipeline/steps/validate.py +0 -0
  133. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/policy.py +0 -0
  134. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/policy_cli.py +0 -0
  135. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/project.py +0 -0
  136. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/provenance.py +0 -0
  137. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/py.typed +0 -0
  138. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/redaction.py +0 -0
  139. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/registry.py +0 -0
  140. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/rendering.py +0 -0
  141. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/research.py +0 -0
  142. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/artifact-manifest.v1.schema.json +0 -0
  143. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/basis.v2.schema.json +0 -0
  144. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/change-event.v1.schema.json +0 -0
  145. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/citation-map.v1.schema.json +0 -0
  146. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/document.v3.schema.json +0 -0
  147. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/intelligence-bundle.v1.schema.json +0 -0
  148. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/pack.v3.schema.json +0 -0
  149. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/provenance.v1.schema.json +0 -0
  150. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/relationship-pack.v1.schema.json +0 -0
  151. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/rights.v1.schema.json +0 -0
  152. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/run-identity.v1.schema.json +0 -0
  153. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/website-snapshot.v1.schema.json +0 -0
  154. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/workflow-request.v1.schema.json +0 -0
  155. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/schemas/workflow-result.v1.schema.json +0 -0
  156. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/security/__init__.py +0 -0
  157. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/security/download_policy.py +0 -0
  158. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/security/injection.py +0 -0
  159. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/security/optout.py +0 -0
  160. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/security/robots.py +0 -0
  161. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/security/url_validator.py +0 -0
  162. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/server.py +0 -0
  163. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/share.py +0 -0
  164. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/skill_export.py +0 -0
  165. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/source_scoring.py +0 -0
  166. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/surface.py +0 -0
  167. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/time_utils.py +0 -0
  168. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/warc.py +0 -0
  169. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/web_search.py +0 -0
  170. {docpull-6.8.0 → docpull-6.9.0}/src/docpull/workflows.py +0 -0
  171. {docpull-6.8.0 → docpull-6.9.0}/src/docpull.egg-info/dependency_links.txt +0 -0
  172. {docpull-6.8.0 → docpull-6.9.0}/src/docpull.egg-info/entry_points.txt +0 -0
  173. {docpull-6.8.0 → docpull-6.9.0}/src/docpull.egg-info/requires.txt +0 -0
  174. {docpull-6.8.0 → docpull-6.9.0}/src/docpull.egg-info/top_level.txt +0 -0
  175. {docpull-6.8.0 → docpull-6.9.0}/tests/test_accounting.py +0 -0
  176. {docpull-6.8.0 → docpull-6.9.0}/tests/test_acquisition_workflows.py +0 -0
  177. {docpull-6.8.0 → docpull-6.9.0}/tests/test_auth_cli.py +0 -0
  178. {docpull-6.8.0 → docpull-6.9.0}/tests/test_basis.py +0 -0
  179. {docpull-6.8.0 → docpull-6.9.0}/tests/test_cache_conditional_get.py +0 -0
  180. {docpull-6.8.0 → docpull-6.9.0}/tests/test_cache_lock_regressions.py +0 -0
  181. {docpull-6.8.0 → docpull-6.9.0}/tests/test_chunking.py +0 -0
  182. {docpull-6.8.0 → docpull-6.9.0}/tests/test_cli.py +0 -0
  183. {docpull-6.8.0 → docpull-6.9.0}/tests/test_compat_api.py +0 -0
  184. {docpull-6.8.0 → docpull-6.9.0}/tests/test_compat_jobs.py +0 -0
  185. {docpull-6.8.0 → docpull-6.9.0}/tests/test_context_ci.py +0 -0
  186. {docpull-6.8.0 → docpull-6.9.0}/tests/test_context_packs.py +0 -0
  187. {docpull-6.8.0 → docpull-6.9.0}/tests/test_context_query.py +0 -0
  188. {docpull-6.8.0 → docpull-6.9.0}/tests/test_conversion.py +0 -0
  189. {docpull-6.8.0 → docpull-6.9.0}/tests/test_convert_step_new.py +0 -0
  190. {docpull-6.8.0 → docpull-6.9.0}/tests/test_crawl_regressions.py +0 -0
  191. {docpull-6.8.0 → docpull-6.9.0}/tests/test_discovery.py +0 -0
  192. {docpull-6.8.0 → docpull-6.9.0}/tests/test_discovery_index.py +0 -0
  193. {docpull-6.8.0 → docpull-6.9.0}/tests/test_doctor.py +0 -0
  194. {docpull-6.8.0 → docpull-6.9.0}/tests/test_document_parse.py +0 -0
  195. {docpull-6.8.0 → docpull-6.9.0}/tests/test_document_record.py +0 -0
  196. {docpull-6.8.0 → docpull-6.9.0}/tests/test_exports.py +0 -0
  197. {docpull-6.8.0 → docpull-6.9.0}/tests/test_extractor_ensemble.py +0 -0
  198. {docpull-6.8.0 → docpull-6.9.0}/tests/test_feed_pack.py +0 -0
  199. {docpull-6.8.0 → docpull-6.9.0}/tests/test_fetch_lifecycle.py +0 -0
  200. {docpull-6.8.0 → docpull-6.9.0}/tests/test_frontier_resume.py +0 -0
  201. {docpull-6.8.0 → docpull-6.9.0}/tests/test_frozen.py +0 -0
  202. {docpull-6.8.0 → docpull-6.9.0}/tests/test_graph.py +0 -0
  203. {docpull-6.8.0 → docpull-6.9.0}/tests/test_http_efficiency.py +0 -0
  204. {docpull-6.8.0 → docpull-6.9.0}/tests/test_import_efficiency.py +0 -0
  205. {docpull-6.8.0 → docpull-6.9.0}/tests/test_injection_screen.py +0 -0
  206. {docpull-6.8.0 → docpull-6.9.0}/tests/test_integration.py +0 -0
  207. {docpull-6.8.0 → docpull-6.9.0}/tests/test_integrations.py +0 -0
  208. {docpull-6.8.0 → docpull-6.9.0}/tests/test_jsonutil.py +0 -0
  209. {docpull-6.8.0 → docpull-6.9.0}/tests/test_judge.py +0 -0
  210. {docpull-6.8.0 → docpull-6.9.0}/tests/test_link_extractors.py +0 -0
  211. {docpull-6.8.0 → docpull-6.9.0}/tests/test_live_web_smoke.py +0 -0
  212. {docpull-6.8.0 → docpull-6.9.0}/tests/test_local_pack_workflows.py +0 -0
  213. {docpull-6.8.0 → docpull-6.9.0}/tests/test_local_workflows.py +0 -0
  214. {docpull-6.8.0 → docpull-6.9.0}/tests/test_mcp_server.py +0 -0
  215. {docpull-6.8.0 → docpull-6.9.0}/tests/test_mcp_tools.py +0 -0
  216. {docpull-6.8.0 → docpull-6.9.0}/tests/test_metadata_extractor.py +0 -0
  217. {docpull-6.8.0 → docpull-6.9.0}/tests/test_model_cache_lock.py +0 -0
  218. {docpull-6.8.0 → docpull-6.9.0}/tests/test_model_crawl_politeness.py +0 -0
  219. {docpull-6.8.0 → docpull-6.9.0}/tests/test_model_fetch_pipeline.py +0 -0
  220. {docpull-6.8.0 → docpull-6.9.0}/tests/test_model_jobs_monitor.py +0 -0
  221. {docpull-6.8.0 → docpull-6.9.0}/tests/test_monitor.py +0 -0
  222. {docpull-6.8.0 → docpull-6.9.0}/tests/test_monitor_fetch_failures.py +0 -0
  223. {docpull-6.8.0 → docpull-6.9.0}/tests/test_naming.py +0 -0
  224. {docpull-6.8.0 → docpull-6.9.0}/tests/test_openapi_pack.py +0 -0
  225. {docpull-6.8.0 → docpull-6.9.0}/tests/test_optional_extras_installed.py +0 -0
  226. {docpull-6.8.0 → docpull-6.9.0}/tests/test_optout.py +0 -0
  227. {docpull-6.8.0 → docpull-6.9.0}/tests/test_output_contract.py +0 -0
  228. {docpull-6.8.0 → docpull-6.9.0}/tests/test_outputs_e2e.py +0 -0
  229. {docpull-6.8.0 → docpull-6.9.0}/tests/test_pack_server.py +0 -0
  230. {docpull-6.8.0 → docpull-6.9.0}/tests/test_pack_tools.py +0 -0
  231. {docpull-6.8.0 → docpull-6.9.0}/tests/test_parser_dependency_support.py +0 -0
  232. {docpull-6.8.0 → docpull-6.9.0}/tests/test_pipeline.py +0 -0
  233. {docpull-6.8.0 → docpull-6.9.0}/tests/test_policy.py +0 -0
  234. {docpull-6.8.0 → docpull-6.9.0}/tests/test_policy_cli.py +0 -0
  235. {docpull-6.8.0 → docpull-6.9.0}/tests/test_project.py +0 -0
  236. {docpull-6.8.0 → docpull-6.9.0}/tests/test_provenance.py +0 -0
  237. {docpull-6.8.0 → docpull-6.9.0}/tests/test_public_feature_smoke.py +0 -0
  238. {docpull-6.8.0 → docpull-6.9.0}/tests/test_qa_judge.py +0 -0
  239. {docpull-6.8.0 → docpull-6.9.0}/tests/test_rate_limiter.py +0 -0
  240. {docpull-6.8.0 → docpull-6.9.0}/tests/test_real_feature_smoke_script.py +0 -0
  241. {docpull-6.8.0 → docpull-6.9.0}/tests/test_real_site_regressions.py +0 -0
  242. {docpull-6.8.0 → docpull-6.9.0}/tests/test_registry.py +0 -0
  243. {docpull-6.8.0 → docpull-6.9.0}/tests/test_relationship_workflow.py +0 -0
  244. {docpull-6.8.0 → docpull-6.9.0}/tests/test_release_a_plus_check_script.py +0 -0
  245. {docpull-6.8.0 → docpull-6.9.0}/tests/test_release_registry_workflows.py +0 -0
  246. {docpull-6.8.0 → docpull-6.9.0}/tests/test_rendering.py +0 -0
  247. {docpull-6.8.0 → docpull-6.9.0}/tests/test_research.py +0 -0
  248. {docpull-6.8.0 → docpull-6.9.0}/tests/test_save_ndjson.py +0 -0
  249. {docpull-6.8.0 → docpull-6.9.0}/tests/test_save_sqlite.py +0 -0
  250. {docpull-6.8.0 → docpull-6.9.0}/tests/test_security_hardening.py +0 -0
  251. {docpull-6.8.0 → docpull-6.9.0}/tests/test_share.py +0 -0
  252. {docpull-6.8.0 → docpull-6.9.0}/tests/test_source_scoring.py +0 -0
  253. {docpull-6.8.0 → docpull-6.9.0}/tests/test_special_cases.py +0 -0
  254. {docpull-6.8.0 → docpull-6.9.0}/tests/test_surface_contract.py +0 -0
  255. {docpull-6.8.0 → docpull-6.9.0}/tests/test_time_utils.py +0 -0
  256. {docpull-6.8.0 → docpull-6.9.0}/tests/test_token_metrics.py +0 -0
  257. {docpull-6.8.0 → docpull-6.9.0}/tests/test_trafilatura_extractor.py +0 -0
  258. {docpull-6.8.0 → docpull-6.9.0}/tests/test_typed_knowledge_packs.py +0 -0
  259. {docpull-6.8.0 → docpull-6.9.0}/tests/test_warc.py +0 -0
  260. {docpull-6.8.0 → docpull-6.9.0}/tests/test_web_search.py +0 -0
  261. {docpull-6.8.0 → docpull-6.9.0}/tests/test_website_snapshot.py +0 -0
  262. {docpull-6.8.0 → docpull-6.9.0}/tests/test_workflow_contracts.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docpull
3
- Version: 6.8.0
3
+ Version: 6.9.0
4
4
  Summary: Declare, sync, diff, and lock context dependencies for AI agents
5
5
  Author-email: Zachary Roth <support@raintree.technology>
6
6
  Maintainer-email: Raintree Technology <support@raintree.technology>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "docpull"
7
- version = "6.8.0"
7
+ version = "6.9.0"
8
8
  dynamic = []
9
9
  description = "Declare, sync, diff, and lock context dependencies for AI agents"
10
10
  readme = {file = "README.md", content-type = "text/markdown"}
@@ -207,6 +207,9 @@ include = ["docpull*"]
207
207
  docpull = ["py.typed", "fixtures/*.json", "schemas/*.schema.json"]
208
208
 
209
209
  [tool.uv]
210
+ # unstructured caps filelock below 4, which leaves the locked dev environment on
211
+ # a vulnerable release. Drop this once unstructured allows filelock 4.
212
+ override-dependencies = ["filelock>=4.2.1"]
210
213
  constraint-dependencies = [
211
214
  "h2>=4.4.1",
212
215
  "multidict>=6.9.1",
@@ -15,7 +15,7 @@ from typing import TYPE_CHECKING, Any
15
15
 
16
16
  from .surface import PUBLIC_SDK_EXPORTS
17
17
 
18
- __version__ = "6.8.0"
18
+ __version__ = "6.9.0"
19
19
 
20
20
  _LAZY_EXPORTS: dict[str, tuple[str, str]] = {
21
21
  "query_context": (".context_query", "query_context"),
@@ -28,6 +28,8 @@ class ManifestEntry(TypedDict, total=False):
28
28
  size: int
29
29
  etag: str
30
30
  last_modified: str
31
+ sitemap_lastmod: str
32
+ verified_at: str
31
33
  schema_version: int
32
34
  run_fingerprint: dict[str, Any]
33
35
 
@@ -136,7 +138,15 @@ class CacheManager:
136
138
  logger.warning("Skipping invalid cache manifest entry for %r", url)
137
139
  continue
138
140
  entry: ManifestEntry = {}
139
- for key in ("checksum", "file_path", "fetched_at", "etag", "last_modified"):
141
+ for key in (
142
+ "checksum",
143
+ "file_path",
144
+ "fetched_at",
145
+ "etag",
146
+ "last_modified",
147
+ "sitemap_lastmod",
148
+ "verified_at",
149
+ ):
140
150
  value = raw_entry.get(key)
141
151
  if isinstance(value, str):
142
152
  entry[key] = value # type: ignore[literal-required]
@@ -277,6 +287,7 @@ class CacheManager:
277
287
  etag: str | None = None,
278
288
  last_modified: str | None = None,
279
289
  run_fingerprint: dict[str, Any] | None = None,
290
+ sitemap_lastmod: str | None = None,
280
291
  ) -> None:
281
292
  """Update cache entry for a URL.
282
293
 
@@ -286,6 +297,7 @@ class CacheManager:
286
297
  file_path: Path where content was saved
287
298
  etag: HTTP ETag header
288
299
  last_modified: HTTP Last-Modified header
300
+ sitemap_lastmod: Normalized sitemap ``<lastmod>`` seen for this URL
289
301
 
290
302
  Note:
291
303
  Changes are batched. Call flush() to persist to disk.
@@ -304,9 +316,29 @@ class CacheManager:
304
316
  self.manifest[url]["etag"] = etag
305
317
  if last_modified:
306
318
  self.manifest[url]["last_modified"] = last_modified
319
+ if sitemap_lastmod:
320
+ self.manifest[url]["sitemap_lastmod"] = sitemap_lastmod
307
321
 
308
322
  self._manifest_dirty = True
309
323
 
324
+ def mark_verified(self, url: str, sitemap_lastmod: str | None = None) -> None:
325
+ """Record that the server just confirmed a cached page is still current."""
326
+ entry = self.manifest.get(url)
327
+ if entry is None:
328
+ return
329
+ entry["verified_at"] = utc_now_iso()
330
+ if sitemap_lastmod:
331
+ entry["sitemap_lastmod"] = sitemap_lastmod
332
+ self._manifest_dirty = True
333
+
334
+ def forget(self, url: str) -> None:
335
+ """Drop a URL from the manifest and state."""
336
+ self.manifest.pop(url, None)
337
+ self._state.fetched_urls.discard(url)
338
+ self._state.failed_urls.discard(url)
339
+ self._manifest_dirty = True
340
+ self._state_dirty = True
341
+
310
342
  def mark_fetched(self, url: str) -> None:
311
343
  """Mark URL as successfully fetched.
312
344
 
@@ -369,10 +401,10 @@ class CacheManager:
369
401
  to_remove = []
370
402
 
371
403
  for url, entry in self.manifest.items():
372
- fetched_at = entry.get("fetched_at")
373
- if fetched_at:
404
+ checked_at = entry.get("verified_at") or entry.get("fetched_at")
405
+ if checked_at:
374
406
  try:
375
- entry_time = parse_persisted_datetime(fetched_at)
407
+ entry_time = parse_persisted_datetime(checked_at)
376
408
  if entry_time < cutoff:
377
409
  to_remove.append(url)
378
410
  except ValueError as err:
@@ -80,6 +80,14 @@ def _core_dependencies_available() -> bool:
80
80
  return True
81
81
 
82
82
 
83
+ def _parse_max_age(value: str) -> int:
84
+ """Parse ``--max-age`` as whole days, with an optional ``d`` suffix."""
85
+ digits = value[:-1] if value.lower().endswith("d") else value
86
+ if not digits.isdigit():
87
+ raise argparse.ArgumentTypeError(f"expected days such as 14 or 14d, got {value!r}")
88
+ return int(digits)
89
+
90
+
83
91
  def _write_fetch_accounting(
84
92
  *,
85
93
  config: DocpullConfig,
@@ -435,6 +443,16 @@ Examples:
435
443
  default=None,
436
444
  help="Maximum concurrent requests per host",
437
445
  )
446
+ crawl_group.add_argument(
447
+ "--not-modified-delay",
448
+ type=float,
449
+ default=None,
450
+ metavar="SECONDS",
451
+ help=(
452
+ "Wait this long after a 304 instead of --rate-limit. "
453
+ "Never undercuts robots.txt Crawl-delay (default: off)"
454
+ ),
455
+ )
438
456
  crawl_group.add_argument(
439
457
  "--rate-limit",
440
458
  "-r",
@@ -609,6 +627,22 @@ Examples:
609
627
  action="store_true",
610
628
  help="Re-fetch pages even if unchanged",
611
629
  )
630
+ cache_group.add_argument(
631
+ "--max-age",
632
+ type=_parse_max_age,
633
+ default=None,
634
+ metavar="DAYS",
635
+ help=(
636
+ "Skip pages with an unchanged sitemap lastmod for this many days after they "
637
+ "were last verified, then revalidate over HTTP. Markdown output only; "
638
+ "0 disables (default: 14)"
639
+ ),
640
+ )
641
+ cache_group.add_argument(
642
+ "--prune-removed",
643
+ action="store_true",
644
+ help="Delete local files for URLs that left a complete sitemap (implies --cache)",
645
+ )
612
646
  cache_group.add_argument(
613
647
  "--resume",
614
648
  action="store_true",
@@ -766,6 +800,8 @@ def run_fetcher(args: argparse.Namespace) -> int:
766
800
  crawl_kwargs["per_host_concurrent"] = args.per_host_concurrent
767
801
  if args.rate_limit is not None:
768
802
  crawl_kwargs["rate_limit"] = args.rate_limit
803
+ if args.not_modified_delay is not None:
804
+ crawl_kwargs["not_modified_delay"] = args.not_modified_delay
769
805
  if args.adaptive_rate_limit:
770
806
  crawl_kwargs["adaptive_rate_limit"] = True
771
807
  if args.no_streaming_discovery:
@@ -869,8 +905,12 @@ def run_fetcher(args: argparse.Namespace) -> int:
869
905
  config_kwargs["budget"] = {"maximum_paid_cost_usd": args.budget}
870
906
 
871
907
  cache_kwargs: dict = {}
872
- if args.cache or args.resume:
908
+ if args.cache or args.resume or args.prune_removed:
873
909
  cache_kwargs["enabled"] = True
910
+ if args.prune_removed:
911
+ cache_kwargs["prune_removed"] = True
912
+ if args.max_age is not None:
913
+ cache_kwargs["max_age_days"] = args.max_age
874
914
  if args.cache_dir:
875
915
  cache_kwargs["directory"] = args.cache_dir
876
916
  if args.cache_ttl is not None:
@@ -1105,6 +1145,16 @@ def run_fetcher(args: argparse.Namespace) -> int:
1105
1145
  console.print(f" Pages skipped: {stats.pages_skipped}")
1106
1146
  console.print(f" Pages failed: {stats.pages_failed}")
1107
1147
  console.print(f" Duration: {stats.duration_seconds:.1f}s")
1148
+ removed_urls = getattr(stats, "removed_urls", [])
1149
+ if removed_urls:
1150
+ pruned_urls = getattr(stats, "pruned_urls", [])
1151
+ console.print(
1152
+ f" URLs removed from sitemap: {len(removed_urls)} ({len(pruned_urls)} pruned)"
1153
+ )
1154
+ for url in removed_urls[:20]:
1155
+ console.print(f" {escape(url)}")
1156
+ if not pruned_urls:
1157
+ console.print(" Use --prune-removed to delete their local files.")
1108
1158
 
1109
1159
  # Print skip reason summary if there were skips
1110
1160
  if skip_counts:
@@ -1116,7 +1166,8 @@ def run_fetcher(args: argparse.Namespace) -> int:
1116
1166
  exit_code = _fetch_exit_code(
1117
1167
  stats,
1118
1168
  config.output.directory,
1119
- allow_empty=args.dry_run,
1169
+ # Nothing new because nothing changed is a successful update.
1170
+ allow_empty=args.dry_run or skip_counts.get(SkipReason.CACHE_UNCHANGED, 0) > 0,
1120
1171
  exit_policy=args.exit_policy,
1121
1172
  )
1122
1173
  if exit_code and not args.quiet and stats.pages_fetched == 0 and stats.pages_failed == 0:
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import asyncio
6
+ import logging
6
7
  import re
7
8
  import time
8
9
  from collections.abc import AsyncIterator, Callable
@@ -40,6 +41,8 @@ from ..security.robots import RobotsChecker
40
41
  from ..security.url_validator import UrlValidator
41
42
  from ..warc import WARC_FILENAME, WarcWriter, WarcWriteStep
42
43
 
44
+ logger = logging.getLogger(__name__)
45
+
43
46
 
44
47
  def _url_to_filename(url: str, base_url: str | None = None) -> str:
45
48
  """
@@ -234,6 +237,7 @@ class Fetcher:
234
237
  self._save_step: SaveStep | None = None
235
238
  self._warc_writer: WarcWriter | None = None
236
239
  self._output_was_used = False
240
+ self._sitemap_lastmods: dict[str, str] = {}
237
241
 
238
242
  def _run_fingerprint(self) -> dict[str, object]:
239
243
  return self.run_identity.fingerprint()
@@ -354,6 +358,7 @@ class Fetcher:
354
358
  download_policy=SafeDownloadPolicy(
355
359
  allowed_remote_document_types=allowed_remote_document_types,
356
360
  ),
361
+ not_modified_delay=self.config.crawl.not_modified_delay,
357
362
  )
358
363
  await self._http_client.__aenter__()
359
364
 
@@ -412,6 +417,13 @@ class Fetcher:
412
417
  skip_unchanged=self.config.cache.skip_unchanged,
413
418
  allowed_remote_document_types=allowed_remote_document_types,
414
419
  capture_raw=self.config.warc_output,
420
+ # Other formats rewrite one file per run, so a page skipped
421
+ # without a request would vanish from their output.
422
+ sitemap_lastmods=(
423
+ self._sitemap_lastmods if self.config.output.format == "markdown" else None
424
+ ),
425
+ max_age_days=self.config.cache.max_age_days,
426
+ run_fingerprint=self._run_fingerprint(),
415
427
  )
416
428
  )
417
429
  if render_mode == "fallback":
@@ -519,6 +531,7 @@ class Fetcher:
519
531
  url_validator=self._url_validator,
520
532
  pattern_filter=pattern_filter,
521
533
  robots_checker=self._robots_checker,
534
+ lastmods=self._sitemap_lastmods,
522
535
  )
523
536
 
524
537
  link_extractor = StaticLinkExtractor(http_client=self._http_client)
@@ -815,6 +828,7 @@ class Fetcher:
815
828
  message=f"Discovered {len(discovered)} URLs",
816
829
  )
817
830
  self._stats.urls_discovered = len(discovered)
831
+ self._handle_removed_urls(discovered)
818
832
 
819
833
  if self._cancelled:
820
834
  yield FetchEvent(type=EventType.CANCELLED, message="Fetch cancelled by user")
@@ -917,8 +931,9 @@ class Fetcher:
917
931
  progress_counter = {"processed": 0, "saved": 0, "skipped": 0, "failed": 0}
918
932
  worker_errors: list[Exception] = []
919
933
 
934
+ discovered_for_resume: list[str] = []
935
+
920
936
  async def discover_into_queue() -> None:
921
- discovered_for_resume: list[str] = []
922
937
  await event_queue.put(
923
938
  FetchEvent(
924
939
  type=EventType.DISCOVERY_STARTED,
@@ -1059,6 +1074,7 @@ class Fetcher:
1059
1074
  if worker_errors:
1060
1075
  self._clear_resume_state_if_nothing_pending()
1061
1076
  raise worker_errors[0]
1077
+ self._handle_removed_urls(discovered_for_resume)
1062
1078
  self._stats.duration_seconds = time.monotonic() - self._start_time
1063
1079
  if self._cache_manager and self._stats.pages_failed == 0 and not self._cancelled:
1064
1080
  self._cache_manager.clear_discovered_urls()
@@ -1105,6 +1121,11 @@ class Fetcher:
1105
1121
  self._stats.pages_skipped += 1
1106
1122
  if self._cache_manager:
1107
1123
  self._cache_manager.frontier.mark_skipped(url)
1124
+ if ctx.skip_code == SkipReason.CACHE_UNCHANGED:
1125
+ if ctx.status_code == 304:
1126
+ self._cache_manager.mark_verified(url, self._sitemap_lastmods.get(url))
1127
+ if self._save_step is not None:
1128
+ self._save_step.retain_url(url)
1108
1129
  return
1109
1130
  self._stats.pages_fetched += 1
1110
1131
  self._stats.bytes_downloaded += ctx.bytes_downloaded
@@ -1119,9 +1140,54 @@ class Fetcher:
1119
1140
  etag=ctx.etag,
1120
1141
  last_modified=ctx.last_modified,
1121
1142
  run_fingerprint=self._run_fingerprint(),
1143
+ sitemap_lastmod=self._sitemap_lastmods.get(url),
1122
1144
  )
1123
1145
  self._cache_manager.mark_fetched(url)
1124
1146
 
1147
+ def _handle_removed_urls(self, discovered: list[str]) -> None:
1148
+ """Report, and optionally prune, saved pages that left the sitemap.
1149
+
1150
+ Runs only after a complete sitemap listing: a capped, crawled, or
1151
+ partly unreadable discovery says nothing about what was removed.
1152
+ """
1153
+ cache = self._cache_manager
1154
+ if (
1155
+ cache is None
1156
+ or self._discoverer is None
1157
+ or not getattr(self._discoverer, "complete", False)
1158
+ or self.config.dry_run
1159
+ or self._cancelled
1160
+ ):
1161
+ return
1162
+ current = set(discovered)
1163
+ fingerprint = self._run_fingerprint()
1164
+ # The fingerprint pins start URL and filters, so a shared cache directory
1165
+ # or a narrowed --include-paths is never mistaken for a removal.
1166
+ known = [url for url, entry in cache.manifest.items() if entry.get("run_fingerprint") == fingerprint]
1167
+ removed = sorted(url for url in known if url not in current)
1168
+ self._stats.removed_urls = removed
1169
+ if not removed or not self.config.cache.prune_removed:
1170
+ return
1171
+ # A broken sitemap deploy can look like most of a site disappearing.
1172
+ if len(removed) > len(current):
1173
+ logger.warning(
1174
+ "Not pruning: %d URLs left the sitemap and only %d remain, which looks like a bad sitemap",
1175
+ len(removed),
1176
+ len(current),
1177
+ )
1178
+ return
1179
+ output_dir = self.config.output.directory.resolve()
1180
+ for url in removed:
1181
+ saved_path = cache.manifest[url].get("file_path")
1182
+ if saved_path:
1183
+ resolved = Path(saved_path).resolve()
1184
+ if not resolved.is_relative_to(output_dir):
1185
+ logger.warning("Not pruning %s: outside the output directory", resolved)
1186
+ continue
1187
+ resolved.unlink(missing_ok=True)
1188
+ cache.forget(url)
1189
+ self._stats.pruned_urls.append(url)
1190
+
1125
1191
 
1126
1192
  def fetch_one(url: str, **kwargs: object) -> PageContext:
1127
1193
  """Fetch a single URL synchronously and return the parsed page context.
@@ -51,6 +51,8 @@ class CompositeDiscoverer:
51
51
  self._crawler = link_crawler
52
52
  self._fallback_threshold = fallback_threshold
53
53
  self._seen = SeenUrlTracker()
54
+ # True only after a run whose URL list came whole from readable sitemaps.
55
+ self.complete = False
54
56
 
55
57
  async def discover(
56
58
  self,
@@ -74,6 +76,7 @@ class CompositeDiscoverer:
74
76
  Discovered URLs (deduplicated)
75
77
  """
76
78
  self._seen.clear()
79
+ self.complete = False
77
80
  count = 0
78
81
 
79
82
  # Phase 1: Sitemap discovery
@@ -93,6 +96,9 @@ class CompositeDiscoverer:
93
96
  return
94
97
 
95
98
  logger.debug(f"Sitemap discovery yielded {sitemap_count} URLs")
99
+ self.complete = getattr(self._sitemap, "complete", False) and sitemap_count >= max(
100
+ 1, self._fallback_threshold
101
+ )
96
102
 
97
103
  # Phase 2: Crawl fallback (if enabled and needed)
98
104
  if self._crawler is None:
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import logging
6
6
  from collections.abc import AsyncIterator
7
+ from datetime import UTC, datetime
7
8
  from urllib.parse import urlparse
8
9
 
9
10
  from defusedxml import ElementTree
@@ -20,6 +21,19 @@ logger = logging.getLogger(__name__)
20
21
  SITEMAP_NS = {"ns": "http://www.sitemaps.org/schemas/sitemap/0.9"}
21
22
 
22
23
 
24
+ def normalize_lastmod(value: str | None) -> str | None:
25
+ """Return a sitemap ``<lastmod>`` as a UTC ISO string, or None if unusable."""
26
+ if not value:
27
+ return None
28
+ try:
29
+ parsed = datetime.fromisoformat(value.strip())
30
+ except ValueError:
31
+ return None
32
+ if parsed.tzinfo is None:
33
+ parsed = parsed.replace(tzinfo=UTC)
34
+ return parsed.astimezone(UTC).isoformat()
35
+
36
+
23
37
  class SitemapDiscoverer:
24
38
  """
25
39
  Discovers URLs from sitemap.xml and sitemap index files.
@@ -48,6 +62,7 @@ class SitemapDiscoverer:
48
62
  url_validator: UrlValidator,
49
63
  pattern_filter: PatternFilter | None = None,
50
64
  robots_checker: RobotsChecker | None = None,
65
+ lastmods: dict[str, str] | None = None,
51
66
  ):
52
67
  """
53
68
  Initialize the sitemap discoverer.
@@ -57,6 +72,7 @@ class SitemapDiscoverer:
57
72
  url_validator: URL validator for security checks
58
73
  pattern_filter: Optional pattern filter for URLs
59
74
  robots_checker: Optional robots.txt checker for sitemap discovery
75
+ lastmods: Optional dict filled with each URL's normalized ``<lastmod>``
60
76
  """
61
77
  self._client = http_client
62
78
  self._validator = url_validator
@@ -65,6 +81,11 @@ class SitemapDiscoverer:
65
81
  self._seen = SeenUrlTracker()
66
82
  self._seen_sitemaps = SeenUrlTracker()
67
83
  self._domain_filter: DomainFilter | None = None
84
+ self.lastmods: dict[str, str] = lastmods if lastmods is not None else {}
85
+ # False once a sitemap we were told about could not be read, so callers
86
+ # never read a partial listing as "these pages were removed".
87
+ self.complete = True
88
+ self._required_sitemaps: set[str] = set()
68
89
 
69
90
  def _is_in_scope(self, url: str) -> bool:
70
91
  """Keep sitemap discovery aligned with the crawl origin."""
@@ -171,9 +192,16 @@ class SitemapDiscoverer:
171
192
  ns = SITEMAP_NS if use_ns else {}
172
193
  prefix = "ns:" if use_ns else ""
173
194
 
174
- for url_elem in root.findall(f".//{prefix}url/{prefix}loc", ns):
175
- if url_elem.text:
176
- page_urls.append(url_elem.text.strip())
195
+ for url_elem in root.findall(f".//{prefix}url", ns):
196
+ loc = url_elem.find(f"{prefix}loc", ns)
197
+ if loc is None or not loc.text:
198
+ continue
199
+ page_url = loc.text.strip()
200
+ page_urls.append(page_url)
201
+ lastmod_elem = url_elem.find(f"{prefix}lastmod", ns)
202
+ lastmod = normalize_lastmod(lastmod_elem.text if lastmod_elem is not None else None)
203
+ if lastmod:
204
+ self.lastmods[page_url] = lastmod
177
205
 
178
206
  for sitemap_elem in root.findall(f".//{prefix}sitemap/{prefix}loc", ns):
179
207
  if sitemap_elem.text:
@@ -209,11 +237,16 @@ class SitemapDiscoverer:
209
237
  if not self._seen_sitemaps.add(sitemap_url):
210
238
  return
211
239
 
240
+ required = depth > 0 or sitemap_url in self._required_sitemaps
212
241
  content = await self._fetch_sitemap(sitemap_url)
213
242
  if content is None:
243
+ if required:
244
+ self.complete = False
214
245
  return
215
246
 
216
247
  page_urls, nested_sitemaps = self._parse_sitemap(content)
248
+ if not page_urls and not nested_sitemaps:
249
+ self.complete = False
217
250
 
218
251
  logger.debug(f"Sitemap {sitemap_url}: {len(page_urls)} URLs, {len(nested_sitemaps)} nested sitemaps")
219
252
 
@@ -275,15 +308,20 @@ class SitemapDiscoverer:
275
308
  self._seen.clear()
276
309
  self._seen_sitemaps.clear()
277
310
  self._domain_filter = DomainFilter(start_url, allow_subdomains=False)
311
+ self.lastmods.clear()
312
+ self.complete = True
313
+ self._required_sitemaps = set()
278
314
 
279
315
  # If URL looks like a sitemap, use it directly
280
316
  if start_url.endswith(".xml"):
317
+ self._required_sitemaps = {start_url}
281
318
  async for url in self._discover_from_sitemap(start_url, max_urls=max_urls):
282
319
  yield url
283
320
  return
284
321
 
285
322
  # Try robots.txt first (authoritative source)
286
323
  sitemap_urls = self._get_sitemaps_from_robots(start_url)
324
+ self._required_sitemaps = set(sitemap_urls)
287
325
 
288
326
  # Fall back to guessing common locations
289
327
  if not sitemap_urls:
@@ -446,8 +446,10 @@ def classify_semantic_diff(
446
446
  ) -> dict[str, Any]:
447
447
  old_pack_dir = old_pack_dir.resolve()
448
448
  new_pack_dir = new_pack_dir.resolve()
449
- old_records = _records_by_url(_read_ndjson(old_pack_dir / "documents.ndjson"))
450
- new_records = _records_by_url(_read_ndjson(new_pack_dir / "documents.ndjson"))
449
+ from .pack_tools import _read_pack_records
450
+
451
+ old_records = _records_by_url(_read_pack_records(old_pack_dir))
452
+ new_records = _records_by_url(_read_pack_records(new_pack_dir))
451
453
  if diff_payload is None:
452
454
  diff_payload = _simple_diff_payload(old_records, new_records)
453
455
 
@@ -151,6 +151,7 @@ class AsyncHttpClient:
151
151
  require_pinned_dns: bool = False,
152
152
  download_policy: SafeDownloadPolicy | None = None,
153
153
  log_retry_warnings: bool = True,
154
+ not_modified_delay: float | None = None,
154
155
  ) -> None:
155
156
  """
156
157
  Initialize the HTTP client.
@@ -163,6 +164,7 @@ class AsyncHttpClient:
163
164
  user_agent: Custom User-Agent string
164
165
  proxy: Proxy URL (http:// or socks5://)
165
166
  default_timeout: Default request timeout in seconds
167
+ not_modified_delay: Seconds to wait after a 304 instead of the host delay
166
168
  auth_headers: Authentication headers to include in all requests
167
169
  download_policy: Policy that rejects file-like responses before
168
170
  they can be buffered, converted, or saved
@@ -171,6 +173,7 @@ class AsyncHttpClient:
171
173
  missing guessed resources are expected.
172
174
  """
173
175
  self._rate_limiter = rate_limiter
176
+ self._not_modified_delay = not_modified_delay
174
177
  self._max_retries = max_retries
175
178
  self._retry_base_delay = retry_base_delay
176
179
  self._max_content_size = max_content_size
@@ -627,6 +630,11 @@ class AsyncHttpClient:
627
630
  break
628
631
  response.raise_for_status()
629
632
 
633
+ if response.status == 304 and self._not_modified_delay is not None:
634
+ shorten = getattr(self._rate_limiter, "shorten_next_delay", None)
635
+ if shorten is not None:
636
+ shorten(current_url, self._not_modified_delay)
637
+
630
638
  if response.status == 304 or 400 <= response.status < 500:
631
639
  return HttpResponse(
632
640
  status_code=response.status,
@@ -117,6 +117,17 @@ class PerHostRateLimiter:
117
117
 
118
118
  yield
119
119
 
120
+ def shorten_next_delay(self, url: str, delay: float) -> None:
121
+ """Let the next request to this host wait ``delay`` instead of the full delay.
122
+
123
+ Hosts with an explicit limit (robots.txt Crawl-delay, per-host config,
124
+ adaptive backoff) keep it.
125
+ """
126
+ host = self._get_host(url)
127
+ if host in self.host_configs or host not in self._last_request:
128
+ return
129
+ self._last_request[host] -= max(0.0, self.default_delay - delay)
130
+
120
131
  def update_host_config(
121
132
  self,
122
133
  host: str,
@@ -94,6 +94,14 @@ class CrawlConfig(BaseModel):
94
94
  per_host_concurrent: int = Field(3, ge=1, description="Maximum concurrent requests per host")
95
95
  include_paths: list[str] = Field(default_factory=list, description="URL path patterns to include")
96
96
  exclude_paths: list[str] = Field(default_factory=list, description="URL path patterns to exclude")
97
+ not_modified_delay: float | None = Field(
98
+ None,
99
+ ge=0,
100
+ description=(
101
+ "Seconds to wait after a 304 response instead of rate_limit. Never undercuts "
102
+ "robots.txt Crawl-delay or per-host limits (None = use rate_limit)"
103
+ ),
104
+ )
97
105
  adaptive_rate_limit: bool = Field(
98
106
  False,
99
107
  description="Automatically adjust rate limits based on server responses (429s)",
@@ -669,6 +677,18 @@ class CacheConfig(BaseModel):
669
677
  False,
670
678
  description="Resume from previous interrupted run (requires caching enabled)",
671
679
  )
680
+ max_age_days: int = Field(
681
+ 14,
682
+ ge=0,
683
+ description=(
684
+ "Trust an unchanged sitemap lastmod for this many days after a page was "
685
+ "last verified, then revalidate it over HTTP (0 = never skip on lastmod)"
686
+ ),
687
+ )
688
+ prune_removed: bool = Field(
689
+ False,
690
+ description="Delete local files for URLs that left a complete sitemap",
691
+ )
672
692
 
673
693
  model_config = {"extra": "forbid"}
674
694
 
@@ -181,6 +181,8 @@ class FetchStats:
181
181
  bytes_downloaded: int = 0
182
182
  files_saved: int = 0
183
183
  duration_seconds: float = 0.0
184
+ removed_urls: list[str] = field(default_factory=list)
185
+ pruned_urls: list[str] = field(default_factory=list)
184
186
 
185
187
  @property
186
188
  def success_rate(self) -> float:
@@ -2028,8 +2028,8 @@ def search_pack(
2028
2028
 
2029
2029
 
2030
2030
  def diff_packs(old_pack_dir: Path, new_pack_dir: Path) -> dict[str, Any]:
2031
- old_records = _records_by_url(_read_ndjson(old_pack_dir / "documents.ndjson"))
2032
- new_records = _records_by_url(_read_ndjson(new_pack_dir / "documents.ndjson"))
2031
+ old_records = _records_by_url(_read_pack_records(old_pack_dir))
2032
+ new_records = _records_by_url(_read_pack_records(new_pack_dir))
2033
2033
 
2034
2034
  old_urls = set(old_records)
2035
2035
  new_urls = set(new_records)