matchbox-db 0.7.14.dev45__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 (243) hide show
  1. matchbox_db-0.7.14.dev45/.github/pull_request_template.md +25 -0
  2. matchbox_db-0.7.14.dev45/.github/workflows/ci.yml +132 -0
  3. matchbox_db-0.7.14.dev45/.github/workflows/codeql.yml +49 -0
  4. matchbox_db-0.7.14.dev45/.github/workflows/prerelease.yml +110 -0
  5. matchbox_db-0.7.14.dev45/.github/workflows/release.yml +208 -0
  6. matchbox_db-0.7.14.dev45/.gitignore +209 -0
  7. matchbox_db-0.7.14.dev45/.pre-commit-config.yaml +41 -0
  8. matchbox_db-0.7.14.dev45/.vscode/launch.json +37 -0
  9. matchbox_db-0.7.14.dev45/.vscode/settings.json +14 -0
  10. matchbox_db-0.7.14.dev45/CODEOWNERS +1 -0
  11. matchbox_db-0.7.14.dev45/LICENSE +21 -0
  12. matchbox_db-0.7.14.dev45/PKG-INFO +103 -0
  13. matchbox_db-0.7.14.dev45/README.md +60 -0
  14. matchbox_db-0.7.14.dev45/docker-compose.yml +108 -0
  15. matchbox_db-0.7.14.dev45/docs/api/client/dags.md +18 -0
  16. matchbox_db-0.7.14.dev45/docs/api/client/eval.md +33 -0
  17. matchbox_db-0.7.14.dev45/docs/api/client/index.md +24 -0
  18. matchbox_db-0.7.14.dev45/docs/api/client/locations.md +17 -0
  19. matchbox_db-0.7.14.dev45/docs/api/client/models.md +17 -0
  20. matchbox_db-0.7.14.dev45/docs/api/client/queries.md +18 -0
  21. matchbox_db-0.7.14.dev45/docs/api/client/results.md +21 -0
  22. matchbox_db-0.7.14.dev45/docs/api/client/sources.md +17 -0
  23. matchbox_db-0.7.14.dev45/docs/api/common/arrow.md +17 -0
  24. matchbox_db-0.7.14.dev45/docs/api/common/db.md +17 -0
  25. matchbox_db-0.7.14.dev45/docs/api/common/dtos.md +17 -0
  26. matchbox_db-0.7.14.dev45/docs/api/common/eval.md +17 -0
  27. matchbox_db-0.7.14.dev45/docs/api/common/exceptions.md +17 -0
  28. matchbox_db-0.7.14.dev45/docs/api/common/factories/entities.md +17 -0
  29. matchbox_db-0.7.14.dev45/docs/api/common/factories/index.md +238 -0
  30. matchbox_db-0.7.14.dev45/docs/api/common/factories/models.md +17 -0
  31. matchbox_db-0.7.14.dev45/docs/api/common/factories/scenarios.md +17 -0
  32. matchbox_db-0.7.14.dev45/docs/api/common/factories/sources.md +17 -0
  33. matchbox_db-0.7.14.dev45/docs/api/common/hash.md +17 -0
  34. matchbox_db-0.7.14.dev45/docs/api/common/index.md +17 -0
  35. matchbox_db-0.7.14.dev45/docs/api/common/logging.md +17 -0
  36. matchbox_db-0.7.14.dev45/docs/api/common/transform.md +17 -0
  37. matchbox_db-0.7.14.dev45/docs/api/server/api.md +14 -0
  38. matchbox_db-0.7.14.dev45/docs/api/server/backends/postgresql.md +161 -0
  39. matchbox_db-0.7.14.dev45/docs/api/server/index.md +44 -0
  40. matchbox_db-0.7.14.dev45/docs/api/server/uploads.md +14 -0
  41. matchbox_db-0.7.14.dev45/docs/assets/matchbox-icon-dark.png +0 -0
  42. matchbox_db-0.7.14.dev45/docs/assets/matchbox-icon.svg +9 -0
  43. matchbox_db-0.7.14.dev45/docs/assets/matchbox-logo-dark.svg +17 -0
  44. matchbox_db-0.7.14.dev45/docs/assets/matchbox-logo-light.svg +17 -0
  45. matchbox_db-0.7.14.dev45/docs/client/cli.md +50 -0
  46. matchbox_db-0.7.14.dev45/docs/client/evaluation.md +114 -0
  47. matchbox_db-0.7.14.dev45/docs/client/explore-dags.md +12 -0
  48. matchbox_db-0.7.14.dev45/docs/client/install.md +14 -0
  49. matchbox_db-0.7.14.dev45/docs/client/link-data.md +557 -0
  50. matchbox_db-0.7.14.dev45/docs/client/look-up.md +36 -0
  51. matchbox_db-0.7.14.dev45/docs/contributing.md +168 -0
  52. matchbox_db-0.7.14.dev45/docs/index.md +33 -0
  53. matchbox_db-0.7.14.dev45/docs/server/concepts.md +224 -0
  54. matchbox_db-0.7.14.dev45/docs/server/install.md +29 -0
  55. matchbox_db-0.7.14.dev45/docs/server/risks.md +53 -0
  56. matchbox_db-0.7.14.dev45/docs/stylesheets/extra.css +30 -0
  57. matchbox_db-0.7.14.dev45/docs/use-cases.md +25 -0
  58. matchbox_db-0.7.14.dev45/environments/containers.env +5 -0
  59. matchbox_db-0.7.14.dev45/environments/development.env +47 -0
  60. matchbox_db-0.7.14.dev45/environments/sample_client.env +5 -0
  61. matchbox_db-0.7.14.dev45/environments/sample_server.env +24 -0
  62. matchbox_db-0.7.14.dev45/justfile +35 -0
  63. matchbox_db-0.7.14.dev45/mkdocs.yml +163 -0
  64. matchbox_db-0.7.14.dev45/pyproject.toml +158 -0
  65. matchbox_db-0.7.14.dev45/setup.cfg +4 -0
  66. matchbox_db-0.7.14.dev45/src/matchbox/__init__.py +19 -0
  67. matchbox_db-0.7.14.dev45/src/matchbox/client/__init__.py +9 -0
  68. matchbox_db-0.7.14.dev45/src/matchbox/client/_handler.py +610 -0
  69. matchbox_db-0.7.14.dev45/src/matchbox/client/_settings.py +67 -0
  70. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/__init__.py +1 -0
  71. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/auth.py +15 -0
  72. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/__init__.py +5 -0
  73. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/app.py +415 -0
  74. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/modals.py +84 -0
  75. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/run.py +120 -0
  76. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/styles.tcss +184 -0
  77. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/widgets/__init__.py +1 -0
  78. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/widgets/assignment.py +72 -0
  79. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/widgets/styling.py +75 -0
  80. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/eval/widgets/table.py +293 -0
  81. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/main.py +27 -0
  82. matchbox_db-0.7.14.dev45/src/matchbox/client/cli/server.py +27 -0
  83. matchbox_db-0.7.14.dev45/src/matchbox/client/dags.py +617 -0
  84. matchbox_db-0.7.14.dev45/src/matchbox/client/eval/__init__.py +25 -0
  85. matchbox_db-0.7.14.dev45/src/matchbox/client/eval/samples.py +242 -0
  86. matchbox_db-0.7.14.dev45/src/matchbox/client/locations.py +323 -0
  87. matchbox_db-0.7.14.dev45/src/matchbox/client/models/__init__.py +10 -0
  88. matchbox_db-0.7.14.dev45/src/matchbox/client/models/comparison.py +55 -0
  89. matchbox_db-0.7.14.dev45/src/matchbox/client/models/dedupers/__init__.py +5 -0
  90. matchbox_db-0.7.14.dev45/src/matchbox/client/models/dedupers/base.py +43 -0
  91. matchbox_db-0.7.14.dev45/src/matchbox/client/models/dedupers/naive.py +76 -0
  92. matchbox_db-0.7.14.dev45/src/matchbox/client/models/linkers/__init__.py +9 -0
  93. matchbox_db-0.7.14.dev45/src/matchbox/client/models/linkers/base.py +48 -0
  94. matchbox_db-0.7.14.dev45/src/matchbox/client/models/linkers/deterministic.py +233 -0
  95. matchbox_db-0.7.14.dev45/src/matchbox/client/models/linkers/splinklinker.py +256 -0
  96. matchbox_db-0.7.14.dev45/src/matchbox/client/models/linkers/weighteddeterministic.py +145 -0
  97. matchbox_db-0.7.14.dev45/src/matchbox/client/models/models.py +338 -0
  98. matchbox_db-0.7.14.dev45/src/matchbox/client/queries.py +385 -0
  99. matchbox_db-0.7.14.dev45/src/matchbox/client/results.py +320 -0
  100. matchbox_db-0.7.14.dev45/src/matchbox/client/sources.py +422 -0
  101. matchbox_db-0.7.14.dev45/src/matchbox/common/__init__.py +1 -0
  102. matchbox_db-0.7.14.dev45/src/matchbox/common/arrow.py +97 -0
  103. matchbox_db-0.7.14.dev45/src/matchbox/common/db.py +145 -0
  104. matchbox_db-0.7.14.dev45/src/matchbox/common/dtos.py +820 -0
  105. matchbox_db-0.7.14.dev45/src/matchbox/common/eval.py +272 -0
  106. matchbox_db-0.7.14.dev45/src/matchbox/common/exceptions.py +334 -0
  107. matchbox_db-0.7.14.dev45/src/matchbox/common/factories/__init__.py +1 -0
  108. matchbox_db-0.7.14.dev45/src/matchbox/common/factories/dags.py +52 -0
  109. matchbox_db-0.7.14.dev45/src/matchbox/common/factories/entities.py +612 -0
  110. matchbox_db-0.7.14.dev45/src/matchbox/common/factories/models.py +992 -0
  111. matchbox_db-0.7.14.dev45/src/matchbox/common/factories/scenarios.py +959 -0
  112. matchbox_db-0.7.14.dev45/src/matchbox/common/factories/sources.py +909 -0
  113. matchbox_db-0.7.14.dev45/src/matchbox/common/hash.py +290 -0
  114. matchbox_db-0.7.14.dev45/src/matchbox/common/logging.py +172 -0
  115. matchbox_db-0.7.14.dev45/src/matchbox/common/transform.py +320 -0
  116. matchbox_db-0.7.14.dev45/src/matchbox/server/Dockerfile +52 -0
  117. matchbox_db-0.7.14.dev45/src/matchbox/server/__init__.py +14 -0
  118. matchbox_db-0.7.14.dev45/src/matchbox/server/api/__init__.py +5 -0
  119. matchbox_db-0.7.14.dev45/src/matchbox/server/api/dependencies.py +193 -0
  120. matchbox_db-0.7.14.dev45/src/matchbox/server/api/main.py +382 -0
  121. matchbox_db-0.7.14.dev45/src/matchbox/server/api/routers/__init__.py +1 -0
  122. matchbox_db-0.7.14.dev45/src/matchbox/server/api/routers/auth.py +89 -0
  123. matchbox_db-0.7.14.dev45/src/matchbox/server/api/routers/collection.py +752 -0
  124. matchbox_db-0.7.14.dev45/src/matchbox/server/api/routers/eval.py +146 -0
  125. matchbox_db-0.7.14.dev45/src/matchbox/server/api/static/favicon.png +0 -0
  126. matchbox_db-0.7.14.dev45/src/matchbox/server/api/static/swagger-ui-bundle.js +2 -0
  127. matchbox_db-0.7.14.dev45/src/matchbox/server/api/static/swagger-ui.css +3 -0
  128. matchbox_db-0.7.14.dev45/src/matchbox/server/base.py +639 -0
  129. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/.gitkeep +0 -0
  130. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/__init__.py +8 -0
  131. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/adapter/__init__.py +8 -0
  132. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/adapter/admin.py +139 -0
  133. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/adapter/collections.py +360 -0
  134. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/adapter/eval.py +44 -0
  135. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/adapter/main.py +139 -0
  136. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/adapter/query.py +47 -0
  137. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/env.py +48 -0
  138. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/script.py.mako +28 -0
  139. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/05cc4181a0ad_removed_source_key_reference_and_added_.py +134 -0
  140. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/13095b44ff09_add_user_model_groups_and_permissions_.py +83 -0
  141. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/1907c34cfa1f_create_tables_given_schema.py +198 -0
  142. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/3754ae042254_move_orm_to_root_leaf_contains_structure.py +296 -0
  143. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/40a8e5ed48f2_create_schema_without_tables.py +30 -0
  144. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/4a7c35f86405_move_sourceconfigs_from_sourceaddress_.py +175 -0
  145. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/7a2d1b10ac0f_switch_from_location_uri_to_name.py +55 -0
  146. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/83b134a86713_simplify_resolution_naming_and_hashing.py +223 -0
  147. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/8c7f757b1046_remove_human_resolution_type.py +66 -0
  148. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/95c0b5c23446_renaming_sources_to_source_config.py +191 -0
  149. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/ae63f79f6b39_renamed_sourcecolumns_to_sourcefields.py +185 -0
  150. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/b38d61ab11cc_add_index_to_the_clustersourcekey_table.py +35 -0
  151. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/b694eb292dea_add_an_index_to_the_probabilities_.py +35 -0
  152. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/beba75a24962_add_pkspace_table.py +50 -0
  153. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/c4cb937d00f4_add_modelconfigs.py +53 -0
  154. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/c774fd4b69f8_add_upload_stage_to_resolutions.py +71 -0
  155. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/dd0c3a9ecdf9_add_migrations_for_first_eval_tables.py +53 -0
  156. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/e4122bdf9b0d_renamed_primary_keys_to_just_keys.py +116 -0
  157. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/f3c9279437f4_add_content_hash_to_resolutions.py +33 -0
  158. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic/versions/f500f7d832fe_adds_collections_and_versions_to_scope_.py +163 -0
  159. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/alembic.ini +49 -0
  160. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/db.py +283 -0
  161. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/justfile +20 -0
  162. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/mixin.py +19 -0
  163. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/orm.py +1131 -0
  164. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/utils/__init__.py +1 -0
  165. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/utils/db.py +286 -0
  166. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/utils/evaluation.py +317 -0
  167. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/utils/insert.py +627 -0
  168. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/utils/query.py +659 -0
  169. matchbox_db-0.7.14.dev45/src/matchbox/server/postgresql/utils/results.py +92 -0
  170. matchbox_db-0.7.14.dev45/src/matchbox/server/uploads.py +280 -0
  171. matchbox_db-0.7.14.dev45/src/matchbox_db.egg-info/PKG-INFO +103 -0
  172. matchbox_db-0.7.14.dev45/src/matchbox_db.egg-info/SOURCES.txt +241 -0
  173. matchbox_db-0.7.14.dev45/src/matchbox_db.egg-info/dependency_links.txt +1 -0
  174. matchbox_db-0.7.14.dev45/src/matchbox_db.egg-info/entry_points.txt +2 -0
  175. matchbox_db-0.7.14.dev45/src/matchbox_db.egg-info/requires.txt +32 -0
  176. matchbox_db-0.7.14.dev45/src/matchbox_db.egg-info/top_level.txt +1 -0
  177. matchbox_db-0.7.14.dev45/test/__init__.py +0 -0
  178. matchbox_db-0.7.14.dev45/test/client/__init__.py +0 -0
  179. matchbox_db-0.7.14.dev45/test/client/cli/__init__.py +1 -0
  180. matchbox_db-0.7.14.dev45/test/client/cli/eval/__init__.py +1 -0
  181. matchbox_db-0.7.14.dev45/test/client/cli/eval/test_app.py +339 -0
  182. matchbox_db-0.7.14.dev45/test/client/cli/eval/test_widgets.py +102 -0
  183. matchbox_db-0.7.14.dev45/test/client/cli/test_main.py +94 -0
  184. matchbox_db-0.7.14.dev45/test/client/models/__init__.py +0 -0
  185. matchbox_db-0.7.14.dev45/test/client/models/methodologies/__init__.py +0 -0
  186. matchbox_db-0.7.14.dev45/test/client/models/methodologies/test_dedupers_deterministic.py +169 -0
  187. matchbox_db-0.7.14.dev45/test/client/models/methodologies/test_linkers_deterministic.py +548 -0
  188. matchbox_db-0.7.14.dev45/test/client/models/methodologies/test_linkers_probabilistic.py +282 -0
  189. matchbox_db-0.7.14.dev45/test/client/models/test_comparison.py +11 -0
  190. matchbox_db-0.7.14.dev45/test/client/test_dags.py +1166 -0
  191. matchbox_db-0.7.14.dev45/test/client/test_eval.py +246 -0
  192. matchbox_db-0.7.14.dev45/test/client/test_handler.py +86 -0
  193. matchbox_db-0.7.14.dev45/test/client/test_locations.py +228 -0
  194. matchbox_db-0.7.14.dev45/test/client/test_models.py +355 -0
  195. matchbox_db-0.7.14.dev45/test/client/test_queries.py +886 -0
  196. matchbox_db-0.7.14.dev45/test/client/test_results.py +419 -0
  197. matchbox_db-0.7.14.dev45/test/client/test_sources.py +483 -0
  198. matchbox_db-0.7.14.dev45/test/common/__init__.py +0 -0
  199. matchbox_db-0.7.14.dev45/test/common/factories/__init__.py +0 -0
  200. matchbox_db-0.7.14.dev45/test/common/factories/test_entity_factory.py +446 -0
  201. matchbox_db-0.7.14.dev45/test/common/factories/test_linked_factory.py +428 -0
  202. matchbox_db-0.7.14.dev45/test/common/factories/test_model_factory.py +751 -0
  203. matchbox_db-0.7.14.dev45/test/common/factories/test_probability_generation.py +612 -0
  204. matchbox_db-0.7.14.dev45/test/common/factories/test_scenarios.py +114 -0
  205. matchbox_db-0.7.14.dev45/test/common/factories/test_source_factory.py +628 -0
  206. matchbox_db-0.7.14.dev45/test/common/factories/test_testkit_dag.py +182 -0
  207. matchbox_db-0.7.14.dev45/test/common/test_dto.py +65 -0
  208. matchbox_db-0.7.14.dev45/test/common/test_eval.py +218 -0
  209. matchbox_db-0.7.14.dev45/test/common/test_hash.py +474 -0
  210. matchbox_db-0.7.14.dev45/test/common/test_results.py +93 -0
  211. matchbox_db-0.7.14.dev45/test/common/test_transform.py +366 -0
  212. matchbox_db-0.7.14.dev45/test/conftest.py +42 -0
  213. matchbox_db-0.7.14.dev45/test/data/all_companies.csv +1001 -0
  214. matchbox_db-0.7.14.dev45/test/e2e/test_e2e_dag.py +316 -0
  215. matchbox_db-0.7.14.dev45/test/e2e/test_e2e_evaluation.py +225 -0
  216. matchbox_db-0.7.14.dev45/test/e2e/test_e2e_methodologies.py +149 -0
  217. matchbox_db-0.7.14.dev45/test/fixtures/__init__.py +0 -0
  218. matchbox_db-0.7.14.dev45/test/fixtures/client.py +119 -0
  219. matchbox_db-0.7.14.dev45/test/fixtures/db.py +246 -0
  220. matchbox_db-0.7.14.dev45/test/justfile +15 -0
  221. matchbox_db-0.7.14.dev45/test/scripts/authorisation.py +182 -0
  222. matchbox_db-0.7.14.dev45/test/scripts/eval.py +158 -0
  223. matchbox_db-0.7.14.dev45/test/server/__init__.py +0 -0
  224. matchbox_db-0.7.14.dev45/test/server/adapter/test_adapter_admin.py +169 -0
  225. matchbox_db-0.7.14.dev45/test/server/adapter/test_adapter_collections.py +638 -0
  226. matchbox_db-0.7.14.dev45/test/server/adapter/test_adapter_eval.py +318 -0
  227. matchbox_db-0.7.14.dev45/test/server/adapter/test_adapter_main.py +34 -0
  228. matchbox_db-0.7.14.dev45/test/server/adapter/test_adapter_query.py +323 -0
  229. matchbox_db-0.7.14.dev45/test/server/api/__init__.py +0 -0
  230. matchbox_db-0.7.14.dev45/test/server/api/routes/__init__.py +0 -0
  231. matchbox_db-0.7.14.dev45/test/server/api/routes/test_routes_auth.py +163 -0
  232. matchbox_db-0.7.14.dev45/test/server/api/routes/test_routes_collection.py +401 -0
  233. matchbox_db-0.7.14.dev45/test/server/api/routes/test_routes_eval.py +238 -0
  234. matchbox_db-0.7.14.dev45/test/server/api/routes/test_routes_main.py +287 -0
  235. matchbox_db-0.7.14.dev45/test/server/api/routes/test_routes_resolution.py +428 -0
  236. matchbox_db-0.7.14.dev45/test/server/postgresql/__init__.py +0 -0
  237. matchbox_db-0.7.14.dev45/test/server/postgresql/test_pg_core.py +168 -0
  238. matchbox_db-0.7.14.dev45/test/server/postgresql/test_pg_migrations.py +100 -0
  239. matchbox_db-0.7.14.dev45/test/server/postgresql/test_pg_sql.py +1719 -0
  240. matchbox_db-0.7.14.dev45/test/server/test_uploads.py +278 -0
  241. matchbox_db-0.7.14.dev45/test/utils.py +43 -0
  242. matchbox_db-0.7.14.dev45/trufflehog-exclude.txt +1 -0
  243. matchbox_db-0.7.14.dev45/uv.lock +3195 -0
