horde-model-reference 0.9.2__tar.gz → 2.0.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 (236) hide show
  1. horde_model_reference-2.0.0/.CONTRIBUTING.md +64 -0
  2. horde_model_reference-2.0.0/.dockerignore +78 -0
  3. horde_model_reference-2.0.0/.env.example +181 -0
  4. horde_model_reference-2.0.0/.env.primary.example +72 -0
  5. horde_model_reference-2.0.0/.env.sync.example +105 -0
  6. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/.github/workflows/codeql.yml +4 -4
  7. horde_model_reference-2.0.0/.github/workflows/docker-validation.yml +326 -0
  8. horde_model_reference-2.0.0/.github/workflows/lint.yml +96 -0
  9. horde_model_reference-2.0.0/.github/workflows/maintests.yml +73 -0
  10. horde_model_reference-2.0.0/.github/workflows/prtests.yml +170 -0
  11. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/.github/workflows/release.yml +2 -2
  12. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/.gitignore +13 -1
  13. horde_model_reference-2.0.0/.gitmodules +3 -0
  14. horde_model_reference-2.0.0/.pre-commit-config.yaml +61 -0
  15. horde_model_reference-2.0.0/DEPLOYMENT.md +293 -0
  16. horde_model_reference-2.0.0/Dockerfile +105 -0
  17. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/PKG-INFO +337 -60
  18. horde_model_reference-2.0.0/README.md +326 -0
  19. horde_model_reference-2.0.0/docker-compose.redis.yml +145 -0
  20. horde_model_reference-2.0.0/docker-compose.sync.example.yml +76 -0
  21. horde_model_reference-2.0.0/docker-compose.yml +76 -0
  22. horde_model_reference-2.0.0/docs/build_docs.py +77 -0
  23. horde_model_reference-2.0.0/docs/horde_model_reference/.pages +1 -0
  24. horde_model_reference-2.0.0/docs/horde_model_reference/_version.md +2 -0
  25. horde_model_reference-2.0.0/docs/horde_model_reference/backends/.pages +1 -0
  26. horde_model_reference-2.0.0/docs/horde_model_reference/backends/base.md +2 -0
  27. horde_model_reference-2.0.0/docs/horde_model_reference/backends/filesystem_backend.md +2 -0
  28. horde_model_reference-2.0.0/docs/horde_model_reference/backends/github_backend.md +2 -0
  29. horde_model_reference-2.0.0/docs/horde_model_reference/backends/http_backend.md +2 -0
  30. horde_model_reference-2.0.0/docs/horde_model_reference/backends/redis_backend.md +2 -0
  31. horde_model_reference-2.0.0/docs/horde_model_reference/backends/replica_backend_base.md +2 -0
  32. horde_model_reference-2.0.0/docs/horde_model_reference/legacy/.pages +1 -0
  33. horde_model_reference-2.0.0/docs/horde_model_reference/legacy/classes/.pages +1 -0
  34. horde_model_reference-2.0.0/docs/horde_model_reference/legacy/classes/legacy_converters.md +2 -0
  35. horde_model_reference-2.0.0/docs/horde_model_reference/legacy/classes/legacy_models.md +2 -0
  36. horde_model_reference-2.0.0/docs/horde_model_reference/legacy/convert_all_legacy_dbs.md +2 -0
  37. horde_model_reference-2.0.0/docs/horde_model_reference/legacy/validate_sd.md +2 -0
  38. horde_model_reference-2.0.0/docs/horde_model_reference/meta_consts.md +2 -0
  39. horde_model_reference-2.0.0/docs/horde_model_reference/model_reference_manager.md +2 -0
  40. horde_model_reference-2.0.0/docs/horde_model_reference/model_reference_metadata.md +2 -0
  41. horde_model_reference-2.0.0/docs/horde_model_reference/model_reference_records.md +2 -0
  42. horde_model_reference-2.0.0/docs/horde_model_reference/path_consts.md +2 -0
  43. horde_model_reference-2.0.0/docs/horde_model_reference/service/.pages +1 -0
  44. horde_model_reference-2.0.0/docs/horde_model_reference/service/app.md +2 -0
  45. horde_model_reference-2.0.0/docs/horde_model_reference/service/shared.md +2 -0
  46. horde_model_reference-2.0.0/docs/horde_model_reference/service/v1/.pages +1 -0
  47. horde_model_reference-2.0.0/docs/horde_model_reference/service/v1/routers/.pages +1 -0
  48. horde_model_reference-2.0.0/docs/horde_model_reference/service/v1/routers/create_update.md +2 -0
  49. horde_model_reference-2.0.0/docs/horde_model_reference/service/v1/routers/metadata.md +2 -0
  50. horde_model_reference-2.0.0/docs/horde_model_reference/service/v1/routers/references.md +2 -0
  51. horde_model_reference-2.0.0/docs/horde_model_reference/service/v1/routers/shared.md +2 -0
  52. horde_model_reference-2.0.0/docs/horde_model_reference/service/v2/.pages +1 -0
  53. horde_model_reference-2.0.0/docs/horde_model_reference/service/v2/models.md +2 -0
  54. horde_model_reference-2.0.0/docs/horde_model_reference/service/v2/routers/.pages +1 -0
  55. horde_model_reference-2.0.0/docs/horde_model_reference/service/v2/routers/metadata.md +2 -0
  56. horde_model_reference-2.0.0/docs/horde_model_reference/service/v2/routers/references.md +2 -0
  57. horde_model_reference-2.0.0/docs/horde_model_reference/showcase/.pages +1 -0
  58. horde_model_reference-2.0.0/docs/horde_model_reference/sync/.pages +1 -0
  59. horde_model_reference-2.0.0/docs/horde_model_reference/sync/comparator.md +2 -0
  60. horde_model_reference-2.0.0/docs/horde_model_reference/sync/config.md +2 -0
  61. horde_model_reference-2.0.0/docs/horde_model_reference/sync/github_client.md +2 -0
  62. horde_model_reference-2.0.0/docs/horde_model_reference/sync/watch_mode.md +2 -0
  63. horde_model_reference-2.0.0/docs/horde_model_reference/util.md +2 -0
  64. horde_model_reference-2.0.0/docs/index.md +1 -0
  65. horde_model_reference-2.0.0/docs/model_reference_backend.md +230 -0
  66. horde_model_reference-2.0.0/docs/primary_deployments.md +112 -0
  67. horde_model_reference-2.0.0/docs/replica_backend_base.md +861 -0
  68. horde_model_reference-2.0.0/docs/stylesheets/extra.css +309 -0
  69. horde_model_reference-2.0.0/mkdocs.yml +67 -0
  70. horde_model_reference-2.0.0/pyproject.toml +189 -0
  71. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/schemas}/stable_diffusion.example.json +2 -16
  72. horde_model_reference-2.0.0/schemas/stable_diffusion.schema.json +514 -0
  73. horde_model_reference-2.0.0/scripts/README.md +22 -0
  74. horde_model_reference-2.0.0/scripts/get_all_names.py +84 -0
  75. horde_model_reference-2.0.0/scripts/legacy_text/convert.py +116 -0
  76. horde_model_reference-2.0.0/scripts/legacy_text/defaults.json +8 -0
  77. horde_model_reference-2.0.0/scripts/legacy_text/generation_params.json +30 -0
  78. horde_model_reference-2.0.0/scripts/legacy_text/reverse_convert.py +364 -0
  79. horde_model_reference-2.0.0/scripts/sync/README.md +1104 -0
  80. horde_model_reference-2.0.0/scripts/sync/github_app_auth_example.md +281 -0
  81. horde_model_reference-2.0.0/scripts/sync/sync_github_references.py +440 -0
  82. horde_model_reference-2.0.0/src/horde_model_reference/__init__.py +369 -0
  83. horde_model_reference-2.0.0/src/horde_model_reference/_version.py +34 -0
  84. horde_model_reference-2.0.0/src/horde_model_reference/analytics/__init__.py +52 -0
  85. horde_model_reference-2.0.0/src/horde_model_reference/analytics/audit_analysis.py +1400 -0
  86. horde_model_reference-2.0.0/src/horde_model_reference/analytics/audit_cache.py +81 -0
  87. horde_model_reference-2.0.0/src/horde_model_reference/analytics/base_cache.py +306 -0
  88. horde_model_reference-2.0.0/src/horde_model_reference/analytics/constants.py +38 -0
  89. horde_model_reference-2.0.0/src/horde_model_reference/analytics/filter_presets.py +233 -0
  90. horde_model_reference-2.0.0/src/horde_model_reference/analytics/statistics.py +360 -0
  91. horde_model_reference-2.0.0/src/horde_model_reference/analytics/statistics_cache.py +81 -0
  92. horde_model_reference-2.0.0/src/horde_model_reference/analytics/text_model_grouping.py +241 -0
  93. horde_model_reference-2.0.0/src/horde_model_reference/analytics/text_model_parser.py +287 -0
  94. horde_model_reference-2.0.0/src/horde_model_reference/backends/__init__.py +28 -0
  95. horde_model_reference-2.0.0/src/horde_model_reference/backends/base.py +856 -0
  96. horde_model_reference-2.0.0/src/horde_model_reference/backends/filesystem_backend.py +1110 -0
  97. horde_model_reference-2.0.0/src/horde_model_reference/backends/github_backend.py +702 -0
  98. horde_model_reference-2.0.0/src/horde_model_reference/backends/http_backend.py +464 -0
  99. horde_model_reference-2.0.0/src/horde_model_reference/backends/redis_backend.py +689 -0
  100. horde_model_reference-2.0.0/src/horde_model_reference/backends/replica_backend_base.py +632 -0
  101. horde_model_reference-2.0.0/src/horde_model_reference/integrations/__init__.py +45 -0
  102. horde_model_reference-2.0.0/src/horde_model_reference/integrations/data_merger.py +199 -0
  103. horde_model_reference-2.0.0/src/horde_model_reference/integrations/horde_api_integration.py +647 -0
  104. horde_model_reference-2.0.0/src/horde_model_reference/integrations/horde_api_models.py +291 -0
  105. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference/legacy/__init__.py +2 -2
  106. horde_model_reference-2.0.0/src/horde_model_reference/legacy/classes/__init__.py +1 -0
  107. horde_model_reference-2.0.0/src/horde_model_reference/legacy/classes/legacy_converters.py +674 -0
  108. horde_model_reference-2.0.0/src/horde_model_reference/legacy/classes/legacy_models.py +401 -0
  109. horde_model_reference-2.0.0/src/horde_model_reference/legacy/convert_all_legacy_dbs.py +200 -0
  110. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference/legacy/validate_sd.py +21 -5
  111. horde_model_reference-2.0.0/src/horde_model_reference/meta_consts.py +356 -0
  112. horde_model_reference-2.0.0/src/horde_model_reference/model_reference_manager.py +671 -0
  113. horde_model_reference-2.0.0/src/horde_model_reference/model_reference_metadata.py +945 -0
  114. horde_model_reference-2.0.0/src/horde_model_reference/model_reference_records.py +421 -0
  115. horde_model_reference-2.0.0/src/horde_model_reference/path_consts.py +328 -0
  116. horde_model_reference-2.0.0/src/horde_model_reference/service/__init__.py +1 -0
  117. horde_model_reference-2.0.0/src/horde_model_reference/service/app.py +58 -0
  118. horde_model_reference-2.0.0/src/horde_model_reference/service/shared.py +199 -0
  119. horde_model_reference-2.0.0/src/horde_model_reference/service/statistics/__init__.py +1 -0
  120. horde_model_reference-2.0.0/src/horde_model_reference/service/statistics/routers/__init__.py +1 -0
  121. horde_model_reference-2.0.0/src/horde_model_reference/service/statistics/routers/audit.py +303 -0
  122. horde_model_reference-2.0.0/src/horde_model_reference/service/statistics/routers/statistics.py +325 -0
  123. horde_model_reference-2.0.0/src/horde_model_reference/service/v1/__init__.py +1 -0
  124. horde_model_reference-2.0.0/src/horde_model_reference/service/v1/routers/__init__.py +1 -0
  125. horde_model_reference-2.0.0/src/horde_model_reference/service/v1/routers/create_update.py +1021 -0
  126. horde_model_reference-2.0.0/src/horde_model_reference/service/v1/routers/metadata.py +303 -0
  127. horde_model_reference-2.0.0/src/horde_model_reference/service/v1/routers/references.py +144 -0
  128. horde_model_reference-2.0.0/src/horde_model_reference/service/v1/routers/shared.py +99 -0
  129. horde_model_reference-2.0.0/src/horde_model_reference/service/v2/__init__.py +1 -0
  130. horde_model_reference-2.0.0/src/horde_model_reference/service/v2/models.py +25 -0
  131. horde_model_reference-2.0.0/src/horde_model_reference/service/v2/routers/__init__.py +1 -0
  132. horde_model_reference-2.0.0/src/horde_model_reference/service/v2/routers/metadata.py +307 -0
  133. horde_model_reference-2.0.0/src/horde_model_reference/service/v2/routers/references.py +848 -0
  134. horde_model_reference-2.0.0/src/horde_model_reference/sync/__init__.py +20 -0
  135. horde_model_reference-2.0.0/src/horde_model_reference/sync/comparator.py +115 -0
  136. horde_model_reference-2.0.0/src/horde_model_reference/sync/config.py +268 -0
  137. horde_model_reference-2.0.0/src/horde_model_reference/sync/github_client.py +1237 -0
  138. horde_model_reference-2.0.0/src/horde_model_reference/sync/legacy_text_validator.py +426 -0
  139. horde_model_reference-2.0.0/src/horde_model_reference/sync/watch_mode.py +233 -0
  140. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference.egg-info/PKG-INFO +337 -60
  141. horde_model_reference-2.0.0/src/horde_model_reference.egg-info/SOURCES.txt +197 -0
  142. horde_model_reference-2.0.0/src/horde_model_reference.egg-info/requires.txt +19 -0
  143. horde_model_reference-2.0.0/tests/README.md +310 -0
  144. horde_model_reference-2.0.0/tests/__init__.py +1 -0
  145. horde_model_reference-2.0.0/tests/backends/__init__.py +1 -0
  146. horde_model_reference-2.0.0/tests/backends/test_http_backend.py +445 -0
  147. horde_model_reference-2.0.0/tests/backends/test_primary_mode.py +437 -0
  148. horde_model_reference-2.0.0/tests/backends/test_redis_backend.py +1494 -0
  149. horde_model_reference-2.0.0/tests/check_model_ref_type_blocks.py +91 -0
  150. horde_model_reference-2.0.0/tests/conftest.py +588 -0
  151. horde_model_reference-2.0.0/tests/create_env_file_example.py +110 -0
  152. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/tests}/create_example_json.py +55 -28
  153. horde_model_reference-2.0.0/tests/helpers.py +53 -0
  154. horde_model_reference-2.0.0/tests/horde_api/__init__.py +1 -0
  155. horde_model_reference-2.0.0/tests/horde_api/cassettes/.gitignore +6 -0
  156. horde_model_reference-2.0.0/tests/horde_api/conftest.py +96 -0
  157. horde_model_reference-2.0.0/tests/horde_api/test_audit_analysis_live.py +443 -0
  158. horde_model_reference-2.0.0/tests/horde_api/test_audit_worker_count.py +140 -0
  159. horde_model_reference-2.0.0/tests/horde_api/test_data_merger.py +455 -0
  160. horde_model_reference-2.0.0/tests/horde_api/test_horde_api_integration.py +473 -0
  161. horde_model_reference-2.0.0/tests/horde_api/test_horde_api_integration_live.py +377 -0
  162. horde_model_reference-2.0.0/tests/horde_api/test_indexed_horde_types.py +219 -0
  163. horde_model_reference-2.0.0/tests/service/__init__.py +1 -0
  164. horde_model_reference-2.0.0/tests/service/test_replica_backend_base.py +201 -0
  165. horde_model_reference-2.0.0/tests/service/test_v1_api.py +649 -0
  166. horde_model_reference-2.0.0/tests/service/test_v2_api.py +596 -0
  167. horde_model_reference-2.0.0/tests/statistics_and_audit/__init__.py +1 -0
  168. horde_model_reference-2.0.0/tests/statistics_and_audit/test_audit_analysis.py +1591 -0
  169. horde_model_reference-2.0.0/tests/statistics_and_audit/test_statistics.py +378 -0
  170. horde_model_reference-2.0.0/tests/statistics_and_audit/test_statistics_cache.py +267 -0
  171. horde_model_reference-2.0.0/tests/statistics_and_audit/test_text_model_grouping.py +531 -0
  172. horde_model_reference-2.0.0/tests/statistics_and_audit/test_text_model_parser.py +321 -0
  173. horde_model_reference-2.0.0/tests/sync/__init__.py +1 -0
  174. horde_model_reference-2.0.0/tests/sync/test_comparator.py +264 -0
  175. horde_model_reference-2.0.0/tests/sync/test_comparator_integration.py +561 -0
  176. horde_model_reference-2.0.0/tests/sync/test_config.py +79 -0
  177. horde_model_reference-2.0.0/tests/sync/test_legacy_text_validator.py +503 -0
  178. horde_model_reference-2.0.0/tests/test_canonical_format.py +1031 -0
  179. horde_model_reference-2.0.0/tests/test_combined_model_statistics.py +63 -0
  180. horde_model_reference-2.0.0/tests/test_consts.py +30 -0
  181. horde_model_reference-2.0.0/tests/test_convert_legacy_database.py +144 -0
  182. horde_model_reference-2.0.0/tests/test_converters.py +113 -0
  183. horde_model_reference-2.0.0/tests/test_env_example.py +27 -0
  184. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/tests/test_examples.py +5 -4
  185. horde_model_reference-2.0.0/tests/test_metadata.py +1048 -0
  186. horde_model_reference-2.0.0/tests/test_model_reference_manager.py +907 -0
  187. horde_model_reference-2.0.0/tests/test_records.py +85 -0
  188. horde_model_reference-2.0.0/tests/test_scripts.py +41 -0
  189. horde_model_reference-2.0.0/uv.lock +3597 -0
  190. horde_model_reference-0.9.2/.CONTRIBUTING.md +0 -8
  191. horde_model_reference-0.9.2/.github/dependabot.yml +0 -11
  192. horde_model_reference-0.9.2/.github/workflows/maintests.yml +0 -61
  193. horde_model_reference-0.9.2/.github/workflows/prtests.yml +0 -67
  194. horde_model_reference-0.9.2/.pre-commit-config.yaml +0 -31
  195. horde_model_reference-0.9.2/README.md +0 -61
  196. horde_model_reference-0.9.2/get_all_names.py +0 -22
  197. horde_model_reference-0.9.2/horde_model_reference/__init__.py +0 -36
  198. horde_model_reference-0.9.2/horde_model_reference/_version.py +0 -16
  199. horde_model_reference-0.9.2/horde_model_reference/legacy/add_to_legacy_sd.py +0 -317
  200. horde_model_reference-0.9.2/horde_model_reference/legacy/classes/__init__.py +0 -0
  201. horde_model_reference-0.9.2/horde_model_reference/legacy/classes/legacy_converters.py +0 -727
  202. horde_model_reference-0.9.2/horde_model_reference/legacy/classes/raw_legacy_model_database_records.py +0 -70
  203. horde_model_reference-0.9.2/horde_model_reference/legacy/classes/staging_model_database_records.py +0 -130
  204. horde_model_reference-0.9.2/horde_model_reference/legacy/convert_all_legacy_dbs.py +0 -82
  205. horde_model_reference-0.9.2/horde_model_reference/legacy/download_live_legacy_dbs.py +0 -31
  206. horde_model_reference-0.9.2/horde_model_reference/legacy/get_all_filesizes.py +0 -72
  207. horde_model_reference-0.9.2/horde_model_reference/legacy/legacy_download_manager.py +0 -108
  208. horde_model_reference-0.9.2/horde_model_reference/meta_consts.py +0 -131
  209. horde_model_reference-0.9.2/horde_model_reference/model_reference_manager.py +0 -269
  210. horde_model_reference-0.9.2/horde_model_reference/model_reference_records.py +0 -288
  211. horde_model_reference-0.9.2/horde_model_reference/path_consts.py +0 -190
  212. horde_model_reference-0.9.2/horde_model_reference.egg-info/SOURCES.txt +0 -55
  213. horde_model_reference-0.9.2/horde_model_reference.egg-info/requires.txt +0 -6
  214. horde_model_reference-0.9.2/legacy_stable_diffusion.schema.json +0 -359
  215. horde_model_reference-0.9.2/pyproject.toml +0 -78
  216. horde_model_reference-0.9.2/requirements.dev.txt +0 -20
  217. horde_model_reference-0.9.2/requirements.txt +0 -6
  218. horde_model_reference-0.9.2/stable_diffusion.schema.json +0 -355
  219. horde_model_reference-0.9.2/tests/__init__.py +0 -0
  220. horde_model_reference-0.9.2/tests/conftest.py +0 -70
  221. horde_model_reference-0.9.2/tests/test_consts.py +0 -19
  222. horde_model_reference-0.9.2/tests/test_convert_legacy_database.py +0 -122
  223. horde_model_reference-0.9.2/tests/test_model_reference_manager.py +0 -26
  224. horde_model_reference-0.9.2/tests/test_records.py +0 -22
  225. horde_model_reference-0.9.2/tests/test_scripts.py +0 -32
  226. horde_model_reference-0.9.2/tox.ini +0 -34
  227. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/LICENSE +0 -0
  228. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/MANIFEST.in +0 -0
  229. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0}/setup.cfg +0 -0
  230. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference/legacy/README.md +0 -0
  231. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference/py.typed +0 -0
  232. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference/showcase/README.md +0 -0
  233. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference/util.py +0 -0
  234. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference.egg-info/dependency_links.txt +0 -0
  235. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference.egg-info/entry_points.txt +0 -0
  236. {horde_model_reference-0.9.2 → horde_model_reference-2.0.0/src}/horde_model_reference.egg-info/top_level.txt +0 -0
