kospex 0.4.1__tar.gz → 0.4.2__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 (343) hide show
  1. {kospex-0.4.1/src/kospex.egg-info → kospex-0.4.2}/PKG-INFO +1 -1
  2. {kospex-0.4.1 → kospex-0.4.2}/pyproject.toml +1 -1
  3. kospex-0.4.2/src/kospex/dependencies/__init__.py +6 -0
  4. kospex-0.4.2/src/kospex/dependencies/version_diff.py +94 -0
  5. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/org_sync_manifest.py +15 -0
  6. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/syncs_view.py +54 -3
  7. {kospex-0.4.1 → kospex-0.4.2/src/kospex.egg-info}/PKG-INFO +1 -1
  8. {kospex-0.4.1 → kospex-0.4.2}/src/kospex.egg-info/SOURCES.txt +5 -0
  9. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_cli.py +50 -3
  10. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_dependencies.py +207 -6
  11. {kospex-0.4.1 → kospex-0.4.2}/src/krunner.py +10 -0
  12. {kospex-0.4.1 → kospex-0.4.2}/src/kweb2.py +22 -0
  13. {kospex-0.4.1 → kospex-0.4.2}/src/static/css/tailwind.css +1 -1
  14. {kospex-0.4.1 → kospex-0.4.2}/src/templates/syncs.html +1 -1
  15. kospex-0.4.2/src/templates/syncs_run.html +150 -0
  16. kospex-0.4.2/tests/test_behind_fields.py +280 -0
  17. {kospex-0.4.1 → kospex-0.4.2}/tests/test_first_release.py +7 -2
  18. {kospex-0.4.1 → kospex-0.4.2}/tests/test_sca_output_and_save.py +3 -2
  19. {kospex-0.4.1 → kospex-0.4.2}/tests/test_syncs_page.py +100 -0
  20. {kospex-0.4.1 → kospex-0.4.2}/tests/test_syncs_view.py +73 -0
  21. kospex-0.4.2/tests/test_version_diff.py +264 -0
  22. {kospex-0.4.1 → kospex-0.4.2}/tests/test_versions_behind_prerelease.py +3 -0
  23. {kospex-0.4.1 → kospex-0.4.2}/LICENSE +0 -0
  24. {kospex-0.4.1 → kospex-0.4.2}/MANIFEST.in +0 -0
  25. {kospex-0.4.1 → kospex-0.4.2}/README.md +0 -0
  26. {kospex-0.4.1 → kospex-0.4.2}/README.short.md +0 -0
  27. {kospex-0.4.1 → kospex-0.4.2}/setup.cfg +0 -0
  28. {kospex-0.4.1 → kospex-0.4.2}/src/api_routes.py +0 -0
  29. {kospex-0.4.1 → kospex-0.4.2}/src/kgit.py +0 -0
  30. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/__init__.py +0 -0
  31. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/assessment_types.py +0 -0
  32. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/authorship.py +0 -0
  33. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/ca_bundles.py +0 -0
  34. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/__init__.py +0 -0
  35. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/health.py +0 -0
  36. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/introspect.py +0 -0
  37. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0003_repos_sync_provenance.sql +0 -0
  38. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0004_repos_last_fetch.sql +0 -0
  39. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0005_dependency_data_resolution.sql +0 -0
  40. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0006_dependency_version_constraint.sql +0 -0
  41. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0007_file_metadata_repo_index.sql +0 -0
  42. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0008_osi_runs.sql +0 -0
  43. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0009_dependency_install_state.sql +0 -0
  44. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0010_osi_runs_finished_at.sql +0 -0
  45. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0011_commits_covering_index.sql +0 -0
  46. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0012_org_sync.sql +0 -0
  47. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0013_org_sync_listings.py +0 -0
  48. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/0013_org_sync_listings.sql +0 -0
  49. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/README.md +0 -0
  50. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrations/__init__.py +0 -0
  51. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/db/migrator.py +0 -0
  52. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/__init__.py +0 -0
  53. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/constraints.py +0 -0
  54. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/errors.py +0 -0
  55. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/gomod.py +0 -0
  56. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/gradle.py +0 -0
  57. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/maven.py +0 -0
  58. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/npmlock.py +0 -0
  59. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/nuget.py +0 -0
  60. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/pnpm.py +0 -0
  61. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/registry.py +0 -0
  62. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/uvlock.py +0 -0
  63. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/workflows.py +0 -0
  64. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/extractors/yarn.py +0 -0
  65. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/git_duckdb.py +0 -0
  66. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/git_ingest.py +0 -0
  67. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/github_dependabot.py +0 -0
  68. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/github_export.py +0 -0
  69. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/github_properties.py +0 -0
  70. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/habitat_config.py +0 -0
  71. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/integrations/__init__.py +0 -0
  72. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/integrations/snyk/__init__.py +0 -0
  73. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/integrations/snyk/cli.py +0 -0
  74. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/integrations/snyk/client.py +0 -0
  75. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/integrations/snyk/queries.py +0 -0
  76. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/npm_range.py +0 -0
  77. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/org_sync.py +0 -0
  78. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/org_sync_command.py +0 -0
  79. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/osi_extract.py +0 -0
  80. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/osi_lock.py +0 -0
  81. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/osi_next.py +0 -0
  82. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/osi_outcomes.py +0 -0
  83. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/osi_queue.py +0 -0
  84. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/osi_run_log.py +0 -0
  85. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/prerelease.py +0 -0
  86. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/private_packages.py +0 -0
  87. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/run_lock.py +0 -0
  88. {kospex-0.4.1 → kospex-0.4.2}/src/kospex/staleness.py +0 -0
  89. {kospex-0.4.1 → kospex-0.4.2}/src/kospex.egg-info/dependency_links.txt +0 -0
  90. {kospex-0.4.1 → kospex-0.4.2}/src/kospex.egg-info/entry_points.txt +0 -0
  91. {kospex-0.4.1 → kospex-0.4.2}/src/kospex.egg-info/requires.txt +0 -0
  92. {kospex-0.4.1 → kospex-0.4.2}/src/kospex.egg-info/top_level.txt +0 -0
  93. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_agent.py +0 -0
  94. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_bitbucket.py +0 -0
  95. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_core.py +0 -0
  96. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_email.py +0 -0
  97. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_git.py +0 -0
  98. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_github.py +0 -0
  99. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_logging.py +0 -0
  100. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_observation.py +0 -0
  101. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_query.py +0 -0
  102. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_rebuild.py +0 -0
  103. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_request_cache.py +0 -0
  104. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_schema.py +0 -0
  105. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_stats.py +0 -0
  106. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_utils.py +0 -0
  107. {kospex-0.4.1 → kospex-0.4.2}/src/kospex_web.py +0 -0
  108. {kospex-0.4.1 → kospex-0.4.2}/src/kreaper.py +0 -0
  109. {kospex-0.4.1 → kospex-0.4.2}/src/krunner_utils.py +0 -0
  110. {kospex-0.4.1 → kospex-0.4.2}/src/kweb_graph_service.py +0 -0
  111. {kospex-0.4.1 → kospex-0.4.2}/src/kweb_help_service.py +0 -0
  112. {kospex-0.4.1 → kospex-0.4.2}/src/kweb_security.py +0 -0
  113. {kospex-0.4.1 → kospex-0.4.2}/src/static/css/datatables.min.css +0 -0
  114. {kospex-0.4.1 → kospex-0.4.2}/src/static/css/input.css +0 -0
  115. {kospex-0.4.1 → kospex-0.4.2}/src/static/favicon.ico +0 -0
  116. {kospex-0.4.1 → kospex-0.4.2}/src/static/js/chart.min.js +0 -0
  117. {kospex-0.4.1 → kospex-0.4.2}/src/static/js/d3.min.js +0 -0
  118. {kospex-0.4.1 → kospex-0.4.2}/src/static/js/datatables.min.js +0 -0
  119. {kospex-0.4.1 → kospex-0.4.2}/src/static/js/jquery.min.js +0 -0
  120. {kospex-0.4.1 → kospex-0.4.2}/src/templates/404.html +0 -0
  121. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_breadcrumb.html +0 -0
  122. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_datatable_scripts.html +0 -0
  123. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_entity_header.html +0 -0
  124. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_footer_scripts.html +0 -0
  125. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_header.html +0 -0
  126. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_id_header_macro.html +0 -0
  127. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_radar_macro.html +0 -0
  128. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_retired_tag_note.html +0 -0
  129. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_scope_label.html +0 -0
  130. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_single_radar.html +0 -0
  131. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_status_circles_macro.html +0 -0
  132. {kospex-0.4.1 → kospex-0.4.2}/src/templates/_unsupported_files_warning.html +0 -0
  133. {kospex-0.4.1 → kospex-0.4.2}/src/templates/bubble.html +0 -0
  134. {kospex-0.4.1 → kospex-0.4.2}/src/templates/collab.html +0 -0
  135. {kospex-0.4.1 → kospex-0.4.2}/src/templates/collab_graph.html +0 -0
  136. {kospex-0.4.1 → kospex-0.4.2}/src/templates/commit.html +0 -0
  137. {kospex-0.4.1 → kospex-0.4.2}/src/templates/commit_history.html +0 -0
  138. {kospex-0.4.1 → kospex-0.4.2}/src/templates/commits.html +0 -0
  139. {kospex-0.4.1 → kospex-0.4.2}/src/templates/dependencies.html +0 -0
  140. {kospex-0.4.1 → kospex-0.4.2}/src/templates/developer_view.html +0 -0
  141. {kospex-0.4.1 → kospex-0.4.2}/src/templates/developers.html +0 -0
  142. {kospex-0.4.1 → kospex-0.4.2}/src/templates/file_collaboration.html +0 -0
  143. {kospex-0.4.1 → kospex-0.4.2}/src/templates/files.html +0 -0
  144. {kospex-0.4.1 → kospex-0.4.2}/src/templates/graph.html +0 -0
  145. {kospex-0.4.1 → kospex-0.4.2}/src/templates/header.html +0 -0
  146. {kospex-0.4.1 → kospex-0.4.2}/src/templates/help/index.html +0 -0
  147. {kospex-0.4.1 → kospex-0.4.2}/src/templates/hotspots.html +0 -0
  148. {kospex-0.4.1 → kospex-0.4.2}/src/templates/key_person.html +0 -0
  149. {kospex-0.4.1 → kospex-0.4.2}/src/templates/landscape.html +0 -0
  150. {kospex-0.4.1 → kospex-0.4.2}/src/templates/meta-author-domains.html +0 -0
  151. {kospex-0.4.1 → kospex-0.4.2}/src/templates/metadata.html +0 -0
  152. {kospex-0.4.1 → kospex-0.4.2}/src/templates/metadata_repos.html +0 -0
  153. {kospex-0.4.1 → kospex-0.4.2}/src/templates/observation.html +0 -0
  154. {kospex-0.4.1 → kospex-0.4.2}/src/templates/observations.html +0 -0
  155. {kospex-0.4.1 → kospex-0.4.2}/src/templates/observations_repo.html +0 -0
  156. {kospex-0.4.1 → kospex-0.4.2}/src/templates/observations_repo_key.html +0 -0
  157. {kospex-0.4.1 → kospex-0.4.2}/src/templates/org_view.html +0 -0
  158. {kospex-0.4.1 → kospex-0.4.2}/src/templates/orgs.html +0 -0
  159. {kospex-0.4.1 → kospex-0.4.2}/src/templates/orphans.html +0 -0
  160. {kospex-0.4.1 → kospex-0.4.2}/src/templates/osi.html +0 -0
  161. {kospex-0.4.1 → kospex-0.4.2}/src/templates/package_check.html +0 -0
  162. {kospex-0.4.1 → kospex-0.4.2}/src/templates/repo_files.html +0 -0
  163. {kospex-0.4.1 → kospex-0.4.2}/src/templates/repo_view.html +0 -0
  164. {kospex-0.4.1 → kospex-0.4.2}/src/templates/repos-tech.html +0 -0
  165. {kospex-0.4.1 → kospex-0.4.2}/src/templates/repos.html +0 -0
  166. {kospex-0.4.1 → kospex-0.4.2}/src/templates/servers.html +0 -0
  167. {kospex-0.4.1 → kospex-0.4.2}/src/templates/summary.html +0 -0
  168. {kospex-0.4.1 → kospex-0.4.2}/src/templates/summary2.html +0 -0
  169. {kospex-0.4.1 → kospex-0.4.2}/src/templates/supply_chain.html +0 -0
  170. {kospex-0.4.1 → kospex-0.4.2}/src/templates/supply_chain_search.html +0 -0
  171. {kospex-0.4.1 → kospex-0.4.2}/src/templates/tags.html +0 -0
  172. {kospex-0.4.1 → kospex-0.4.2}/src/templates/tech-change.html +0 -0
  173. {kospex-0.4.1 → kospex-0.4.2}/src/templates/tenure.html +0 -0
  174. {kospex-0.4.1 → kospex-0.4.2}/src/templates/treemap.html +0 -0
  175. {kospex-0.4.1 → kospex-0.4.2}/tests/test_advisory_history_stub.py +0 -0
  176. {kospex-0.4.1 → kospex-0.4.2}/tests/test_assess_registry_dispatch.py +0 -0
  177. {kospex-0.4.1 → kospex-0.4.2}/tests/test_assessment_types.py +0 -0
  178. {kospex-0.4.1 → kospex-0.4.2}/tests/test_build_file_metadata_rows.py +0 -0
  179. {kospex-0.4.1 → kospex-0.4.2}/tests/test_ca_bundle.py +0 -0
  180. {kospex-0.4.1 → kospex-0.4.2}/tests/test_clone_repo.py +0 -0
  181. {kospex-0.4.1 → kospex-0.4.2}/tests/test_clone_repo_integration.py +0 -0
  182. {kospex-0.4.1 → kospex-0.4.2}/tests/test_clone_repo_resolution.py +0 -0
  183. {kospex-0.4.1 → kospex-0.4.2}/tests/test_commit_history_gaps.py +0 -0
  184. {kospex-0.4.1 → kospex-0.4.2}/tests/test_commit_log_parsing.py +0 -0
  185. {kospex-0.4.1 → kospex-0.4.2}/tests/test_commits_covering_index.py +0 -0
  186. {kospex-0.4.1 → kospex-0.4.2}/tests/test_conftest_shell_kospex_db.py +0 -0
  187. {kospex-0.4.1 → kospex-0.4.2}/tests/test_connectivity.py +0 -0
  188. {kospex-0.4.1 → kospex-0.4.2}/tests/test_constraint_classifier.py +0 -0
  189. {kospex-0.4.1 → kospex-0.4.2}/tests/test_date_ordering.py +0 -0
  190. {kospex-0.4.1 → kospex-0.4.2}/tests/test_db_health.py +0 -0
  191. {kospex-0.4.1 → kospex-0.4.2}/tests/test_db_introspect.py +0 -0
  192. {kospex-0.4.1 → kospex-0.4.2}/tests/test_db_migrator.py +0 -0
  193. {kospex-0.4.1 → kospex-0.4.2}/tests/test_declared_scope_manifests.py +0 -0
  194. {kospex-0.4.1 → kospex-0.4.2}/tests/test_dependencies_empty_state.py +0 -0
  195. {kospex-0.4.1 → kospex-0.4.2}/tests/test_dependencies_save.py +0 -0
  196. {kospex-0.4.1 → kospex-0.4.2}/tests/test_dependencies_template.py +0 -0
  197. {kospex-0.4.1 → kospex-0.4.2}/tests/test_dependency_data_unknown_integers.py +0 -0
  198. {kospex-0.4.1 → kospex-0.4.2}/tests/test_dependency_freshness.py +0 -0
  199. {kospex-0.4.1 → kospex-0.4.2}/tests/test_deps_command.py +0 -0
  200. {kospex-0.4.1 → kospex-0.4.2}/tests/test_deps_enrich_setting.py +0 -0
  201. {kospex-0.4.1 → kospex-0.4.2}/tests/test_deps_private.py +0 -0
  202. {kospex-0.4.1 → kospex-0.4.2}/tests/test_developer_stats_committer_time.py +0 -0
  203. {kospex-0.4.1 → kospex-0.4.2}/tests/test_developer_stats_sync.py +0 -0
  204. {kospex-0.4.1 → kospex-0.4.2}/tests/test_email_type.py +0 -0
  205. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extracted_file_keys.py +0 -0
  206. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractor_registry.py +0 -0
  207. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractor_unreadable_manifests.py +0 -0
  208. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_gomod.py +0 -0
  209. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_gradle.py +0 -0
  210. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_gradle_build.py +0 -0
  211. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_maven.py +0 -0
  212. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_npmlock.py +0 -0
  213. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_nuget.py +0 -0
  214. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_pnpm.py +0 -0
  215. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_uvlock.py +0 -0
  216. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_workflows.py +0 -0
  217. {kospex-0.4.1 → kospex-0.4.2}/tests/test_extractors_yarn.py +0 -0
  218. {kospex-0.4.1 → kospex-0.4.2}/tests/test_ff_only_pulls.py +0 -0
  219. {kospex-0.4.1 → kospex-0.4.2}/tests/test_file_metadata_repo_index.py +0 -0
  220. {kospex-0.4.1 → kospex-0.4.2}/tests/test_file_metadata_sync.py +0 -0
  221. {kospex-0.4.1 → kospex-0.4.2}/tests/test_files_page_links.py +0 -0
  222. {kospex-0.4.1 → kospex-0.4.2}/tests/test_generate_repo_id_endpoint.py +0 -0
  223. {kospex-0.4.1 → kospex-0.4.2}/tests/test_get_dependencies_latest.py +0 -0
  224. {kospex-0.4.1 → kospex-0.4.2}/tests/test_get_id_params.py +0 -0
  225. {kospex-0.4.1 → kospex-0.4.2}/tests/test_get_repo_authors_repo_id.py +0 -0
  226. {kospex-0.4.1 → kospex-0.4.2}/tests/test_github_auth_identity.py +0 -0
  227. {kospex-0.4.1 → kospex-0.4.2}/tests/test_github_dependabot.py +0 -0
  228. {kospex-0.4.1 → kospex-0.4.2}/tests/test_github_export.py +0 -0
  229. {kospex-0.4.1 → kospex-0.4.2}/tests/test_github_properties.py +0 -0
  230. {kospex-0.4.1 → kospex-0.4.2}/tests/test_github_token_matrix_runner.py +0 -0
  231. {kospex-0.4.1 → kospex-0.4.2}/tests/test_go_version_lookup.py +0 -0
  232. {kospex-0.4.1 → kospex-0.4.2}/tests/test_gomod_parsing.py +0 -0
  233. {kospex-0.4.1 → kospex-0.4.2}/tests/test_habitat_config.py +0 -0
  234. {kospex-0.4.1 → kospex-0.4.2}/tests/test_install_state_flags.py +0 -0
  235. {kospex-0.4.1 → kospex-0.4.2}/tests/test_interval_range_floor.py +0 -0
  236. {kospex-0.4.1 → kospex-0.4.2}/tests/test_key_person_cli.py +0 -0
  237. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit.py +0 -0
  238. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_clone_cli.py +0 -0
  239. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_clone_path_conflict.py +0 -0
  240. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_github_listing.py +0 -0
  241. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_pull.py +0 -0
  242. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_pull_stale.py +0 -0
  243. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_pull_sync.py +0 -0
  244. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_status.py +0 -0
  245. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kgit_sync_org_cli.py +0 -0
  246. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex.py +0 -0
  247. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex_bitbucket.py +0 -0
  248. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex_cli_upgrade_db.py +0 -0
  249. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex_github_paginate.py +0 -0
  250. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex_github_rate_limit.py +0 -0
  251. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex_github_token_env.py +0 -0
  252. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex_schema.py +0 -0
  253. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kospex_utils.py +0 -0
  254. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kreaper_dry_run.py +0 -0
  255. {kospex-0.4.1 → kospex-0.4.2}/tests/test_krunner_branches_missing_repo.py +0 -0
  256. {kospex-0.4.1 → kospex-0.4.2}/tests/test_krunner_filename.py +0 -0
  257. {kospex-0.4.1 → kospex-0.4.2}/tests/test_krunner_key_person_bus_factor.py +0 -0
  258. {kospex-0.4.1 → kospex-0.4.2}/tests/test_krunner_repo_size_summary.py +0 -0
  259. {kospex-0.4.1 → kospex-0.4.2}/tests/test_krunner_run_errors.py +0 -0
  260. {kospex-0.4.1 → kospex-0.4.2}/tests/test_krunner_scanner_security.py +0 -0
  261. {kospex-0.4.1 → kospex-0.4.2}/tests/test_krunner_todo.py +0 -0
  262. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kweb_help.py +0 -0
  263. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kweb_startup_db.py +0 -0
  264. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kweb_threadpool.py +0 -0
  265. {kospex-0.4.1 → kospex-0.4.2}/tests/test_kweb_trusted_host.py +0 -0
  266. {kospex-0.4.1 → kospex-0.4.2}/tests/test_last_commit_by_path.py +0 -0
  267. {kospex-0.4.1 → kospex-0.4.2}/tests/test_latest_commit_file_map.py +0 -0
  268. {kospex-0.4.1 → kospex-0.4.2}/tests/test_logging_sample_config.py +0 -0
  269. {kospex-0.4.1 → kospex-0.4.2}/tests/test_manifest_bom_handling.py +0 -0
  270. {kospex-0.4.1 → kospex-0.4.2}/tests/test_maven_bom_versions.py +0 -0
  271. {kospex-0.4.1 → kospex-0.4.2}/tests/test_merge_authorship.py +0 -0
  272. {kospex-0.4.1 → kospex-0.4.2}/tests/test_merge_file_rows.py +0 -0
  273. {kospex-0.4.1 → kospex-0.4.2}/tests/test_metadata_rebuild_guard.py +0 -0
  274. {kospex-0.4.1 → kospex-0.4.2}/tests/test_migration_banner_cli.py +0 -0
  275. {kospex-0.4.1 → kospex-0.4.2}/tests/test_npm_alias_lookup.py +0 -0
  276. {kospex-0.4.1 → kospex-0.4.2}/tests/test_npm_range.py +0 -0
  277. {kospex-0.4.1 → kospex-0.4.2}/tests/test_npm_range_floor.py +0 -0
  278. {kospex-0.4.1 → kospex-0.4.2}/tests/test_org_key_call_sites.py +0 -0
  279. {kospex-0.4.1 → kospex-0.4.2}/tests/test_org_key_encoding.py +0 -0
  280. {kospex-0.4.1 → kospex-0.4.2}/tests/test_org_sync.py +0 -0
  281. {kospex-0.4.1 → kospex-0.4.2}/tests/test_org_sync_command.py +0 -0
  282. {kospex-0.4.1 → kospex-0.4.2}/tests/test_org_sync_manifest.py +0 -0
  283. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_all_shares_extraction.py +0 -0
  284. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_dispatch.py +0 -0
  285. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_enrich_progress.py +0 -0
  286. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_extract_repo.py +0 -0
  287. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_extraction_view.py +0 -0
  288. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_lock.py +0 -0
  289. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_next_batch.py +0 -0
  290. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_next_cli.py +0 -0
  291. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_outcomes.py +0 -0
  292. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_queue.py +0 -0
  293. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_reads_disk_db.py +0 -0
  294. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_run_log.py +0 -0
  295. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_run_log_durability.py +0 -0
  296. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_runs_started_at.py +0 -0
  297. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_template.py +0 -0
  298. {kospex-0.4.1 → kospex-0.4.2}/tests/test_osi_time_budget.py +0 -0
  299. {kospex-0.4.1 → kospex-0.4.2}/tests/test_package_check_upload.py +0 -0
  300. {kospex-0.4.1 → kospex-0.4.2}/tests/test_panopticas_tag_contract.py +0 -0
  301. {kospex-0.4.1 → kospex-0.4.2}/tests/test_parse_datetime.py +0 -0
  302. {kospex-0.4.1 → kospex-0.4.2}/tests/test_prerelease.py +0 -0
  303. {kospex-0.4.1 → kospex-0.4.2}/tests/test_pull_org_resolve.py +0 -0
  304. {kospex-0.4.1 → kospex-0.4.2}/tests/test_py_modules_listed.py +0 -0
  305. {kospex-0.4.1 → kospex-0.4.2}/tests/test_pypi_assess_multi_specifier.py +0 -0
  306. {kospex-0.4.1 → kospex-0.4.2}/tests/test_pypi_declaration_parsing.py +0 -0
  307. {kospex-0.4.1 → kospex-0.4.2}/tests/test_pypi_range_floor.py +0 -0
  308. {kospex-0.4.1 → kospex-0.4.2}/tests/test_rebuild.py +0 -0
  309. {kospex-0.4.1 → kospex-0.4.2}/tests/test_remote_url_warning_stderr.py +0 -0
  310. {kospex-0.4.1 → kospex-0.4.2}/tests/test_repo_not_in_db.py +0 -0
  311. {kospex-0.4.1 → kospex-0.4.2}/tests/test_repo_org_header.py +0 -0
  312. {kospex-0.4.1 → kospex-0.4.2}/tests/test_repo_path_conflict.py +0 -0
  313. {kospex-0.4.1 → kospex-0.4.2}/tests/test_repos_by_tag.py +0 -0
  314. {kospex-0.4.1 → kospex-0.4.2}/tests/test_request_cache.py +0 -0
  315. {kospex-0.4.1 → kospex-0.4.2}/tests/test_requirements_encoding.py +0 -0
  316. {kospex-0.4.1 → kospex-0.4.2}/tests/test_requirements_type_mapping.py +0 -0
  317. {kospex-0.4.1 → kospex-0.4.2}/tests/test_resolution_status.py +0 -0
  318. {kospex-0.4.1 → kospex-0.4.2}/tests/test_rich_markup_neutralised.py +0 -0
  319. {kospex-0.4.1 → kospex-0.4.2}/tests/test_run_lock.py +0 -0
  320. {kospex-0.4.1 → kospex-0.4.2}/tests/test_sca_enriches_transitives.py +0 -0
  321. {kospex-0.4.1 → kospex-0.4.2}/tests/test_scope_resolution.py +0 -0
  322. {kospex-0.4.1 → kospex-0.4.2}/tests/test_set_params_by_id_scope.py +0 -0
  323. {kospex-0.4.1 → kospex-0.4.2}/tests/test_snyk_cli.py +0 -0
  324. {kospex-0.4.1 → kospex-0.4.2}/tests/test_snyk_client.py +0 -0
  325. {kospex-0.4.1 → kospex-0.4.2}/tests/test_snyk_queries.py +0 -0
  326. {kospex-0.4.1 → kospex-0.4.2}/tests/test_sqlite_floor.py +0 -0
  327. {kospex-0.4.1 → kospex-0.4.2}/tests/test_staleness.py +0 -0
  328. {kospex-0.4.1 → kospex-0.4.2}/tests/test_summary_circles.py +0 -0
  329. {kospex-0.4.1 → kospex-0.4.2}/tests/test_summary_statuses.py +0 -0
  330. {kospex-0.4.1 → kospex-0.4.2}/tests/test_supply_chain_unresolved.py +0 -0
  331. {kospex-0.4.1 → kospex-0.4.2}/tests/test_sync_directory_conflict.py +0 -0
  332. {kospex-0.4.1 → kospex-0.4.2}/tests/test_sync_repo_path_conflict.py +0 -0
  333. {kospex-0.4.1 → kospex-0.4.2}/tests/test_tags_index.py +0 -0
  334. {kospex-0.4.1 → kospex-0.4.2}/tests/test_tenure_empty_scope.py +0 -0
  335. {kospex-0.4.1 → kospex-0.4.2}/tests/test_unknown_id_404.py +0 -0
  336. {kospex-0.4.1 → kospex-0.4.2}/tests/test_url_cache_ttl.py +0 -0
  337. {kospex-0.4.1 → kospex-0.4.2}/tests/test_url_parsing_characterisation.py +0 -0
  338. {kospex-0.4.1 → kospex-0.4.2}/tests/test_version_constraint_columns.py +0 -0
  339. {kospex-0.4.1 → kospex-0.4.2}/tests/test_versions_behind_canonical.py +0 -0
  340. {kospex-0.4.1 → kospex-0.4.2}/tests/test_versions_behind_flavour.py +0 -0
  341. {kospex-0.4.1 → kospex-0.4.2}/tests/test_versions_behind_no_data.py +0 -0
  342. {kospex-0.4.1 → kospex-0.4.2}/tests/test_web_endpoints.py +0 -0
  343. {kospex-0.4.1 → kospex-0.4.2}/tests/test_where_tag_binding.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kospex
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: kospex - Code, Developer, Knowledge and Opensource Analytics.
5
5
  Author-email: Peter Freiberg <peter@kospex.io>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kospex"