@@ -0,0 +1,25 @@
1
+ <!-- Give high level context to this PR -->
2
+
3
+ ## 🛠️ Changes proposed in this pull request
4
+
5
+ * <!-- List the main changes you've made -->
6
+
7
+ ## 👀 Guidance to review
8
+
9
+ <!-- Help reviewers know where to focus their efforts, or flag controversial decisions -->
10
+ <!-- Add links and diagrams to explain decisions -->
11
+ <!-- Point out any **breaking changes** -->
12
+
13
+ ## 🤖 AI declaration
14
+
15
+ <!-- Declare code where AI was used, and how you ensured its quality -->
16
+
17
+ ## ✅ Checklist:
18
+
19
+ - [ ] This is the smallest, simplest solution to the problem
20
+ - [ ] I've read [our code standards](https://uktrade.github.io/matchbox/contributing/) and this code follows them
21
+ - [ ] All new code is tested
22
+ - I've updated all relevant documentation (select all that apply)
23
+ - [ ] API documentation (docstrings and indexes)
24
+ - [ ] Tutorials
25
+ - [ ] Developer docs
@@ -0,0 +1,132 @@
1
+ name: CI
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - main
6
+ - "feature/**"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ format-and-lint:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+
15
+ steps:
16
+ - uses: actions/checkout@v5
17
+
18
+ - name: Install uv and Python
19
+ uses: astral-sh/setup-uv@v6
20
+
21
+ - name: Install just
22
+ uses: extractions/setup-just@v2
23
+
24
+ - name: Format and lint
25
+ run: just format
26
+
27
+ test:
28
+ name: test ${{ matrix.python-version }}
29
+ runs-on: ubuntu-latest
30
+ permissions:
31
+ contents: read
32
+ strategy:
33
+ matrix:
34
+ python-version:
35
+ - "3.11"
36
+ - "3.12"
37
+ - "3.13"
38
+
39
+ steps:
40
+ - uses: actions/checkout@v5
41
+
42
+ - name: Install uv and Python
43
+ uses: astral-sh/setup-uv@v6
44
+ with:
45
+ enable-cache: true
46
+ cache-dependency-glob: "uv.lock"
47
+ python-version: ${{ matrix.python-version }}
48
+
49
+ - name: Install the project
50
+ run: uv sync --frozen --all-extras --dev
51
+
52
+ - name: Copy environment variables
53
+ run: cp environments/development.env .env
54
+
55
+ - name: Run databases and API
56
+ run: docker compose --env-file .env --env-file environments/containers.env up -d --wait
57
+
58
+ - name: Run Python tests
59
+ run: uv run pytest
60
+
61
+ - name: Dump docker logs
62
+ if: failure()
63
+ uses: jwalton/gh-docker-logs@v2
64
+
65
+ scan-for-secrets:
66
+ runs-on: ubuntu-latest
67
+ permissions:
68
+ contents: read
69
+
70
+ steps:
71
+ - uses: actions/checkout@v5
72
+ with:
73
+ fetch-depth: 0
74
+
75
+ - name: Run TruffleHog scan
76
+ run: |
77
+ docker run --rm -v ${{ github.workspace }}:/repo \
78
+ trufflesecurity/trufflehog:latest \
79
+ git file:///repo \
80
+ --since-commit main \
81
+ --branch ${{ github.head_ref }} \
82
+ --github-actions \
83
+ --fail
84
+
85
+ build-docs:
86
+ runs-on: ubuntu-latest
87
+ permissions:
88
+ pages: write
89
+ id-token: write
90
+ contents: read
91
+
92
+ steps:
93
+ - uses: actions/checkout@v5
94
+
95
+ - name: Install uv and Python
96
+ uses: astral-sh/setup-uv@v6
97
+ with:
98
+ python-version: "3.11"
99
+
100
+ - name: Install the project
101
+ run: uv sync --frozen --all-extras --dev
102
+
103
+ - name: Build with MkDocs
104
+ run: uv run mkdocs build
105
+
106
+ build-package:
107
+ runs-on: ubuntu-latest
108
+ permissions:
109
+ contents: read
110
+
111
+ steps:
112
+ - uses: actions/checkout@v5
113
+ with:
114
+ fetch-depth: 0
115
+
116
+ - name: Install uv and Python
117
+ uses: astral-sh/setup-uv@v6
118
+ with:
119
+ python-version: "3.11"
120
+
121
+ - name: Build package
122
+ run: uv build
123
+
124
+ ci-success:
125
+ needs: [format-and-lint, test, scan-for-secrets, build-docs, build-package]
126
+ runs-on: ubuntu-latest
127
+ permissions:
128
+ contents: read
129
+
130
+ steps:
131
+ - name: CI success
132
+ run: echo "All CI checks passed!"
@@ -0,0 +1,49 @@
1
+ # Custom CodeQL workflow
2
+ #
3
+ # More or less autogenerated by GitHub. Matchbox maintains its own workflow in order
4
+ # to scan PRs from forks.
5
+ #
6
+ # See https://github.com/actions/starter-workflows/blob/main/code-scanning/codeql.yml
7
+ #
8
+ name: "CodeQL Advanced"
9
+
10
+ on:
11
+ push:
12
+ branches: ["main"]
13
+ pull_request:
14
+ # The branches below must be a subset of the branches above
15
+ branches: ["main"]
16
+ schedule:
17
+ - cron: "36 17 * * 3"
18
+ workflow_dispatch:
19
+
20
+ jobs:
21
+ analyse:
22
+ name: Analyse
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ actions: read
26
+ contents: read
27
+ security-events: write
28
+
29
+ strategy:
30
+ fail-fast: false
31
+ matrix:
32
+ language: ["python", "actions"]
33
+
34
+ steps:
35
+ - name: Checkout repository
36
+ uses: actions/checkout@v6
37
+
38
+ - name: Initialise CodeQL
39
+ uses: github/codeql-action/init@v4
40
+ with:
41
+ languages: ${{ matrix.language }}
42
+
43
+ # Details on CodeQL's query packs refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
44
+ queries: security-and-quality
45
+
46
+ - name: Perform CodeQL Analysis
47
+ uses: github/codeql-action/analyze@v4
48
+ with:
49
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,110 @@
1
+ name: Prerelease
2
+ on:
3
+ workflow_dispatch:
4
+
5
+ env:
6
+ REGISTRY: ghcr.io
7
+ IMAGE_NAME: ${{ github.repository }}
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ outputs:
13
+ mb_version: ${{ steps.get_version.outputs.mb_version }}
14
+ permissions:
15
+ contents: write
16
+ packages: write
17
+ attestations: write
18
+ id-token: write
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v5
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Log in to GitHub packages Docker registry
27
+ uses: docker/login-action@v3
28
+ with:
29
+ registry: ${{ env.REGISTRY }}
30
+ username: ${{ github.actor }}
31
+ password: ${{ secrets.GITHUB_TOKEN }}
32
+
33
+ - name: Install uv
34
+ uses: astral-sh/setup-uv@v6
35
+ with:
36
+ python-version: "3.11"
37
+
38
+ - name: Extract development version
39
+ id: get_version
40
+ run: |
41
+ echo "mb_version=$(uv run --frozen python -m setuptools_scm | sed 's/+.*//')" \
42
+ >> "$GITHUB_OUTPUT"
43
+
44
+ - name: Build package
45
+ env:
46
+ SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.get_version.outputs.mb_version }}
47
+ run: uv build
48
+
49
+ - name: Upload package artifacts
50
+ uses: actions/upload-artifact@v4
51
+ with:
52
+ name: package-dist
53
+ path: ./dist
54
+
55
+ - name: Extract tag metadata for Docker
56
+ id: meta
57
+ uses: docker/metadata-action@v5
58
+ with:
59
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
60
+ tags: |
61
+ type=raw,value=${{ steps.get_version.outputs.mb_version }}
62
+ type=raw,value=development
63
+
64
+ - name: Build and push Docker image
65
+ uses: docker/build-push-action@v6
66
+ with:
67
+ context: .
68
+ file: src/matchbox/server/Dockerfile
69
+ push: true
70
+ build-args: |
71
+ MB_VERSION=${{ steps.get_version.outputs.mb_version }}
72
+ tags: ${{ steps.meta.outputs.tags }}
73
+
74
+ - name: Delete existing development release if it exists
75
+ run: |
76
+ gh release delete development --yes || true
77
+ env:
78
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79
+
80
+ - name: Create development prerelease
81
+ uses: ncipollo/release-action@v1
82
+ with:
83
+ tag: development
84
+ name: Development
85
+ prerelease: true
86
+ body: |
87
+ This is a development build, usually from the latest main branch.
88
+
89
+ May be unstable.
90
+
91
+ **Version:** ${{ steps.get_version.outputs.mb_version }}
92
+ **Commit:** ${{ github.sha }}
93
+
94
+ deploy-package:
95
+ needs: build
96
+ runs-on: ubuntu-latest
97
+ permissions:
98
+ id-token: write
99
+
100
+ environment: pypi
101
+
102
+ steps:
103
+ - name: Download package artifacts
104
+ uses: actions/download-artifact@v4
105
+ with:
106
+ name: package-dist
107
+ path: ./dist
108
+
109
+ - name: Publish package to PyPI
110
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,208 @@
1
+ name: Release
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ version:
6
+ description: 'Version to release (e.g., 1.2.3)'
7
+ required: true
8
+ type: string
9
+
10
+ env:
11
+ REGISTRY: ghcr.io
12
+ IMAGE_NAME: ${{ github.repository }}
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: read
19
+ pages: write
20
+ packages: write
21
+ attestations: write
22
+ id-token: write
23
+
24
+ outputs:
25
+ tag: ${{ steps.version.outputs.tag }}
26
+ version: ${{ steps.version.outputs.version }}
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v5
31
+ with:
32
+ ref: main
33
+ fetch-depth: 0
34
+
35
+ - name: Validate we're on main branch
36
+ run: |
37
+ current_branch=$(git branch --show-current)
38
+ if [ "$current_branch" != "main" ]; then
39
+ echo "Error: Must be on main branch"
40
+ exit 1
41
+ fi
42
+
43
+ - name: Process version and tag
44
+ id: version
45
+ run: |
46
+ input_version="${{ github.event.inputs.version }}"
47
+ clean_version=${input_version#v}
48
+
49
+ # Validate version format
50
+ if ! echo "$clean_version" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'; then
51
+ echo "Error: Version must be in format x.x.x (with or without v prefix)"
52
+ exit 1
53
+ fi
54
+
55
+ git_tag="v$clean_version"
56
+
57
+ # Check if tag already exists
58
+ if git rev-parse "$git_tag" >/dev/null 2>&1; then
59
+ echo "Error: Tag $git_tag already exists"
60
+ exit 1
61
+ fi
62
+
63
+ echo "version=$clean_version" >> $GITHUB_OUTPUT
64
+ echo "tag=$git_tag" >> $GITHUB_OUTPUT
65
+ echo "Clean version: $clean_version"
66
+ echo "Git tag: $git_tag"
67
+
68
+ - name: Install uv
69
+ uses: astral-sh/setup-uv@v6
70
+ with:
71
+ python-version: "3.11"
72
+
73
+ - name: Build package
74
+ env:
75
+ SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.version.outputs.version }}
76
+ run: uv build
77
+
78
+ - name: Upload package artifacts
79
+ uses: actions/upload-artifact@v4
80
+ with:
81
+ name: package-dist
82
+ path: ./dist
83
+
84
+ - name: Install the project
85
+ run: uv sync --frozen --all-extras --dev
86
+
87
+ - name: Build documentation
88
+ run: uv run mkdocs build
89
+
90
+ - name: Upload documentation artifact
91
+ uses: actions/upload-pages-artifact@v3
92
+ with:
93
+ path: site/
94
+
95
+ - name: Log in to GitHub packages Docker registry
96
+ uses: docker/login-action@v3
97
+ with:
98
+ registry: ${{ env.REGISTRY }}
99
+ username: ${{ github.actor }}
100
+ password: ${{ secrets.GITHUB_TOKEN }}
101
+
102
+ - name: Extract tag metadata for Docker
103
+ id: meta
104
+ uses: docker/metadata-action@v5
105
+ with:
106
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
107
+ tags: |
108
+ type=raw,value=${{ steps.version.outputs.version }}
109
+ type=raw,value=latest
110
+
111
+ - name: Build Docker image
112
+ uses: docker/build-push-action@v6
113
+ with:
114
+ context: .
115
+ file: src/matchbox/server/Dockerfile
116
+ push: false
117
+ load: true
118
+ build-args: |
119
+ MB_VERSION=${{ steps.version.outputs.version }}
120
+ tags: ${{ steps.meta.outputs.tags }}
121
+
122
+ - name: Save Docker image
123
+ run: |
124
+ # Save all tags created by the build
125
+ docker save ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \
126
+ > ${{ runner.temp }}/docker-image.tar
127
+
128
+ - name: Upload Docker image artifact
129
+ uses: actions/upload-artifact@v4
130
+ with:
131
+ name: docker-image
132
+ path: ${{ runner.temp }}/docker-image.tar
133
+
134
+ deploy-package:
135
+ needs: build
136
+ runs-on: ubuntu-latest
137
+ permissions:
138
+ id-token: write
139
+
140
+ environment: pypi
141
+
142
+ steps:
143
+ - name: Download package artifacts
144
+ uses: actions/download-artifact@v4
145
+ with:
146
+ name: package-dist
147
+ path: ./dist
148
+
149
+ - name: Publish package to PyPI
150
+ uses: pypa/gh-action-pypi-publish@release/v1
151
+
152
+ deploy-docs:
153
+ needs: build
154
+ runs-on: ubuntu-latest
155
+ permissions:
156
+ pages: write
157
+ id-token: write
158
+ contents: read
159
+
160
+ environment:
161
+ name: github-pages
162
+ url: ${{ steps.deployment.outputs.page_url }}
163
+
164
+ steps:
165
+ - name: Deploy documentation to GitHub Pages
166
+ id: deployment
167
+ uses: actions/deploy-pages@v4
168
+
169
+ deploy-docker:
170
+ needs: build
171
+ runs-on: ubuntu-latest
172
+ permissions:
173
+ packages: write
174
+ contents: read
175
+
176
+ steps:
177
+ - name: Download Docker image artifact
178
+ uses: actions/download-artifact@v4
179
+ with:
180
+ name: docker-image
181
+ path: ${{ runner.temp }}
182
+
183
+ - name: Load Docker image
184
+ run: docker load --input ${{ runner.temp }}/docker-image.tar
185
+
186
+ - name: Log in to GitHub packages Docker registry
187
+ uses: docker/login-action@v3
188
+ with:
189
+ registry: ${{ env.REGISTRY }}
190
+ username: ${{ github.actor }}
191
+ password: ${{ secrets.GITHUB_TOKEN }}
192
+
193
+ - name: Push Docker image
194
+ run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} --all-tags
195
+
196
+ create-release:
197
+ needs: [build, deploy-package, deploy-docs, deploy-docker]
198
+ runs-on: ubuntu-latest
199
+ permissions:
200
+ contents: write
201
+
202
+ steps:
203
+ - name: Create tag and GitHub release
204
+ uses: ncipollo/release-action@v1
205
+ with:
206
+ tag: ${{ needs.build.outputs.tag }}
207
+ name: ${{ needs.build.outputs.tag }}
208
+ generateReleaseNotes: true