forked from logicalclocks/feature-store-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_doc.py
384 lines (376 loc) · 15.4 KB
/
auto_doc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
import os
import pathlib
import shutil
import keras_autodoc
PAGES = {
"api/connection_api.md": {
"connection": ["hsfs.connection.Connection"],
"connection_properties": keras_autodoc.get_properties(
"hsfs.connection.Connection"
),
"connection_methods": keras_autodoc.get_methods("hsfs.connection.Connection"),
},
"api/spine_group_api.md": {
"fg": ["hsfs.feature_group.SpineGroup"],
"fg_create": ["hsfs.feature_store.FeatureStore.get_or_create_spine_group"],
"fg_get": ["hsfs.feature_store.FeatureStore.get_or_create_spine_group"],
"fg_properties": keras_autodoc.get_properties(
"hsfs.feature_group.SpineGroup",
exclude=[
"expectation_suite",
"location",
"online_enabled",
"statistics",
"statistics_config",
"subject",
],
),
"fg_methods": keras_autodoc.get_methods(
"hsfs.feature_group.SpineGroup",
exclude=[
"append_features",
"compute_statistics",
"delete_expectation_suite",
"from_response_json",
"get_all_validation_reports",
"get_expectation_suite",
"get_latest_validation_report",
"get_statistics",
"get_validation_history",
"save_expectation_suite",
"save_validation_report",
"update_from_response_json",
"update_statistics_config",
"validate",
],
),
},
"api/training_dataset_api.md": {
"td": ["hsfs.training_dataset.TrainingDataset"],
"td_create": ["hsfs.feature_store.FeatureStore.create_training_dataset"],
"td_get": ["hsfs.feature_store.FeatureStore.get_training_dataset"],
"td_properties": keras_autodoc.get_properties(
"hsfs.training_dataset.TrainingDataset"
),
"td_methods": keras_autodoc.get_methods(
"hsfs.training_dataset.TrainingDataset"
),
},
"api/feature_view_api.md": {
"fv": ["hsfs.feature_view.FeatureView"],
"fv_create": ["hsfs.feature_store.FeatureStore.create_feature_view"],
"fv_get": ["hsfs.feature_store.FeatureStore.get_feature_view"],
"fvs_get": ["hsfs.feature_store.FeatureStore.get_feature_views"],
"fv_properties": keras_autodoc.get_properties("hsfs.feature_view.FeatureView"),
"fv_methods": keras_autodoc.get_methods("hsfs.feature_view.FeatureView"),
},
"api/feature_api.md": {
"feature": ["hsfs.feature.Feature"],
"feature_properties": keras_autodoc.get_properties("hsfs.feature.Feature"),
"feature_methods": keras_autodoc.get_methods("hsfs.feature.Feature"),
},
"api/expectation_suite_api.md": {
"expectation_suite": ["hsfs.expectation_suite.ExpectationSuite"],
"expectation_suite_attach": [
"hsfs.feature_group.FeatureGroup.save_expectation_suite"
],
"single_expectation_api": [
"hsfs.expectation_suite.ExpectationSuite.add_expectation",
"hsfs.expectation_suite.ExpectationSuite.replace_expectation",
"hsfs.expectation_suite.ExpectationSuite.remove_expectation",
],
"expectation_suite_properties": keras_autodoc.get_properties(
"hsfs.expectation_suite.ExpectationSuite"
),
"expectation_suite_methods": keras_autodoc.get_methods(
"hsfs.expectation_suite.ExpectationSuite"
),
},
"api/feature_store_api.md": {
"fs": ["hsfs.feature_store.FeatureStore"],
"fs_get": ["hsfs.connection.Connection.get_feature_store"],
"fs_properties": keras_autodoc.get_properties(
"hsfs.feature_store.FeatureStore"
),
"fs_methods": keras_autodoc.get_methods("hsfs.feature_store.FeatureStore"),
},
"api/feature_group_api.md": {
"fg": ["hsfs.feature_group.FeatureGroup"],
"fg_create": [
"hsfs.feature_store.FeatureStore.create_feature_group",
"hsfs.feature_store.FeatureStore.get_or_create_feature_group",
],
"fg_get": ["hsfs.feature_store.FeatureStore.get_feature_group"],
"fg_properties": keras_autodoc.get_properties(
"hsfs.feature_group.FeatureGroup"
),
"fg_methods": keras_autodoc.get_methods("hsfs.feature_group.FeatureGroup"),
},
"api/external_feature_group_api.md": {
"fg": ["hsfs.feature_group.ExternalFeatureGroup"],
"fg_create": ["hsfs.feature_store.FeatureStore.create_external_feature_group"],
"fg_get": ["hsfs.feature_store.FeatureStore.get_external_feature_group"],
"fg_properties": keras_autodoc.get_properties(
"hsfs.feature_group.ExternalFeatureGroup"
),
"fg_methods": keras_autodoc.get_methods(
"hsfs.feature_group.ExternalFeatureGroup"
),
},
"api/storage_connector_api.md": {
"sc_get": [
"hsfs.feature_store.FeatureStore.get_storage_connector",
"hsfs.feature_store.FeatureStore.get_online_storage_connector",
],
"hopsfs_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.HopsFSConnector", exclude=["from_response_json"]
),
"hopsfs_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.HopsFSConnector"
),
"s3_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.S3Connector", exclude=["from_response_json"]
),
"s3_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.S3Connector"
),
"redshift_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.RedshiftConnector", exclude=["from_response_json"]
),
"redshift_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.RedshiftConnector"
),
"adls_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.AdlsConnector", exclude=["from_response_json"]
),
"adls_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.AdlsConnector"
),
"snowflake_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.SnowflakeConnector", exclude=["from_response_json"]
),
"snowflake_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.SnowflakeConnector"
),
"jdbc_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.JdbcConnector", exclude=["from_response_json"]
),
"jdbc_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.JdbcConnector"
),
"gcs_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.GcsConnector", exclude=["from_response_json"]
),
"gcs_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.GcsConnector"
),
"bigquery_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.BigQueryConnector", exclude=["from_response_json"]
),
"bigquery_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.BigQueryConnector"
),
"kafka_methods": keras_autodoc.get_methods(
"hsfs.storage_connector.KafkaConnector", exclude=["from_response_json"]
),
"kafka_properties": keras_autodoc.get_properties(
"hsfs.storage_connector.KafkaConnector"
),
},
"api/statistics_config_api.md": {
"statistics_config": ["hsfs.statistics_config.StatisticsConfig"],
"statistics_config_properties": keras_autodoc.get_properties(
"hsfs.statistics_config.StatisticsConfig"
),
},
"api/transformation_functions_api.md": {
"transformation_function": [
"hsfs.transformation_function.TransformationFunction"
],
"transformation_function_properties": keras_autodoc.get_properties(
"hsfs.transformation_function.TransformationFunction"
),
"transformation_function_methods": keras_autodoc.get_methods(
"hsfs.transformation_function.TransformationFunction",
exclude=[
"from_response_json",
"update_from_response_json",
"json",
"to_dict",
],
),
"create_transformation_function": [
"hsfs.feature_store.FeatureStore.create_transformation_function"
],
"get_transformation_function": [
"hsfs.feature_store.FeatureStore.get_transformation_function"
],
"get_transformation_functions": [
"hsfs.feature_store.FeatureStore.get_transformation_functions"
],
},
"api/validation_report_api.md": {
"validation_report": ["hsfs.validation_report.ValidationReport"],
"validation_report_validate": [
"hsfs.feature_group.FeatureGroup.validate",
"hsfs.feature_group.FeatureGroup.insert",
],
"validation_report_get": [
"hsfs.feature_group.FeatureGroup.get_latest_validation_report",
"hsfs.feature_group.FeatureGroup.get_all_validation_reports",
],
"validation_report_properties": keras_autodoc.get_properties(
"hsfs.validation_report.ValidationReport"
),
"validation_report_methods": keras_autodoc.get_methods(
"hsfs.validation_report.ValidationReport"
),
},
"api/job.md": {
"job_configuration": ["hsfs.core.job_configuration.JobConfiguration"],
"job": ["hsfs.core.job.Job"],
"job_methods": [
"hsfs.core.job.Job.get_state",
"hsfs.core.job.Job.get_final_state",
],
},
"api/query_api.md": {
"query_methods": keras_autodoc.get_methods(
"hsfs.constructor.query.Query",
exclude=["json", "to_dict"],
),
"query_properties": keras_autodoc.get_properties(
"hsfs.constructor.query.Query"
),
},
"api/links.md": {
"links_properties": keras_autodoc.get_properties(
"hsfs.core.explicit_provenance.Links"
),
"artifact_properties": keras_autodoc.get_properties(
"hsfs.core.explicit_provenance.Artifact"
),
},
"api/statistics_api.md": {
"statistics": ["hsfs.statistics.Statistics"],
"statistics_properties": keras_autodoc.get_properties(
"hsfs.statistics.Statistics"
),
},
"api/split_statistics_api.md": {
"split_statistics": ["hsfs.split_statistics.SplitStatistics"],
"split_statistics_properties": keras_autodoc.get_properties(
"hsfs.split_statistics.SplitStatistics"
),
},
"api/feature_descriptive_statistics_api.md": {
"feature_descriptive_statistics": [
"hsfs.core.feature_descriptive_statistics.FeatureDescriptiveStatistics"
],
"feature_descriptive_statistics_properties": keras_autodoc.get_properties(
"hsfs.core.feature_descriptive_statistics.FeatureDescriptiveStatistics"
),
},
"api/feature_monitoring_config_api.md": {
"feature_monitoring_config": [
"hsfs.core.feature_monitoring_config.FeatureMonitoringConfig"
],
"feature_monitoring_config_properties": keras_autodoc.get_properties(
"hsfs.core.feature_monitoring_config.FeatureMonitoringConfig"
),
"feature_monitoring_config_methods": keras_autodoc.get_methods(
"hsfs.core.feature_monitoring_config.FeatureMonitoringConfig",
exclude=[
"from_response_json",
"update_from_response_json",
"json",
"to_dict",
],
),
# from feature group
"feature_monitoring_config_creation_fg": [
"hsfs.feature_group.FeatureGroup.create_statistics_monitoring",
"hsfs.feature_group.FeatureGroup.create_feature_monitoring",
],
# from feature view
"feature_monitoring_config_creation_fv": [
"hsfs.feature_view.FeatureView.create_statistics_monitoring",
"hsfs.feature_view.FeatureView.create_feature_monitoring",
],
# retrieval
"feature_monitoring_config_retrieval_fg": [
"hsfs.feature_group.FeatureGroup.get_feature_monitoring_configs",
],
"feature_monitoring_config_retrieval_fv": [
"hsfs.feature_view.FeatureView.get_feature_monitoring_configs",
],
},
"api/feature_monitoring_result_api.md": {
"feature_monitoring_result": [
"hsfs.core.feature_monitoring_result.FeatureMonitoringResult"
],
"feature_monitoring_result_retrieval": [
"hsfs.core.feature_monitoring_config.FeatureMonitoringConfig.get_history"
],
"feature_monitoring_result_properties": keras_autodoc.get_properties(
"hsfs.core.feature_monitoring_result.FeatureMonitoringResult"
),
},
"api/feature_monitoring_window_config_api.md": {
"feature_monitoring_window_config": [
"hsfs.core.monitoring_window_config.MonitoringWindowConfig"
],
"feature_monitoring_window_config_properties": keras_autodoc.get_properties(
"hsfs.core.monitoring_window_config.MonitoringWindowConfig"
),
},
"api/embedding_index_api.md": {
"embedding_index": ["hsfs.embedding.EmbeddingIndex"],
"embedding_index_properties": keras_autodoc.get_properties(
"hsfs.embedding.EmbeddingIndex"
),
"embedding_index_methods": keras_autodoc.get_methods(
"hsfs.embedding.EmbeddingIndex", exclude=["from_response_json"]
),
},
"api/embedding_feature_api.md": {
"embedding_feature": ["hsfs.embedding.EmbeddingFeature"],
"embedding_feature_properties": keras_autodoc.get_properties(
"hsfs.embedding.EmbeddingFeature"
),
},
"api/similarity_function_type_api.md": {
"similarity_function_type": ["hsfs.embedding.SimilarityFunctionType"],
},
}
hsfs_dir = pathlib.Path(__file__).resolve().parents[0]
if "GITHUB_SHA" in os.environ:
commit_sha = os.environ["GITHUB_SHA"]
project_url = (
f"https://github.com/logicalclocks/feature-store-api/tree/{commit_sha}/python"
)
else:
branch_name = os.environ.get("GITHUB_BASE_REF", "master")
project_url = (
f"https://github.com/logicalclocks/feature-store-api/blob/{branch_name}/python"
)
def generate(dest_dir):
doc_generator = keras_autodoc.DocumentationGenerator(
PAGES,
project_url=project_url,
template_dir="./docs/templates",
titles_size="###",
extra_aliases={
"hsfs.core.query.Query": "hsfs.Query",
"hsfs.storage_connector.StorageConnector": "hsfs.StorageConnector",
"hsfs.statistics_config.StatisticsConfig": "hsfs.StatisticsConfig",
"hsfs.training_dataset_feature.TrainingDatasetFeature": "hsfs.TrainingDatasetFeature",
"pandas.core.frame.DataFrame": "pandas.DataFrame",
},
max_signature_line_length=100,
)
shutil.copyfile(hsfs_dir / "CONTRIBUTING.md", dest_dir / "CONTRIBUTING.md")
shutil.copyfile(hsfs_dir / "README.md", dest_dir / "index.md")
doc_generator.generate(dest_dir / "generated")
if __name__ == "__main__":
generate(hsfs_dir / "docs")