7
- version = "0.4.1"
7
+ version = "0.4.2"
8
8
  description = "kospex - Code, Developer, Knowledge and Opensource Analytics."
9
9
  authors = [{ name = "Peter Freiberg", email = "peter@kospex.io" }]
10
10
  license = "MIT"
@@ -0,0 +1,6 @@
1
+ """Dependency analysis helpers for kospex.
2
+
3
+ Keep this file import-free: eager imports in package __init__ files have caused
4
+ circular imports with the flat kospex_* modules. Import submodules directly,
5
+ e.g. `from kospex.dependencies.version_diff import version_diff`.
6
+ """
@@ -0,0 +1,94 @@
1
+ """How far apart are two versions, by major / minor / patch? Pure: no I/O.
2
+
3
+ A rough, offline answer from the version numbers alone. It cannot say how many
4
+ releases sit between two versions -- for that, see
5
+ KospexDependencies.releases_between(), which reads deps.dev's version list.
6
+
7
+ Only the release numbers are compared. Pre-release and build tags
8
+ (`-rc.1`, `+build`, `.Final`, `-jre`) are ignored, so `1.2.3-rc.1` -> `1.2.3`
9
+ is "none". Missing components are 0, so `1.2` == `1.2.0`.
10
+
11
+ No semver meaning is applied: in semver a 0.x minor bump is breaking, and many
12
+ ecosystems (CalVer, Maven) do not follow semver at all. The level is the first
13
+ component that moved, nothing more.
14
+ """
15
+ import re
16
+
17
+ from packaging.version import InvalidVersion, Version
18
+
19
+ # Each repetition starts with a separator, so a digit run can match only one
20
+ # way and a failed match is linear (CWE-1333; versions come from deps.dev,
21
+ # where anyone can publish one).
22
+ _LEADING_NUMBERS = re.compile(r"[vV]?(\d+(?:\.\d+)*)")
23
+
24
+ LEVELS = ("major", "minor", "patch")
25
+
26
+
27
+ def parse_release(version, system=None):
28
+ """The release numbers of `version` as a tuple of ints, at least 3 long.
29
+
30
+ PyPI versions go through PEP 440 (`packaging`), which handles epochs
31
+ (`1!2.0`), `.postN` and `rcN` without separators. Everything else, and a
32
+ PyPI version `packaging` refuses, uses the leading dotted numbers after an
33
+ optional `v`. None when there is no leading number (`latest`, a range like
34
+ `^1.2.3` -- resolve a range to a version first).
35
+ """
36
+ if not isinstance(version, str):
37
+ return None
38
+ version = version.strip()
39
+ numbers = None
40
+ # ValueError as well as InvalidVersion: int() refuses a digit run longer
41
+ # than sys.get_int_max_str_digits() (4300), and anyone can publish a
42
+ # version. Unparseable, not an exception that ends a whole scan.
43
+ if (system or "").lower() == "pypi":
44
+ try:
45
+ numbers = Version(version).release
46
+ except (InvalidVersion, ValueError):
47
+ numbers = None
48
+ if numbers is None:
49
+ match = _LEADING_NUMBERS.match(version)
50
+ if not match:
51
+ return None
52
+ try:
53
+ numbers = tuple(int(n) for n in match.group(1).split("."))
54
+ except ValueError:
55
+ return None
56
+ return tuple(numbers) + (0,) * (3 - len(numbers))
57
+
58
+
59
+ def version_diff(from_version, to_version, system=None):
60
+ """Raw `to - from` per component: {"major", "minor", "patch"}, or None.
61
+
62
+ Raw means each component is subtracted on its own: 1.9.9 -> 3.0.0 is
63
+ {"major": 2, "minor": -9, "patch": -9}. A negative minor or patch under a
64
+ positive major is normal; use change_level() for the direction and level.
65
+ """
66
+ a = parse_release(from_version, system)
67
+ b = parse_release(to_version, system)
68
+ if a is None or b is None:
69
+ return None
70
+ return {level: b[i] - a[i] for i, level in enumerate(LEVELS)}
71
+
72
+
73
+ def level_between(a, b):
74
+ """change_level() over tuples parse_release() returned (first three components)."""
75
+ a3, b3 = a[:3], b[:3]
76
+ if b3 < a3:
77
+ return "downgrade"
78
+ for i, level in enumerate(LEVELS):
79
+ if a3[i] != b3[i]:
80
+ return level
81
+ return "none"
82
+
83
+
84
+ def change_level(from_version, to_version, system=None):
85
+ """"major", "minor", "patch", "none", "downgrade", or None if unparseable.
86
+
87
+ The first of major / minor / patch that differs. A fourth component (NuGet
88
+ `1.2.3.4`) is not a level of its own; a change only there reads "none".
89
+ """
90
+ a = parse_release(from_version, system)
91
+ b = parse_release(to_version, system)
92
+ if a is None or b is None:
93
+ return None
94
+ return level_between(a, b)
@@ -633,6 +633,21 @@ def refresh_listing(db, run_id, items):
633
633
  return counts
