diff --git a/.github/workflows/mkdocs-release.yml b/.github/workflows/mkdocs-release.yml index 63ffc0f23..4a751fc7d 100644 --- a/.github/workflows/mkdocs-release.yml +++ b/.github/workflows/mkdocs-release.yml @@ -59,7 +59,7 @@ jobs: - name: Checkout the API repo uses: actions/checkout@v4 with: - repository: logicalclocks/hopsworks-api + repository: aversey/hopsworks-api ref: ${{ env.BRANCH }} path: hopsworks-api diff --git a/.github/workflows/mkdocs-test.yml b/.github/workflows/mkdocs-test.yml index fa2c942f1..93a8527f6 100644 --- a/.github/workflows/mkdocs-test.yml +++ b/.github/workflows/mkdocs-test.yml @@ -15,7 +15,7 @@ jobs: - name: Checkout the API repo uses: actions/checkout@v4 with: - repository: logicalclocks/hopsworks-api + repository: aversey/hopsworks-api ref: ${{ github.base_ref }} path: hopsworks-api diff --git a/docs/css/custom.css b/docs/css/custom.css index c09c2be37..26f7a273c 100644 --- a/docs/css/custom.css +++ b/docs/css/custom.css @@ -171,24 +171,21 @@ /*******************************************************/ /* Fix z-index. */ -header.md-header { - z-index: 900 !important; +.md-overlay { + z-index: 800 !important; } .md-sidebar { - z-index: 1000 !important; + z-index: 900 !important; } -.md-overlay { - z-index: 950 !important; +header.md-header { + z-index: 1000 !important; } .md-search__overlay { z-index: 1100 !important; } -.md-search__form { +.md-search__inner { z-index: 1200 !important; } -.md-search__output { - z-index: 1100 !important; -} /*******************************************************/ /* Hide repo stats. */ @@ -196,6 +193,18 @@ header.md-header { display: none; } +/*******************************************************/ +/* Hide empty backlinks. */ +.info-backlinks:has(.doc-backlink-list:empty) { + display: none; +} + +/*******************************************************/ +/* Hide symbol type labels from backlinks. */ +.doc-backlink-crumb .doc-symbol { + display: none; +} + /*******************************************************/ /* Custom styles for syntax highlighting in signatures. */ diff --git a/docs/templates/python/material/attribute.html.jinja b/docs/templates/python/material/attribute.html.jinja index 97eb8ebe3..f5d1fe083 100644 --- a/docs/templates/python/material/attribute.html.jinja +++ b/docs/templates/python/material/attribute.html.jinja @@ -1,12 +1,130 @@ -{% extends "_base/attribute.html.jinja" %} +{#- Template for Python attributes. -{% block heading scoped %} - {% block source_link scoped %} - {% if config.extra.link_source and attribute.source_link %} - [source] +This template renders a Python attribute (or variable). +This can be a module attribute or a class attribute. + +Context: + attribute (griffe.Attribute): The attribute to render. + root (bool): Whether this is the root object, injected with `:::` in a Markdown page. + heading_level (int): The HTML heading level to use. + config (dict): The configuration options. +-#} + +{% block logs scoped %} + {#- Logging block. + + This block can be used to log debug messages, deprecation messages, warnings, etc. + -#} + {{ log.debug("Rendering " + attribute.path) }} +{% endblock logs %} + +
'|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the attribute.
+ -#}
+ {% block source_link scoped %}
+ {% if config.extra.link_source and attribute.source_link %}
+ [source]
+ {% endif %}
+ {% endblock source_link %}
+
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ attribute_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ attribute_name }}{% if attribute.annotation and config.show_signature_annotations %}: {{ attribute.annotation }}{% endif %}
+ {% if config.show_attribute_values and attribute.value %} = {{ attribute.value }}{% endif %}
+ {% endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the attribute.
+ -#}
+ {% with labels = attribute.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the attribute.
+ -#}
+ {% if config.separate_signature and (attribute.value or attribute.annotation) %}
+ {% filter format_attribute(attribute, config.line_length, crossrefs=config.signature_crossrefs, show_value=config.show_attribute_values) %}
+ {{ attribute.name }}
+ {% endfilter %}
+ {% endif %}
+ {% endblock signature %}
+
+ {% else %}
+
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="data" if attribute.parent.kind.value == "module" else "attr",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else attribute_name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
{% endif %}
- {% endblock source_link %}
- {{ super() }}
+ {{ crumb.parent.title | replace(" ", "") | safe }}.{{ crumb.title | replace(" ", "") | safe }}
+ {% endif %}
+
+{% endmacro %}
+
+
+{%- for backlink in backlinks["returned-by"] | sort(attribute="crumbs") -%}
+ '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the class.
+ -#}
+ {% block alias_anchors scoped %}
+ {% if class.extra.hopsworks_apigen and class.extra.hopsworks_apigen.aliases %}
+ {% for alias in class.extra.hopsworks_apigen.aliases -%}
+ {%- set alias_id = alias.target_module + "." + alias.alias_name -%}
+ {% filter heading(
+ 9,
+ role="class",
+ id=alias_id,
+ class="doc doc-heading",
+ hidden=true,
+ skip_inventory=config.skip_local_inventory,
+ ) -%}{%- endfilter %}
+ {%- endfor %}
+ {% endif %}
+ {% endblock alias_anchors %}
+
+ {% block source_link scoped %}
+ {% if config.extra.link_source and class.source_link %}
+ [source]
+ {% endif %}
+ {% endblock source_link %}
+
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ class_name }}
+ {% elif config.merge_init_into_class and "__init__" in all_members %}
+ {% with function = all_members["__init__"] %}
+ {%+ filter highlight(language="python", inline=True) %}
+ {{ class_name -}}
+ {%- with obj = function -%}
+ {%- include "type_parameters.html.jinja" with context -%}
+ {%- endwith -%}
+ {%- include "signature.html.jinja" with context -%}
+ {% endfilter %}
+ {% endwith %}
+ {% else %}
+ {# TODO: Maybe render type parameters here. #}
+ {{ class_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the class.
+ -#}
+ {% with labels = class.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the class.
+ Overloads of the `__init__` method are rendered if `merge_init_into_class` is enabled.
+ The actual `__init__` method signature is only rendered if `separate_signature` is also enabled.
+
+ If the class is generic, but the `__init__` method isn't or `merge_init_into_class` is disabled,
+ the class signature is rendered if `separate_signature` and `show_signature_type_parameters` are enabled.
+
+ If the `__init__` method or any overloads are generic, they are rendered as methods if
+ `merge_init_into_class`, `separate_signature` and `show_signature_type_parameters` are enabled.
+ -#}
+ {% if config.merge_init_into_class and "__init__" in all_members %}
+ {% with function = all_members["__init__"] %}
+ {% if function.overloads and config.show_overloads %}
+ '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else class.name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ Bases: {% for expression in class.bases -%}
+
+ {%- with backlink_type = "subclassed-by" -%}
+ {%- include "expression.html.jinja" with context -%}
+ {%- endwith -%}
+ {% if not loop.last %}, {% endif %}
+ {% endfor -%}
+
+ flowchart {{ config.inheritance_diagram_direction }}
+ {{ class.path }}[{{ class.name }}]
+ {% for base in class.mro() %}
+ {{ base.path }}[{{ base.name }}]
+ {% endfor %}
+
+ {{ edges(class) | safe }}
+
+ click {{ class.path }} href "" "{{ class.path }}"
+ {% for base in class.mro() %}
+ click {{ base.path }} href "" "{{ base.path }}"
+ {% endfor %}
+
+
+ {% endif %}
+ {% endblock inheritance_diagram %}
+
+ {% block docstring scoped %}
+ {#- Docstring block.
+
+ This block renders the docstring for the class.
+ -#}
+ {% with docstring_sections = class.docstring.parsed %}
+ {% include "docstring.html.jinja" with context %}
+ {% endwith %}
+ {% if config.merge_init_into_class %}
+ {# We don't want to merge the inherited `__init__` method docstring into the class docstring #}
+ {# if such inherited method was not selected through `inherited_members`. #}
+ {% with check_members = all_members if (config.inherited_members is true or (config.inherited_members is iterable and "__init__" in config.inherited_members)) else class.members %}
+ {% if "__init__" in check_members and check_members["__init__"].has_docstring %}
+ {% with function = check_members["__init__"] %}
+ {% with obj = function, docstring_sections = function.docstring.parsed %}
+ {% include "docstring.html.jinja" with context %}
+ {% endwith %}
+ {% endwith %}
+ {% endif %}
+ {% endwith %}
+ {% endif %}
+ {% endblock docstring %}
+
+ {% block aliases scoped %}
+ {% if class.extra.hopsworks_apigen and class.extra.hopsworks_apigen.aliases %}
+ {%- set public_aliases = class.extra.hopsworks_apigen.aliases | selectattr("is_public") | list -%}
+ {% if public_aliases and public_aliases[1:] %}
+
+ For backwards compatibility
+ {% set fullpath = public_aliases[0].target_module + "." + public_aliases[0].alias_name %}
+ {{fullpath}}
+ is still available as
+ {% for alias in public_aliases[1:] -%}
+ {%- set fullpath = alias.target_module + "." + alias.alias_name -%}
+ {{fullpath}}
+ {%- if not loop.last %}, {% endif %}
+ {%- endfor %}.
+ {% if public_aliases[2:] %}
+ The use of these aliases is discouraged as they are to be deprecated.
+ {% else %}
+ The use of this alias is discouraged as it is to be deprecated.
+ {% endif %}
+
+ {%- if init.relative_filepath.is_absolute() -%}
+ {{ init.relative_package_filepath }}
+ {%- else -%}
+ {{ init.relative_filepath }}
+ {%- endif -%}
+
+ {%- if class.relative_filepath.is_absolute() -%}
+ {{ class.relative_package_filepath }}
+ {%- else -%}
+ {{ class.relative_filepath }}
+ {%- endif -%}
+ ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the function.
+ -#}
+ {% block alias_anchors scoped %}
+ {% if function.extra.hopsworks_apigen and function.extra.hopsworks_apigen.aliases %}
+ {% for alias in function.extra.hopsworks_apigen.aliases -%}
+ {%- set alias_id = alias.target_module + "." + alias.alias_name -%}
+ {% filter heading(
+ 9,
+ role="function",
+ id=alias_id,
+ class="doc doc-heading",
+ hidden=true,
+ skip_inventory=config.skip_local_inventory,
+ ) -%}{%- endfilter %}
+ {%- endfor %}
+ {% endif %}
+ {% if function.parent and function.parent.extra.hopsworks_apigen and function.parent.extra.hopsworks_apigen.aliases %}
+ {% for alias in function.parent.extra.hopsworks_apigen.aliases -%}
+ {%- set alias_id = alias.target_module + "." + alias.alias_name + "." + function.name -%}
+ {% filter heading(
+ 9,
+ role="function",
+ id=alias_id,
+ class="doc doc-heading",
+ hidden=true,
+ skip_inventory=config.skip_local_inventory,
+ ) -%}{%- endfilter %}
+ {%- endfor %}
+ {% endif %}
+ {% endblock alias_anchors %}
+
+ {% block source_link scoped %}
+ {% if config.extra.link_source and function.source_link %}
+ [source]
+ {% endif %}
+ {% endblock source_link %}
+
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ function_name }}
+ {% else %}
+ {%+ filter highlight(language="python", inline=True) -%}
+ {{ function_name }}
+ {%- include "type_parameters.html.jinja" with context -%}
+ {%- include "signature.html.jinja" with context -%}
+ {%- endfilter %}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the function.
+ -#}
+ {% with labels = function.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% block signature scoped %}
+ {#- Signature block.
+
+ This block renders the signature for the function,
+ as well as its overloaded signatures if any.
+ -#}
+ {% if function.overloads and config.show_overloads %}
+ ')|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else function.name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+
+ For backwards compatibility
+ {% set fullpath = public_aliases[0].target_module + "." + public_aliases[0].alias_name %}
+ {{fullpath}}
+ is still available as
+ {% for alias in public_aliases[1:] -%}
+ {%- set fullpath = alias.target_module + "." + alias.alias_name -%}
+ {{fullpath}}
+ {%- if not loop.last %}, {% endif %}
+ {%- endfor %}.
+ {% if public_aliases[2:] %}
+ The use of these aliases is discouraged as they are to be deprecated.
+ {% else %}
+ The use of this alias is discouraged as it is to be deprecated.
+ {% endif %}
+
+ {%- if function.relative_filepath.is_absolute() -%}
+ {{ function.relative_package_filepath }}
+ {%- else -%}
+ {{ function.relative_filepath }}
+ {%- endif -%}
+ '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+
+ {% block heading scoped %}
+ {#- Heading block.
+
+ This block renders the heading for the module.
+ -#}
+ {% block source_link scoped %}
+ {% if config.extra.link_source and module.source_link %}
+ [source]
+ {% endif %}
+ {% endblock source_link %}
+
+ {% if config.show_symbol_type_heading %}{% endif %}
+ {% if config.heading and root %}
+ {{ config.heading }}
+ {% elif config.separate_signature %}
+ {{ module_name }}
+ {% else %}
+ {{ module_name }}
+ {% endif %}
+ {% endblock heading %}
+
+ {% block labels scoped %}
+ {#- Labels block.
+
+ This block renders the labels for the module.
+ -#}
+ {% with labels = module.labels %}
+ {% include "labels.html.jinja" with context %}
+ {% endwith %}
+ {% endblock labels %}
+
+ {% endfilter %}
+
+ {% else %}
+ {% if config.show_root_toc_entry %}
+ {% filter heading(heading_level,
+ role="module",
+ id=html_id,
+ toc_label=(' '|safe if config.show_symbol_type_toc else '') + (config.toc_label if config.toc_label and root else module.name),
+ hidden=True,
+ skip_inventory=config.skip_local_inventory,
+ ) %}
+ {% endfilter %}
+ {% endif %}
+ {% set heading_level = heading_level - 1 %}
+ {% endif %}
+
+