Skip to content

Commit b4336d5

Browse files
authored
Fix to point to correct commit not just branch (#194) (#195)
1 parent 68eb9ab commit b4336d5

File tree

1 file changed

+50
-16
lines changed

1 file changed

+50
-16
lines changed

auto_doc.py

+50-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
16+
import os
1717
import pathlib
1818
import shutil
1919

@@ -28,7 +28,9 @@
2828
},
2929
"api/connection.md": {
3030
"connection_create": ["hopsworks.connection.Connection.connection"],
31-
"connection_properties": keras_autodoc.get_properties("hopsworks.connection.Connection"),
31+
"connection_properties": keras_autodoc.get_properties(
32+
"hopsworks.connection.Connection"
33+
),
3234
"connection_methods": keras_autodoc.get_methods(
3335
"hopsworks.connection.Connection", exclude=["from_response_json", "json"]
3436
),
@@ -56,25 +58,35 @@
5658
"api/executions.md": {
5759
"execution_create": ["hopsworks.job.Job.run"],
5860
"execution_get": ["hopsworks.job.Job.get_executions"],
59-
"execution_properties": keras_autodoc.get_properties("hopsworks.execution.Execution"),
61+
"execution_properties": keras_autodoc.get_properties(
62+
"hopsworks.execution.Execution"
63+
),
6064
"execution_methods": keras_autodoc.get_methods(
61-
"hopsworks.execution.Execution", exclude=["from_response_json", "json", "update_from_response_json"]
65+
"hopsworks.execution.Execution",
66+
exclude=["from_response_json", "json", "update_from_response_json"],
6267
),
6368
},
6469
"api/flink_cluster.md": {
6570
"flink_api_handle": ["hopsworks.project.Project.get_flink_cluster_api"],
66-
"setup_cluster": ["hopsworks.core.flink_cluster_api.FlinkClusterApi.setup_cluster"],
71+
"setup_cluster": [
72+
"hopsworks.core.flink_cluster_api.FlinkClusterApi.setup_cluster"
73+
],
6774
"get_cluster": ["hopsworks.core.flink_cluster_api.FlinkClusterApi.get_cluster"],
6875
"start_cluster": ["hopsworks.flink_cluster.FlinkCluster.start"],
6976
"submit_job_to_cluster": ["hopsworks.flink_cluster.FlinkCluster.submit_job"],
70-
"flink_cluster_properties": keras_autodoc.get_properties("hopsworks.flink_cluster.FlinkCluster"),
77+
"flink_cluster_properties": keras_autodoc.get_properties(
78+
"hopsworks.flink_cluster.FlinkCluster"
79+
),
7180
"flink_cluster_methods": keras_autodoc.get_methods(
72-
"hopsworks.flink_cluster.FlinkCluster", exclude=["from_response_json", "json"]
81+
"hopsworks.flink_cluster.FlinkCluster",
82+
exclude=["from_response_json", "json"],
7383
),
7484
},
7585
"api/environment.md": {
7686
"env_api_handle": ["hopsworks.project.Project.get_environment_api"],
77-
"env_create": ["hopsworks.core.environment_api.EnvironmentApi.create_environment"],
87+
"env_create": [
88+
"hopsworks.core.environment_api.EnvironmentApi.create_environment"
89+
],
7890
"env_get": ["hopsworks.core.environment_api.EnvironmentApi.get_environment"],
7991
"env_methods": keras_autodoc.get_methods(
8092
"hopsworks.environment.Environment", exclude=["from_response_json", "json"]
@@ -85,7 +97,9 @@
8597
"git_repo_clone": ["hopsworks.core.git_api.GitApi.clone"],
8698
"git_repo_get": ["hopsworks.core.git_api.GitApi.get_repo"],
8799
"git_repo_get_all": ["hopsworks.core.git_api.GitApi.get_repos"],
88-
"git_repo_properties": keras_autodoc.get_properties("hopsworks.git_repo.GitRepo"),
100+
"git_repo_properties": keras_autodoc.get_properties(
101+
"hopsworks.git_repo.GitRepo"
102+
),
89103
"git_repo_methods": keras_autodoc.get_methods(
90104
"hopsworks.git_repo.GitRepo", exclude=["from_response_json", "json"]
91105
),
@@ -95,7 +109,9 @@
95109
"git_provider_create": ["hopsworks.core.git_api.GitApi.set_provider"],
96110
"git_provider_get": ["hopsworks.core.git_api.GitApi.get_provider"],
97111
"git_provider_get_all": ["hopsworks.core.git_api.GitApi.get_providers"],
98-
"git_provider_properties": keras_autodoc.get_properties("hopsworks.git_provider.GitProvider"),
112+
"git_provider_properties": keras_autodoc.get_properties(
113+
"hopsworks.git_provider.GitProvider"
114+
),
99115
"git_provider_methods": keras_autodoc.get_methods(
100116
"hopsworks.git_provider.GitProvider", exclude=["from_response_json", "json"]
101117
),
@@ -105,7 +121,9 @@
105121
"git_remote_create": ["hopsworks.git_repo.GitRepo.add_remote"],
106122
"git_remote_get": ["hopsworks.git_repo.GitRepo.get_remote"],
107123
"git_remote_get_all": ["hopsworks.git_repo.GitRepo.get_remotes"],
108-
"git_remote_properties": keras_autodoc.get_properties("hopsworks.git_remote.GitRemote"),
124+
"git_remote_properties": keras_autodoc.get_properties(
125+
"hopsworks.git_remote.GitRemote"
126+
),
109127
"git_remote_methods": keras_autodoc.get_methods(
110128
"hopsworks.git_remote.GitRemote", exclude=["from_response_json", "json"]
111129
),
@@ -122,9 +140,12 @@
122140
"kafka_topic_create": ["hopsworks.core.kafka_api.KafkaApi.create_topic"],
123141
"kafka_topic_get": ["hopsworks.core.kafka_api.KafkaApi.get_topic"],
124142
"kafka_topic_get_all": ["hopsworks.core.kafka_api.KafkaApi.get_topics"],
125-
"kafka_topic_properties": keras_autodoc.get_properties("hopsworks.kafka_topic.KafkaTopic"),
143+
"kafka_topic_properties": keras_autodoc.get_properties(
144+
"hopsworks.kafka_topic.KafkaTopic"
145+
),
126146
"kafka_topic_methods": keras_autodoc.get_methods(
127-
"hopsworks.kafka_topic.KafkaTopic", exclude=["from_response_json", "json", "update_from_response_json"]
147+
"hopsworks.kafka_topic.KafkaTopic",
148+
exclude=["from_response_json", "json", "update_from_response_json"],
128149
),
129150
},
130151
"api/kafka_schema.md": {
@@ -133,9 +154,12 @@
133154
"kafka_schema_get": ["hopsworks.core.kafka_api.KafkaApi.get_schema"],
134155
"kafka_schema_get_all": ["hopsworks.core.kafka_api.KafkaApi.get_schemas"],
135156
"kafka_schema_get_subjects": ["hopsworks.core.kafka_api.KafkaApi.get_subjects"],
136-
"kafka_schema_properties": keras_autodoc.get_properties("hopsworks.kafka_schema.KafkaSchema"),
157+
"kafka_schema_properties": keras_autodoc.get_properties(
158+
"hopsworks.kafka_schema.KafkaSchema"
159+
),
137160
"kafka_schema_methods": keras_autodoc.get_methods(
138-
"hopsworks.kafka_schema.KafkaSchema", exclude=["from_response_json", "json", "update_from_response_json"]
161+
"hopsworks.kafka_schema.KafkaSchema",
162+
exclude=["from_response_json", "json", "update_from_response_json"],
139163
),
140164
},
141165
"api/secrets.md": {
@@ -157,12 +181,22 @@
157181
}
158182

159183
hw_dir = pathlib.Path(__file__).resolve().parents[0]
184+
if "GITHUB_SHA" in os.environ:
185+
commit_sha = os.environ["GITHUB_SHA"]
186+
project_url = (
187+
f"https://github.com/logicalclocks/feature-store-api/tree/{commit_sha}/python"
188+
)
189+
else:
190+
branch_name = os.environ.get("GITHUB_BASE_REF", "master")
191+
project_url = (
192+
f"https://github.com/logicalclocks/feature-store-api/blob/{branch_name}/python"
193+
)
160194

161195

162196
def generate(dest_dir):
163197
doc_generator = keras_autodoc.DocumentationGenerator(
164198
PAGES,
165-
project_url="https://github.com/logicalclocks/hopsworks-api/blob/master/python",
199+
project_url=project_url,
166200
template_dir="./docs/templates",
167201
titles_size="###",
168202
extra_aliases={},

0 commit comments

Comments
 (0)