634
634
 
635
635
 
636
+ def items(db, run_id):
637
+ """A run's items, by repo id, each with `in_kospex` (1 when `repos` has it).
638
+
639
+ The per-row form of the join `inventory()` totals. Includes `gone` items:
640
+ callers that only want the current listing filter on status.
641
+ """
642
+ return list(db.query(f"""
643
+ SELECT i.*, (r._repo_id IS NOT NULL) AS in_kospex
644
+ FROM {TBL_ORG_SYNC_ITEMS} i
645
+ LEFT JOIN {TBL_REPOS} r ON r._repo_id = i._repo_id
646
+ WHERE i.run_id = ?
647
+ ORDER BY i._repo_id
648
+ """, [run_id]))
649
+
650
+
636
651
  def inventory(db, run_id):
637
652
  """What a run's listing holds, compared with what kospex already has.
638
653
 
@@ -187,15 +187,20 @@ def _continue_command(run, commands):
187
187
  return OrgSyncCommand.command(flag, parsed["org"], OrgSyncCommand.continuing(opts))
188
188
 
189
189
 
190
+ def _available(db):
191
+ """False on a DB from before migration 0013 (kweb never applies it)."""
192
+ tables = (OrgSyncManifest.TBL_ORG_SYNC_RUNS, OrgSyncManifest.TBL_ORG_SYNC_ITEMS,
193
+ OrgSyncManifest.TBL_ORG_SYNC_LISTINGS, OrgSyncManifest.TBL_ORG_SYNC_COMMANDS)
194
+ return all(db[name].exists() for name in tables)
195
+
196
+
190
197
  def org_runs(db, *, org, server, now):
191
198
  """The Org syncs tab: runs latest first, with their commands and listings.