@@ -0,0 +1,64 @@
1
+ # Contributing
2
+
3
+ All pull requests, large or small, from anyone are welcome!
4
+
5
+ ## Table of Contents
6
+
7
+ - [Contributing](#contributing)
8
+ - [Table of Contents](#table-of-contents)
9
+ - [Environment Management](#environment-management)
10
+ - [First time setup](#first-time-setup)
11
+ - [Code Quality Tools](#code-quality-tools)
12
+ - [Code Style and System Design](#code-style-and-system-design)
13
+
14
+ ## Environment Management
15
+
16
+ [uv](https://github.com/astral-sh/uv/) is the suggested python environment management tool.
17
+
18
+ ### First time setup
19
+
20
+ - Install uv, as described [in the uv installation guide](https://github.com/astral-sh/uv/#installation).
21
+ - `uv python install 3.10 3.11 3.12 3.13` # We currently support these versions.
22
+ - `uv set 3.12` # Set to your desired default version.
23
+ - `uv self update`
24
+ - `uv sync --all-groups`
25
+ - The `.venv/` directory will now be created with all project, development and documentation dependencies installed.
26
+ - Be sure to point your IDE to the python binary appropriate for your OS in this directory.
27
+
28
+ ## Code Quality Tools
29
+
30
+ - [**tox**](https://tox.wiki/)
31
+ - Creates virtual environments for CI or local pytest runs.
32
+ - Note that the CI does not current execute calls to the production API by default.
33
+ - Run `tox list` or see `tox.ini` for more info
34
+ - [**pre-commit**](https://pre-commit.com/)
35
+ - Creates virtual environments for formatting and linting tools
36
+ - Run `pre-commit run --all-files` or see `.pre-commit-config.yaml` for more info.
37
+
38
+ > Note: Many of the tools below are run by `pre-commit` automatically, but can also be run manually if desired.
39
+
40
+ - [**ruff**](https://github.com/astral-sh/ruff)
41
+ - Also provides formatting (replacing `black`) with `ruff format . --fix`
42
+ - Linting rules from a wide variety of selectable rule sets
43
+ - See `pyproject.toml` for the rules used.
44
+ - See all rules (but not necessarily used in the project) [available in ruff here](https://beta.ruff.rs/docs/rules/).
45
+ - Run with `ruff check .`
46
+ - Note: When using autofixing (`ruff check . --fix`), changes may be made that require running black, which can then result in needing to run `ruff check . --fix` again.
47
+ - Consider running `black . && ruff check . --fix && black . && ruff check . --fix` to avoid this.
48
+ - [**mypy**](https://mypy-lang.org/)
49
+ - Static type safety
50
+ - I recommending using the [mypy daemon](https://mypy.readthedocs.io/en/stable/mypy_daemon.html) instead of periodically running `pre-commit` (or `mypy` directly.).
51
+ - [**pyright**](https://github.com/microsoft/pyright)
52
+ - Shipped with vscode by default (via the python extension `ms-python.vscode-pylance`)
53
+ - Suggested settings:
54
+ - `"python.analysis.typeCheckingMode": "off"`
55
+ - The pylance extension has certain opinionated type checking assertions which are clash with mypy.
56
+ - For example, overriding an optional field to be non-optional is considered by pylance to be a type error due to the field being invariant and the parent class potentially settings it to `None`. However, by convention in the SDK, this is a forbidden pattern.
57
+ - `"python.analysis.languageServerMode": "full"`
58
+ - `"python.testing.pytestEnabled": true`
59
+ - [**tach**](https://github.com/gauge-sh/tach)
60
+ - Enforces internal namespace dependency constraints. This helps avoid circular dependencies and helps ensure implementations are in a logical place.
61
+
62
+ ## Code Style and System Design
63
+
64
+ - See the [python haidra style guide](docs/haidra-assets/docs/meta/python.md) for standards on code style, system design, testing, and documentation.
@@ -0,0 +1,78 @@
1
+ # Git
2
+ .git
3
+ .gitignore
4
+ .gitmodules
5
+ .github
6
+
7
+ # Python
8
+ __pycache__
9
+ *.py[cod]
10
+ *$py.class
11
+ *.so
12
+ .Python
13
+ *.egg-info
14
+ dist
15
+ .eggs
16
+ .pytest_cache
17
+ .mypy_cache
18
+ .ruff_cache
19
+ .coverage
20
+ .tox
21
+ .nox
22
+
23
+ # Virtual environments
24
+ .venv
25
+ venv
26
+ ENV
27
+ env
28
+
29
+ # IDE
30
+ .vscode
31
+ .idea
32
+ *.swp
33
+ *.swo
34
+ *~
35
+ .DS_Store
36
+
37
+ # Documentation
38
+ docs
39
+ *.md
40
+ README.md
41
+ CONTRIBUTING.md
42
+ CLAUDE.md
43
+ DEPLOYMENT.md
44
+ LICENSE
45
+ mkdocs.yml
46
+
47
+ # Test files
48
+ tests
49
+ *.test.py
50
+ test_*.py
51
+
52
+ # Development files
53
+ .env
54
+ .env.*
55
+ !.env.example
56
+ docker-compose*.yml
57
+ !docker-compose.yml
58
+ .pre-commit-config.yaml
59
+
60
+ # Logs
61
+ logs
62
+ *.log
63
+
64
+ # Models (exclude from build context)
65
+ models
66
+
67
+ # Temporary files
68
+ *.tmp
69
+ *.bak
70
+ key.pem
71
+
72
+ # CI/CD
73
+ .travis.yml
74
+ .gitlab-ci.yml
75
+
76
+ # Other
77
+ schemas/*.json
78
+ !schemas/*.schema.json
@@ -0,0 +1,181 @@
1
+ # Auto-generated example environment file for Horde Model Reference
2
+ # This file is generated by the settings_doc package.
3
+ # Do not edit this file manually.
4
+
5
+ # Generated on (UTC): 2025-10-25 12:29:16
6
+
7
+ # DEPLOYMENT QUICK START GUIDE
8
+
9
+ # Choose your deployment scenario and uncomment the relevant settings below:
10
+
11
+ # 1. REPLICA MODE (Default) - Client/Worker nodes
12
+ # - Uses GitHub or PRIMARY API to fetch model references
13
+ # - Set: HORDE_MODEL_REFERENCE_REPLICATE_MODE=REPLICA
14
+ # - Optionally set: HORDE_MODEL_REFERENCE_PRIMARY_API_URL=<your-primary-url>
15
+
16
+ # 2. PRIMARY MODE - Single Worker (No Redis)
17
+ # - Authoritative source for model references
18
+ # - Set: HORDE_MODEL_REFERENCE_REPLICATE_MODE=PRIMARY
19
+ # - No Redis configuration needed
20
+ # - Ideal for: Development, testing, low-traffic deployments
21
+
22
+ # 3. PRIMARY MODE - Multi-Worker (With Redis)
23
+ # - Authoritative source with distributed caching
24
+ # - Set: HORDE_MODEL_REFERENCE_REPLICATE_MODE=PRIMARY
25
+ # - Configure all HORDE_MODEL_REFERENCE_REDIS_* settings
26
+ # - Ideal for: Production, high-traffic deployments
27
+
28
+ # For detailed deployment instructions, see:
29
+ # - Docker: docker-compose.yml (single-worker)
30
+ # - Docker + Redis: docker-compose.redis.yml (multi-worker)
31
+ # - Non-Docker: DEPLOYMENT.md
32
+
33
+
34
+ ################################################################################
35
+ # Horde Model Reference Settings
36
+ ################################################################################
37
+
38
+ # Indicates if copies of the model reference are canonical or replicated. Clients should always be replicas.
39
+ # Possible values:
40
+ # `PRIMARY`, `REPLICA`
41
+ # HORDE_MODEL_REFERENCE_REPLICATE_MODE=REPLICA
42
+
43
+ # Whether to create the default model reference folders on initialization.
44
+ # HORDE_MODEL_REFERENCE_MAKE_FOLDERS=False
45
+
46
+ # The GitHub owner of the repository.
47
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_OWNER=Haidra-Org
48
+
49
+ # The name of the GitHub repository used for image model references.
50
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_NAME=AI-Horde-image-model-reference
51
+
52
+ # The GitHub branch of the repository.
53
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_BRANCH=main
54
+
55
+ # Settings for the GitHub proxy, if any.
56
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_PROXY_SETTINGS=
57
+
58
+ # The GitHub owner of the repository.
59
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_OWNER=Haidra-Org
60
+
61
+ # The name of the GitHub repository used for text model references.
62
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_NAME=AI-Horde-text-model-reference
63
+
64
+ # The GitHub branch of the repository.
65
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_BRANCH=main
66
+
67
+ # Settings for the GitHub proxy, if any.
68
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_PROXY_SETTINGS=
69
+
70
+ # The time-to-live for in memory caches of model reference files, in seconds.
71
+ # HORDE_MODEL_REFERENCE_CACHE_TTL_SECONDS=60
72
+
73
+ # The maximum number of attempts to retry downloading a legacy model reference file.
74
+ # HORDE_MODEL_REFERENCE_LEGACY_DOWNLOAD_RETRY_MAX_ATTEMPTS=3
75
+
76
+ # The backoff time in seconds between retry attempts when downloading a legacy model reference file.
77
+ # HORDE_MODEL_REFERENCE_LEGACY_DOWNLOAD_RETRY_BACKOFF_SECONDS=2
78
+
79
+ # Whether to use Redis for distributed caching. Only should be used in PRIMARY mode.
80
+ # HORDE_MODEL_REFERENCE_REDIS_USE_REDIS=False
81
+
82
+ # Redis connection URL. Format: redis://[:password]@host:port/db
83
+ # HORDE_MODEL_REFERENCE_REDIS_URL=redis://localhost:6379/0
84
+
85
+ # Connection pool size for Redis connections.
86
+ # HORDE_MODEL_REFERENCE_REDIS_POOL_SIZE=10
87
+
88
+ # Socket timeout in seconds for Redis operations.
89
+ # HORDE_MODEL_REFERENCE_REDIS_SOCKET_TIMEOUT=5
90
+
91
+ # Connection timeout in seconds when establishing Redis connection.
92
+ # HORDE_MODEL_REFERENCE_REDIS_SOCKET_CONNECT_TIMEOUT=5
93
+
94
+ # Maximum number of retry attempts for failed Redis operations.
95
+ # HORDE_MODEL_REFERENCE_REDIS_RETRY_MAX_ATTEMPTS=3
96
+
97
+ # Backoff time in seconds between retry attempts for Redis operations.
98
+ # HORDE_MODEL_REFERENCE_REDIS_RETRY_BACKOFF_SECONDS=0.5
99
+
100
+ # Prefix for all Redis keys to namespace model reference data.
101
+ # HORDE_MODEL_REFERENCE_REDIS_KEY_PREFIX=horde:model_ref
102
+
103
+ # TTL for cached entries in seconds. If None, uses cache_ttl_seconds from main settings.
104
+ # HORDE_MODEL_REFERENCE_REDIS_TTL_SECONDS=
105
+
106
+ # Enable pub/sub for cache invalidation across multiple PRIMARY workers.
107
+ # HORDE_MODEL_REFERENCE_REDIS_USE_PUBSUB=True
108
+
109
+ # URL of PRIMARY server API for REPLICA clients to fetch model references from. If None, REPLICA clients will only use GitHub. Example: https://stablehorde.net/api/model_references/
110
+ # HORDE_MODEL_REFERENCE_PRIMARY_API_URL=https://stablehorde.net/api/model_references/
111
+
112
+ # Timeout in seconds for HTTP requests to PRIMARY API.
113
+ # HORDE_MODEL_REFERENCE_PRIMARY_API_TIMEOUT=10
114
+
115
+ # Whether REPLICA clients should fallback to GitHub if PRIMARY API is unavailable.
116
+ # HORDE_MODEL_REFERENCE_ENABLE_GITHUB_FALLBACK=True
117
+
118
+ # Whether PRIMARY mode should seed from GitHub on first initialization if local files don't exist. Only used in PRIMARY mode. If True, will download and convert legacy references once on startup.
119
+ # HORDE_MODEL_REFERENCE_GITHUB_SEED_ENABLED=False
120
+
121
+ # Which format is the canonical source of truth. Controls which API has write access. 'v2' (default): v2 API has CRUD, v1 API is read-only (converts from v2 to legacy). 'legacy': v1 API has CRUD, v2 API is read-only (converts from legacy to v2).
122
+ # Possible values:
123
+ # `legacy`, `v2`
124
+ # HORDE_MODEL_REFERENCE_CANONICAL_FORMAT=v2
125
+
126
+
127
+
128
+ ################################################################################
129
+ # AI Horde Client+Worker Settings
130
+ ################################################################################
131
+
132
+ # The URL for this AI Horde instance. If more than one, additional URLs are in the field `alt_horde_urls`.
133
+ # HORDE_URL=https://aihorde.net/api/
134
+
135
+ # Alternative API endpoints for the AI Horde. These should all lead to the same logical AI Horde.
136
+ # ALT_HORDE_URLS=[HttpUrl('https://stablehorde.net/api/')]
137
+
138
+ # The API key used for authenticating requests to the AI Horde.
139
+ # API_KEY=**********
140
+
141
+ # The API endpoint for AI Horde ratings.
142
+ # RATINGS_URL=https://ratings.aihorde.net/api/
143
+
144
+ # The folder where application logs are stored.
145
+ # LOGS_FOLDER=./logs
146
+
147
+ # The folder where AI worker (or client) files are stored, most notably models and checkpoints.
148
+ # AIWORKER_CACHE_HOME=./models
149
+
150
+ # The hugging face home directory.
151
+ # HF_HOME=~/.cache/huggingface
152
+
153
+ # The standard XDG cache directory.
154
+ # XDG_CACHE_HOME=~/.cache/
155
+
156
+
157
+
158
+ ################################################################################
159
+ # Github Proxying Settings
160
+ ################################################################################
161
+
162
+ # The base URL for a http(s) GitHub proxy. If None, no proxy is used. This is intended for users where github may be blocked.
163
+ # GITHUB_PROXY_URL_BASE=
164
+
165
+
166
+
167
+ ################################################################################
168
+ # AI Horde CI Settings
169
+ ################################################################################
170
+
171
+ # Indicates if any CI/CD pipeline is ongoing.
172
+ # TESTS_ONGOING=False
173
+
174
+ # Indicates if the hordelib CI/CD pipeline is ongoing.
175
+ # HORDELIB_CI_ONGOING=False
176
+
177
+ # Indicates if the AI Horde SDK is currently being tested.
178
+ # HORDE_SDK_TESTING=False
179
+
180
+ # Indicates if the AI Horde is currently being tested.
181
+ # AI_HORDE_TESTING=False
@@ -0,0 +1,72 @@
1
+ # Example environment configuration for PRIMARY mode deployment
2
+ # Copy this to .env.primary and configure as needed
3
+
4
+ # ============================================================================
5
+ # PRIMARY Mode Configuration
6
+ # ============================================================================
7
+
8
+ # REQUIRED: Set to PRIMARY mode
9
+ HORDE_MODEL_REFERENCE_REPLICATE_MODE=PRIMARY
10
+
11
+ # Create folders automatically if they don't exist
12
+ HORDE_MODEL_REFERENCE_MAKE_FOLDERS=true
13
+
14
+ # Cache TTL in seconds (default: 60)
15
+ HORDE_MODEL_REFERENCE_CACHE_TTL_SECONDS=60
16
+
17
+ # ============================================================================
18
+ # Data Format Configuration
19
+ # ============================================================================
20
+
21
+ # Which format is canonical (controls which API has write access)
22
+ # - 'legacy': v1 API has CRUD, v2 API is read-only (converts from legacy to v2)
23
+ # - 'v2': v2 API has CRUD, v1 API is read-only (converts from v2 to legacy)
24
+ # Default is 'v2' but set to 'legacy' during transition period
25
+ HORDE_MODEL_REFERENCE_CANONICAL_FORMAT=legacy
26
+
27
+ # ============================================================================
28
+ # GitHub Seeding (First-Time Setup)
29
+ # ============================================================================
30
+
31
+ # Enable GitHub seeding on first startup if local files don't exist
32
+ # Set to 'true' for initial deployment, then change to 'false'
33
+ HORDE_MODEL_REFERENCE_GITHUB_SEED_ENABLED=false
34
+
35
+ # ============================================================================
36
+ # Redis Configuration (Multi-Worker Deployments Only)
37
+ # ============================================================================
38
+
39
+ # Enable Redis for distributed caching (required for multi-worker setups)
40
+ # HORDE_MODEL_REFERENCE_REDIS_USE_REDIS=true
41
+
42
+ # Redis connection URL
43
+ # HORDE_MODEL_REFERENCE_REDIS_URL=redis://redis:6379/0
44
+
45
+ # Redis connection pool size
46
+ # HORDE_MODEL_REFERENCE_REDIS_POOL_SIZE=10
47
+
48
+ # Redis TTL (uses cache_ttl_seconds if not specified)
49
+ # HORDE_MODEL_REFERENCE_REDIS_TTL_SECONDS=60
50
+
51
+ # Enable pub/sub for cache invalidation across workers
52
+ # HORDE_MODEL_REFERENCE_REDIS_USE_PUBSUB=true
53
+
54
+ # ============================================================================
55
+ # Data Directory
56
+ # ============================================================================
57
+
58
+ # Cache home directory (set by Docker, but can be overridden)
59
+ # AIWORKER_CACHE_HOME=/data
60
+
61
+ # ============================================================================
62
+ # Optional: GitHub Repository Overrides (for testing/forks)
63
+ # ============================================================================
64
+
65
+ # Override default GitHub repositories (uncomment to use)
66
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_OWNER=Haidra-Org
67
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_NAME=AI-Horde-image-model-reference
68
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_BRANCH=main
69
+
70
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_OWNER=Haidra-Org
71
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_NAME=AI-Horde-text-model-reference
72
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_BRANCH=main
@@ -0,0 +1,105 @@
1
+ # ============================================================================
2
+ # GitHub Sync Service Configuration
3
+ # ============================================================================
4
+ # Copy this file to .env.sync and configure for your environment
5
+ # Load with: docker-compose --env-file .env.sync --profile sync up -d
6
+
7
+ # ============================================================================
8
+ # GitHub Authentication - Choose ONE method
9
+ # ============================================================================
10
+
11
+ # METHOD 1: Personal Access Token (simpler, for individual use)
12
+ # Create at: https://github.com/settings/tokens
13
+ # Required scopes: Contents (Read & Write), Pull Requests (Read & Write)
14
+ # GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
15
+
16
+ # METHOD 2: GitHub App (recommended for production)
17
+ # Required scopes: Contents (Read & Write), Pull Requests (Read & Write)
18
+ # Setup instructions in SYNC_README.md
19
+ GITHUB_APP_ID=1234567
20
+ GITHUB_APP_INSTALLATION_ID=12345678
21
+
22
+ # Private Key: Choose ONE option
23
+ # Option A: Path to mounted PEM file (recommended for Docker)
24
+ GITHUB_APP_PRIVATE_KEY_PATH=/app/github-app-key.pem
25
+
26
+ # Option B: Inline key content (escape newlines as \n)
27
+ # GITHUB_APP_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----\nMIIE...\n-----END RSA PRIVATE KEY-----
28
+
29
+ # ============================================================================
30
+ # PRIMARY API Configuration
31
+ # ============================================================================
32
+
33
+ # URL of your PRIMARY instance (required)
34
+ # For Docker: use service name, e.g., http://horde-model-reference:19800
35
+ # For local: use localhost, e.g., http://localhost:19800
36
+ HORDE_GITHUB_SYNC_PRIMARY_API_URL=http://horde-model-reference:19800
37
+
38
+ # API request timeout in seconds
39
+ # HORDE_GITHUB_SYNC_PRIMARY_API_TIMEOUT=30
40
+
41
+ # ============================================================================
42
+ # GitHub Repository Configuration (Optional Overrides)
43
+ # ============================================================================
44
+
45
+ # Override default repositories (useful for testing with forks)
46
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_OWNER=Haidra-Org
47
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_NAME=AI-Horde-image-model-reference
48
+ # HORDE_MODEL_REFERENCE_IMAGE_GITHUB_REPO_BRANCH=main
49
+
50
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_OWNER=Haidra-Org
51
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_NAME=AI-Horde-text-model-reference
52
+ # HORDE_MODEL_REFERENCE_TEXT_GITHUB_REPO_BRANCH=main
53
+
54
+ # ============================================================================
55
+ # Sync Behavior
56
+ # ============================================================================
57
+
58
+ # Sync interval in seconds (default: 21600 = 6 hours)
59
+ SYNC_INTERVAL=21600
60
+
61
+ # Minimum number of changes required to create a PR
62
+ # HORDE_GITHUB_SYNC_MIN_CHANGES_THRESHOLD=1
63
+
64
+ # Comma-separated list of categories to sync (default: all)
65
+ # HORDE_GITHUB_SYNC_CATEGORIES_TO_SYNC=image_generation,text_generation
66
+
67
+ # Dry run mode - preview changes without creating PRs (true/false)
68
+ # HORDE_GITHUB_SYNC_DRY_RUN=false
69
+
70
+ # Enable verbose logging (true/false)
71
+ # HORDE_GITHUB_SYNC_VERBOSE_LOGGING=false
72
+
73
+ # ============================================================================
74
+ # Pull Request Configuration
75
+ # ============================================================================
76
+
77
+ # Comma-separated list of GitHub usernames to assign as reviewers
78
+ # HORDE_GITHUB_SYNC_PR_REVIEWERS=username1,username2
79
+
80
+ # Comma-separated list of labels to apply to PRs
81
+ # HORDE_GITHUB_SYNC_PR_LABELS=automated,sync,ready-for-review
82
+
83
+ # GitHub team to auto-assign for review (format: org-name/team-name)
84
+ # HORDE_GITHUB_SYNC_PR_AUTO_ASSIGN_TEAM=Haidra-Org/model-maintainers
85
+
86
+ # ============================================================================
87
+ # Git Commit Configuration
88
+ # ============================================================================
89
+
90
+ # Author/committer information for automated commits
91
+ GIT_AUTHOR_NAME=Horde Model Reference Bot
92
+ GIT_AUTHOR_EMAIL=bot@horde-model-reference.local
93
+ GIT_COMMITTER_NAME=Horde Model Reference Bot
94
+ GIT_COMMITTER_EMAIL=bot@horde-model-reference.local
95
+
96
+ # ============================================================================
97
+ # Advanced: Repository Clone Configuration
98
+ # ============================================================================
99
+
100
+ # Base directory for persistent repository clones (optional)
101
+ # If set, repos will be cloned once and reused across sync runs
102
+ # HORDE_GITHUB_SYNC_TARGET_CLONE_DIR=/data/github-repos
103
+
104
+ # Temporary directory for git operations (optional)
105
+ # HORDE_GITHUB_SYNC_SYNC_TEMP_DIR=/tmp/github-sync
@@ -53,11 +53,11 @@ jobs:
53
53
 
54
54
  steps:
55
55
  - name: Checkout repository
56
- uses: actions/checkout@v3
56
+ uses: actions/checkout@v4
57
57
 
58
58
  # Initializes the CodeQL tools for scanning.
59
59
  - name: Initialize CodeQL
60
- uses: github/codeql-action/init@v2
60
+ uses: github/codeql-action/init@v3
61
61
  with:
62
62
  languages: ${{ matrix.language }}
63
63
  # If you wish to specify custom queries, you can do so here or in a config file.
@@ -71,7 +71,7 @@ jobs:
71
71
  # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
72
72
  # If this step fails, then you should remove it and run the build manually (see below)
73
73
  - name: Autobuild
74
- uses: github/codeql-action/autobuild@v2
74
+ uses: github/codeql-action/autobuild@v3
75
75
 
76
76
  # ℹ️ Command-line programs to run using the OS shell.
77
77
  # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -84,6 +84,6 @@ jobs:
84
84
  # ./location_of_script_within_repo/buildscript.sh
85
85
 
86
86
  - name: Perform CodeQL Analysis
87
- uses: github/codeql-action/analyze@v2
87
+ uses: github/codeql-action/analyze@v3
88
88
  with:
89
89
  category: "/language:${{matrix.language}}"