192
199
 
193
200
  `available` is False on a DB from before migration 0013, which kweb never
194
201
  applies itself: the page says to run `kospex upgrade-db` instead.
195
202
  """
196
- tables = (OrgSyncManifest.TBL_ORG_SYNC_RUNS, OrgSyncManifest.TBL_ORG_SYNC_ITEMS,
197
- OrgSyncManifest.TBL_ORG_SYNC_LISTINGS, OrgSyncManifest.TBL_ORG_SYNC_COMMANDS)
198
- if not all(db[name].exists() for name in tables):
203
+ if not _available(db):
199
204
  return {"available": False, "runs": []}
200
205
  sql = f"SELECT * FROM {OrgSyncManifest.TBL_ORG_SYNC_RUNS}"
201
206
  params = []
@@ -227,3 +232,49 @@ def org_runs(db, *, org, server, now):
227
232
  if row["run_id"] == run_id],
228
233
  "continue_command": _continue_command(run, commands)})
229
234
  return {"available": True, "runs": runs}
235
+
236
+
237
+ # --- one run: /syncs/run/{run_id} --------------------------------------------
238
+ # Design: changes/202611-kweb-sync-run.md
239
+
240
+ # The order statuses appear in the page's filter.
241
+ FILTER_STATUSES = (OrgSyncManifest.FAILED, OrgSyncManifest.SKIPPED,
242
+ OrgSyncManifest.PENDING, OrgSyncManifest.IN_PROGRESS,
243
+ OrgSyncManifest.SYNCED, OrgSyncManifest.GONE)
244
+
245
+
246
+ def run_view(db, run_id):
247
+ """One run: its header, counts, items and drift.
248
+
249
+ Returns `{"available": False}` on a DB from before migration 0013. Raises
250
+ KeyError for an unknown run. Drift and the private count come from
251
+ `inventory()`, as `kgit sync -inventory` reports them, so they count only
252
+ the current listing, not `gone` items.
253
+ """
254
+ if not _available(db):
255
+ return {"available": False}
256
+ run = next(iter(db.query(
257
+ f"SELECT * FROM {OrgSyncManifest.TBL_ORG_SYNC_RUNS} WHERE run_id = ?", [run_id])),
258
+ None)
259
+ if run is None:
260
+ raise KeyError(f"No run {run_id}")
261
+ inventory = OrgSyncManifest.inventory(db, run_id)
262
+ counts = OrgSyncManifest.run_counts(db, run_id)
263
+ rows = OrgSyncManifest.items(db, run_id)
264
+ for row in rows:
265
+ row["gone"] = row["status"] == OrgSyncManifest.GONE
266
+ row["pushed_date"] = (row.get("pushed_at") or "")[:10]
267
+ source = row.get("fork_source")
268
+ row["fork_source_shown"] = (source if source and source != row.get("fork_parent")
269
+ else None)
270
+ parsed = KospexUtils.parse_org_key(run["org_key"])
271
+ return {"available": True, "run": run,
272
+ "owner": parsed["org"] if parsed else run["org_key"],
273
+ "listed_at": OrgSyncManifest.listed_at(db, run_id),
274
+ "counts": counts,
275
+ "filters": [(s, counts[s]) for s in FILTER_STATUSES if counts[s]],
276
+ "rows": rows, # not "items": Jinja would read page.items as dict.items
277
+ "drift": inventory["gone"],
278
+ "private": inventory["private"], "listed": inventory["listed"],
279
+ "continue_command": _continue_command(
280
+ run, OrgSyncManifest.commands(db, run_id))}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kospex
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: kospex - Code, Developer, Knowledge and Opensource Analytics.
5
5
  Author-email: Peter Freiberg <peter@kospex.io>
6
6
  License-Expression: MIT
@@ -78,6 +78,8 @@ src/kospex/db/migrations/0013_org_sync_listings.py
78
78
  src/kospex/db/migrations/0013_org_sync_listings.sql
79
79
  src/kospex/db/migrations/README.md
80
80
  src/kospex/db/migrations/__init__.py
81
+ src/kospex/dependencies/__init__.py
82
+ src/kospex/dependencies/version_diff.py
81
83
  src/kospex/extractors/__init__.py
82
84
  src/kospex/extractors/constraints.py
83
85
  src/kospex/extractors/errors.py
@@ -155,6 +157,7 @@ src/templates/summary2.html
155
157
  src/templates/supply_chain.html
156
158
  src/templates/supply_chain_search.html
157
159
  src/templates/syncs.html
160
+ src/templates/syncs_run.html
158
161
  src/templates/tags.html
159
162
  src/templates/tech-change.html
160
163
  src/templates/tenure.html
@@ -163,6 +166,7 @@ src/templates/help/index.html
163
166
  tests/test_advisory_history_stub.py
164
167
  tests/test_assess_registry_dispatch.py
165
168
  tests/test_assessment_types.py
169
+ tests/test_behind_fields.py
166
170
  tests/test_build_file_metadata_rows.py
167
171
  tests/test_ca_bundle.py
168
172
  tests/test_clone_repo.py
@@ -328,6 +332,7 @@ tests/test_unknown_id_404.py
328
332
  tests/test_url_cache_ttl.py
329
333
  tests/test_url_parsing_characterisation.py
330
334
  tests/test_version_constraint_columns.py
335
+ tests/test_version_diff.py
331
336
  tests/test_versions_behind_canonical.py
332
337
  tests/test_versions_behind_flavour.py
333
338
  tests/test_versions_behind_no_data.py
@@ -27,6 +27,7 @@ import krunner_utils as KrunnerUtils
27
27
  from kospex.db import Migrator
28
28
  from kospex.habitat_config import HabitatConfig
29
29
  from kospex.db.migrator import warn_if_behind
30
+ from kospex.dependencies import version_diff as vdiff
30
31
  from kospex.extractors.registry import package_types
31
32
  from kospex.integrations.snyk.cli import snyk
32
33
  from kospex_core import GitRepo, Kospex, RepoPathConflict
@@ -933,6 +934,46 @@ def _sca_package(package_spec, file_path, save, out, as_json):
933
934
  console.print()
934
935
 
935
936
 
937
+ def _upgrade_path_lines(version, behind, system=None):
938
+ """Lines describing the upgrade path from `version` (already
939
+ terminal-safe) to the latest release, from behind_fields(); [] when it was
940
+ not measured or there is no gap. deps.dev text goes through
941
+ terminal_safe() (CWE-150).
942
+
943
+ The total of releases in between (behind_releases) is left to the CSV:
944
+ beside the published-between count above it, a third number read as a
945
+ contradiction.
946
+ """
947
+ safe = KospexUtils.terminal_safe
948
+ level = behind.get("behind_level")
949
+ if level not in ("major", "minor", "patch"):
950
+ return []
951
+
952
+ steps = [f"{behind[f'behind_{name}']} {name}"
953
+ for name in ("major", "minor", "patch", "other") if behind.get(f"behind_{name}")]
954
+ listed = steps[0] if len(steps) == 1 else f"{', '.join(steps[:-1])} and {steps[-1]}"
955
+ total = sum(behind.get(f"behind_{name}") or 0
956
+ for name in ("major", "minor", "patch", "other"))
957
+ lines = [f"Upgrade path to {safe(behind['latest_version'])}: "
958
+ f"{listed} release{'' if total == 1 else 's'}."]
959
+ if level != "major":
960
+ # The latest is on this major, so the line below would repeat the one above.
961
+ return lines
962
+
963
+ numbers = vdiff.parse_release(behind.get("latest_on_major") or version, system)
964
+ line = f"{numbers[0]}.x" if numbers else "its major"
965
+ on_major = behind.get("behind_on_major")
966
+ if on_major:
967
+ newest = behind["latest_on_major"]
968
+ step = vdiff.change_level(version, newest, system)
969
+ size = f", a {step} upgrade" if step in vdiff.LEVELS else ""
970
+ lines.append(f"Without a major upgrade: {version} → {safe(newest)}{size} "
971
+ f"({on_major} newer {line} release{'' if on_major == 1 else 's'}).")
972
+ else:
973
+ lines.append(f"{version} is the latest {line}; any upgrade from here is a major one.")
974
+ return lines
975
+
976
+
936
977
  def _print_requested_version(package_type, package_name, requested):
937
978
  """The lines under the Releases table for `-package TYPE:NAME@VERSION`.
938
979
 
@@ -954,8 +995,13 @@ def _print_requested_version(package_type, package_name, requested):
954
995
  elif behind == 0:
955
996
  console.print(f"{version} is the latest release.")
956
997
  else:
957
- console.print(f"{version} is {behind} release{'' if behind == 1 else 's'} "
958
- f"behind the latest ({latest}).")
998
+ # Publish order, so it counts fixes to older lines released in that
999
+ # window (react's 15.7.0) and not ones released after the latest.
1000
+ console.print(f"{behind} release{' was' if behind == 1 else 's were'} published "
1001
+ f"between {version} and the latest ({latest}), including any "
1002
+ "fixes to older lines.")
1003
+ for line in _upgrade_path_lines(version, requested.get("behind") or {}, package_type):
1004
+ console.print(line)
959
1005
  if requested["is_deprecated"]:
960
1006
  reason = safe(requested["deprecated_reason"])
961
1007
  console.print(f"{version} is deprecated{': ' + reason if reason else '.'}")
@@ -987,7 +1033,8 @@ def _print_requested_version(package_type, package_name, requested):
987
1033
  if any(a["cvss3_score"] is None for a in advisories):
988
1034
  console.print("CVSS 3 '-' means deps.dev has no CVSS 3 score; the advisory may "
989
1035
  "be scored under CVSS 4. Check its severity on osv.dev.")
990
- console.print("Details: https://osv.dev/vulnerability/ADVISORY")
1036
+ console.print("Look up an advisory at "
1037
+ "https://osv.dev/vulnerability/<ID from the Advisory column>")
991
1038
 
992
1039
 
993
1040
  @cli.command("sca")
@@ -32,6 +32,7 @@ from kospex.extractors.npmlock import npm_alias_target
32
32
  from kospex.extractors.registry import classify, resolve_parser
33
33
  from kospex.npm_range import min_satisfying, parse_range, satisfies
34
34
  from kospex.prerelease import is_prerelease
35
+ from kospex.dependencies import version_diff as vdiff
35
36
  import kospex_utils as KospexUtils
36
37
  from kospex_git import KospexGit
37
38
 
@@ -624,12 +625,19 @@ class KospexDependencies:
624
625
  advisories describe -- for a range, not the declared text (`^1` is
625
626
  checked at 1.12.0). `resolution` says why a row's numbers are blank
626
627
  (`no_satisfying_version`, `version_yanked`, ...).
628
+
629
+ `latest_version` and `behind` are the upgrade path from the version
630
+ checked to the latest release (behind_fields()). `behind` is composed
631
+ from the behind_* fields -- `major (3/8/4)` is a major change, along a
632
+ path of 3 major, 8 minor and 4 patch releases -- see _field_value().
627
633
  """
628
634
  return [
629
635
  "package_name",
630
636
  "package_version",
631
637
  "resolved_version",
632
638
  "versions_behind",
639
+ "latest_version",
640
+ "behind",
633
641
  "days_ago",
634
642
  "published_at",
635
643
  "default",
@@ -641,13 +649,33 @@ class KospexDependencies:
641
649
  # Columns rendered right-aligned; everything else is left-aligned.
642
650
  _NUMERIC_TABLE_FIELDS = frozenset({
643
651
  "package_version", "resolved_version", "versions_behind", "days_ago",
644
- "default", "advisories",
652
+ "default", "advisories", "latest_version",
645
653
  })
646
654
 
647
655
  # Table headers that differ from the field name. -json and -out keep the
648
656
  # field name, which is the dependency_data column; the table says what it
649
657
  # means, as the /dependencies/ page does.
650
- _TABLE_HEADERS = {"resolved_version": "checked at"}
658
+ _TABLE_HEADERS = {"resolved_version": "checked at", "latest_version": "latest",
659
+ "behind": "behind (M/m/p)"}
660
+
661
+ @staticmethod
662
+ def behind_label(record):
663
+ """`behind` for one record: the level, with the upgrade path's major /
664
+ minor / patch counts when there is a gap -- `major (3/8/4)`, `none`,
665
+ `ahead` -- or None when it was not measured."""
666
+ level = record.get("behind_level")
667
+ if level in (None, "", "none", "ahead"):
668
+ return level or None
669
+ counts = "/".join(str(record.get(f"behind_{name}") or 0)
670
+ for name in ("major", "minor", "patch"))
671
+ return f"{level} ({counts})"
672
+
673
+ @classmethod
674
+ def _field_value(cls, record, field):
675
+ """A table field of a record: the stored value, or a composed one."""
676
+ if field == "behind":
677
+ return cls.behind_label(record)
678
+ return record.get(field)
651
679
 
652
680
  def get_cli_table(self):
653
681
  """Return an empty rich Table with the dependency columns."""
@@ -679,7 +707,10 @@ class KospexDependencies:
679
707
  for rec in records:
680
708
  # Text, not str: a str cell is parsed as rich markup, which would
681
709
  # swallow the `[python]` of a package declared with extras.
682
- table.add_row(*(Text(self._display_value(rec.get(f))) for f in fields))
710
+ # terminal_safe (CWE-150): versions, dates and source repos come
711
+ # from deps.dev and the manifest, and rich passes ESC through.
712
+ table.add_row(*(Text(KospexUtils.terminal_safe(
713
+ self._display_value(self._field_value(rec, f)))) for f in fields))
683
714
  (console or Console()).print(table)
684
715
 
685
716
  def table_rows(self, records):
@@ -691,7 +722,7 @@ class KospexDependencies:
691
722
  the seed -- it must not reach JSON as a string in a numeric field.
692
723
  """
693
724
  fields = self.get_table_field_names()
694
- return [{f: None if rec.get(f) == "" else rec.get(f) for f in fields}
725
+ return [{f: None if (v := self._field_value(rec, f)) == "" else v for f in fields}
695
726
  for rec in records]
696
727
 
697
728
  @staticmethod
@@ -1183,12 +1214,22 @@ class KospexDependencies:
1183
1214
  return "gradle"
1184
1215
  return package_type
1185
1216
 
1217
+ # How far a version is behind the latest release, by level along the upgrade
1218
+ # path (behind_fields()). Written to the `krunner osi` CSV and shown by
1219
+ # `kospex sca`, but not stored: they become columns with the package facts
1220
+ # tables (changes/202611-package-facts-tables.md), not dependency_data ones.
1221
+ BEHIND_FIELDS = (
1222
+ "latest_version", "behind_level", "behind_major", "behind_minor",
1223
+ "behind_patch", "behind_other", "behind_releases", "behind_on_major",
1224
+ "latest_on_major",
1225
+ )
1226
+
1186
1227
  # Extractor-only template fields produced by the leaf parsers that are
1187
1228
  # NOT columns in TBL_DEPENDENCY_DATA and must be stripped before upsert.
1188
1229
  _NON_SCHEMA_FIELDS = (
1189
1230
  "days_ago", "authors", "ecosystem", "semantic",
1190
1231
  "extras", "requirements_type", "version_type",
1191
- )
1232
+ ) + BEHIND_FIELDS
1192
1233
 
1193
1234
  def save_preconditions(self, filename):
1194
1235
  """Reasons `kospex sca -save` must refuse to write `filename`, or [].
@@ -1538,9 +1579,17 @@ class KospexDependencies:
1538
1579
  # Handed to lookup_dependency(), which records it as resolved_version
1539
1580
  # and removes it from the record (it is not a dependency_data column).
1540
1581
  details["depsdev_version"] = canonical
1541
- days_info = self.get_versions_behind(package_type, package_name, canonical)
1582
+ # One package listing for both counts, so they describe the same list.
1583
+ # None (a failed fetch) is not passed on: get_versions_behind() would
1584
+ # take it as "fetch it yourself" and ask deps.dev a second time.
1585
+ releases = self.release_list(package_type, package_name)
1586
+ days_info = {}
1587
+ if releases is not None:
1588
+ days_info = self.get_versions_behind(package_type, package_name, canonical,
1589
+ releases=releases)
1542
1590
  versions_behind = days_info.get("versions_behind")
1543
1591
  details["versions_behind"] = versions_behind if isinstance(versions_behind, int) else None
1592
+ details.update(self.behind_fields(package_type, package_name, canonical, releases))
1544
1593
  details["authors"] = None
1545
1594
  if details["source_repo"]:
1546
1595
  details["authors"] = self.get_repo_authors(details["source_repo"])
@@ -2220,6 +2269,7 @@ class KospexDependencies:
2220
2269
  - `versions_behind`: get_versions_behind(); None when unknown (a
2221
2270
  pre-release, or a version missing from the package's list).
2222
2271
  - `latest_version`: _latest_release(), where that count starts.
2272
+ - `behind`: behind_fields(), the upgrade path to that latest release.
2223
2273
  - `advisories`: advisories(), one entry per vulnerability.
2224
2274
  - `advisory_ids`: how many IDs deps.dev lists, before aliases merge.
2225
2275
  """
@@ -2247,6 +2297,7 @@ class KospexDependencies:
2247
2297
  or (listed["deprecated_reason"] if listed else "")),
2248
2298
  "versions_behind": behind.get("versions_behind"),
2249
2299
  "latest_version": latest["version"] if latest else None,
2300
+ "behind": self.behind_fields(package_type, package_name, canonical, releases),
2250
2301
  "advisories": self.advisories(ids),
2251
2302
  "advisory_ids": len(ids),
2252
2303
  }, status
@@ -2309,6 +2360,156 @@ class KospexDependencies:
2309
2360
  by_id[alias] = entry
2310
2361
  return merged
2311
2362
 
2363
+ @classmethod
2364
+ def empty_behind_fields(cls):
2365
+ """BEHIND_FIELDS, all None: a row not looked up, or not measurable."""
2366
+ return dict.fromkeys(cls.BEHIND_FIELDS)
2367
+
2368
+ def behind_fields(self, package_type, package_name, version, releases=None):
2369
+ """BEHIND_FIELDS for `version` against the latest release, from
2370
+ releases_between(); every key is present, None when unknown.
2371
+
2372
+ `behind_level` is major / minor / patch / none, or `ahead` when
2373
+ `version` is above kospex's latest (deps.dev's default can trail a
2374
+ release). The counts are the upgrade path's; `behind_releases` is every
2375
+ release in between. A pre-release in use gives all None, as
2376
+ versions_behind does: release numbers alone would read `1.2.3-rc.1` as
2377
+ 1.2.3.
2378
+ """
2379
+ fields = self.empty_behind_fields()
2380
+ if not version or is_prerelease(package_type, version):
2381
+ return fields
2382
+ between = self.releases_between(package_type, package_name, version,
2383
+ releases=releases)
2384
+ if between is None:
2385
+ return fields
2386
+ fields["latest_version"] = between["to"]
2387
+ if between["level"] == "downgrade":
2388
+ fields["behind_level"] = "ahead"
2389
+ return fields
2390
+ fields.update({
2391
+ "behind_level": between["level"],
2392
+ "behind_major": between["major"],
2393
+ "behind_minor": between["minor"],
2394
+ "behind_patch": between["patch"],
2395
+ "behind_other": between["other"],
2396
+ "behind_releases": between["releases"],
2397
+ "behind_on_major": between["on_major"],
2398
+ "latest_on_major": between["latest_on_major"],
2399
+ })
2400
+ return fields
2401
+
2402
+ def releases_between(self, package_type, package_name, from_version, to_version=None,
2403
+ releases=None):
2404
+ """The releases deps.dev lists after `from_version`, up to `to_version`,
2405
+ counted by level along the upgrade path: the online counterpart of
2406
+ kospex.dependencies.version_diff.
2407
+
2408
+ `to_version` defaults to _latest_release() -- deps.dev's default, or the
2409
+ highest release by version when the default is a pre-release or missing
2410
+ -- so it agrees with versions_behind and `sca -package`'s Latest.
2411
+
2412
+ Releases in (from, to] are taken in **version** order, not publish
2413
+ order. Pre-releases are skipped, and a Maven flavour (`-jre`,
2414
+ `-android`) counts only its own flavour's releases.
2415
+
2416
+ `major` / `minor` / `patch` / `other` count the **upgrade path**: the
2417
+ first release of every minor line, plus the patches of the newest minor
2418
+ line of each major. Patches to a minor line that a newer one superseded
2419
+ are maintenance an upgrade never installs: react 16.12.0 -> 19.3.1 lists
2420
+ 44 releases, 19 of them fixes to 19.0.x and 19.1.x published after 19.2.0,
2421
+ and the path is 3 major, 8 minor and 4 patch. Each path release is
2422
+ classified against the one before it. `other` is a step that moves only
2423
+ a fourth component (NuGet `1.2.3.1`), so the four counts sum to
2424
+ len(`path`).
2425
+
2426
+ Also returned: `level` and `diff` (change_level / version_diff of the
2427
+ two versions), `releases` and `versions` (every release in range, oldest
2428
+ first), `path` (the path releases), and `on_major` /
2429
+ `latest_on_major` (releases newer than `from_version` on its own major,
2430
+ and the highest of them, or None).
2431
+
2432
+ `releases` is a release_list() the caller already has, as for
2433
+ get_versions_behind(). Neither version has to be in deps.dev's list: the
2434
+ bounds are compared by number. On a downgrade nothing is counted. None when deps.dev has no
2435
+ record or a version has no leading number.
2436
+ """
2437
+ if releases is None:
2438
+ releases = self.release_list(package_type, package_name)
2439
+ if releases is None:
2440
+ return None
2441
+ stable = [r for r in releases if not r["is_prerelease"]]
2442
+
2443
+ if to_version is None:
2444
+ anchor = self._latest_release(package_type, releases)
2445
+ if anchor is None:
2446
+ return None
2447
+ to_version = anchor["version"]
2448
+ flavour = self._maven_flavour(package_type, from_version)
2449
+ if flavour and not to_version.endswith(flavour):
2450
+ base = self._without_flavour(to_version)
2451
+ twin = next((r for r in stable if r["version"] == base + flavour), None)
2452
+ to_version = twin["version"] if twin else to_version
2453
+
2454
+ lo = vdiff.parse_release(from_version, package_type)
2455
+ hi = vdiff.parse_release(to_version, package_type)
2456
+ if lo is None or hi is None:
2457
+ return None
2458
+
2459
+ result = {
2460
+ "from": from_version,
2461
+ "to": to_version,
2462
+ "level": vdiff.change_level(from_version, to_version, package_type),
2463
+ "diff": vdiff.version_diff(from_version, to_version, package_type),
2464
+ "major": 0, "minor": 0, "patch": 0, "other": 0,
2465
+ "releases": 0, "versions": [], "path": [],
2466
+ "on_major": 0, "latest_on_major": None,
2467
+ }
2468
+ if result["level"] == "downgrade":
2469
+ return result
2470
+
2471
+ flavour = self._maven_flavour(package_type, from_version)
2472
+ parsed = []
2473
+ for r in stable:
2474
+ if self._maven_flavour(package_type, r["version"]) != flavour:
2475
+ continue
2476
+ numbers = vdiff.parse_release(r["version"], package_type)
2477
+ if numbers is not None:
2478
+ parsed.append((numbers, r["version"]))
2479
+ width = max([len(lo), len(hi)] + [len(n) for n, _ in parsed])
2480
+
2481
+ def pad(t):
2482
+ return t + (0,) * (width - len(t))
2483
+
2484
+ between = sorted((pad(n), v) for n, v in parsed if pad(lo) < pad(n) <= pad(hi))
2485
+ result["versions"] = [v for _, v in between]
2486
+ result["releases"] = len(between)
2487
+
2488
+ on_major = [v for n, v in between if n[0] == lo[0]]
2489
+ result["on_major"] = len(on_major)
2490
+ result["latest_on_major"] = on_major[-1] if on_major else None
2491
+
2492
+ # Newest minor line of each major within range, and the first release of
2493
+ # each minor line (between is sorted, so the first seen is the lowest).
2494
+ newest_minor = {}
2495
+ first_of_line = {}
2496
+ for n, v in between:
2497
+ newest_minor[n[0]] = max(newest_minor.get(n[0], n[1]), n[1])
2498
+ first_of_line.setdefault(n[:2], v)
2499
+
2500
+ previous = pad(lo)
2501
+ for n, v in between:
2502
+ # The line in use is not a new line: its next release is a patch,
2503
+ # on the path only if no newer minor superseded the line.
2504
+ starts_line = first_of_line[n[:2]] == v and n[:2] != pad(lo)[:2]
2505
+ if not starts_line and n[1] != newest_minor[n[0]]:
2506
+ continue
2507
+ level = vdiff.level_between(previous, n)
2508
+ result[level if level in vdiff.LEVELS else "other"] += 1
2509
+ result["path"].append(v)
2510
+ previous = n
2511
+ return result
2512
+
2312
2513
  # Maven artifacts published in parallel flavours: Guava's -jre / -android.
2313
2514
  _MAVEN_FLAVOURS = ("-jre", "-android")
2314
2515
 
@@ -162,6 +162,8 @@ def enrich_dependency_records(results, kdeps, echo=None, progress=None, enrich=T
162
162
  for d in results:
163
163
  d.update(KospexDependencies.unlooked_fields(
164
164
  d.get("package_type"), d.get("package_name")))
165
+ # Same keys as an enriched row, empty: the CSV header is row 0's.
166
+ d.update(KospexDependencies.empty_behind_fields())
165
167
  d["package_use"] = _REQ_TO_USE.get(
166
168
  d.get("requirements_type", ""), KospexSchema.PACKAGE_USE_UNKNOWN)
167
169
  return results
@@ -211,6 +213,14 @@ def enrich_dependency_records(results, kdeps, echo=None, progress=None, enrich=T
211
213
  # `peer` and `optional` went unnoticed in 497 rows.
212
214
  d["package_use"] = _REQ_TO_USE.get(
213
215
  d.get("requirements_type", ""), KospexSchema.PACKAGE_USE_UNKNOWN)
216
+ # The upgrade path to the latest release. CSV only: save_dependencies()
217
+ # strips these (_NON_SCHEMA_FIELDS). Last, so they are the CSV's last
218
+ # columns and a reader indexing the earlier ones is unaffected. On every
219
+ # row, None when not measured: write_dict_to_csv takes its header from
220
+ # row 0, and DictWriter raises on a later row with extra keys.
221
+ for field in KospexDependencies.BEHIND_FIELDS:
222
+ d.pop(field, None)
223
+ d[field] = deps_rec.get(field)
214
224
 
215
225
  # Not on the final package: the caller's own per-repo line reports the
216
226
  # total immediately afterwards, so a "312 of 312" here would just repeat it.