diff --git a/.readthedocs.yaml b/.readthedocs.yaml index bd11fd93..e16f2da1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -4,20 +4,13 @@ build: os: "ubuntu-22.04" tools: python: "3.9" - jobs: - pre_install: - - pip install --no-cache-dir pip --upgrade - - pip install --no-cache-dir pybind11[global] - pre_build: - - pip install --no-cache-dir -r docs/requirements.txt - apt_packages: - - graphviz + +sphinx: + configuration: docs/conf.py python: install: - - requirements: docs/requirements.txt - - method: pip - path: python + - requirements: docs/requirements.txt # Build PDF formats: diff --git a/docs/Tutorial/5-scikit-learn-connection/causal_model.png b/docs/Tutorial/5-scikit-learn-connection/causal_model.png index 505bfbfa..b4fb459c 100644 Binary files a/docs/Tutorial/5-scikit-learn-connection/causal_model.png and b/docs/Tutorial/5-scikit-learn-connection/causal_model.png differ diff --git a/docs/_static/custom-icon.js b/docs/_static/custom-icon.js new file mode 100644 index 00000000..cd949b3b --- /dev/null +++ b/docs/_static/custom-icon.js @@ -0,0 +1,16 @@ +/******************************************************************************* + * Set a custom icon for pypi as it's not available in the fa built-in brands + */ +FontAwesome.library.add( + (faListOldStyle = { + prefix: "fa-custom", + iconName: "pypi", + icon: [ + 17.313, // viewBox width + 19.807, // viewBox height + [], // ligature + "e001", // unicode codepoint - private use area + "m10.383 0.2-3.239 1.1769 3.1883 1.1614 3.239-1.1798zm-3.4152 1.2411-3.2362 1.1769 3.1855 1.1614 3.2369-1.1769zm6.7177 0.00281-3.2947 1.2009v3.8254l3.2947-1.1988zm-3.4145 1.2439-3.2926 1.1981v3.8254l0.17548-0.064132 3.1171-1.1347zm-6.6564 0.018325v3.8247l3.244 1.1805v-3.8254zm10.191 0.20931v2.3137l3.1777-1.1558zm3.2947 1.2425-3.2947 1.1988v3.8254l3.2947-1.1988zm-8.7058 0.45739c0.00929-1.931e-4 0.018327-2.977e-4 0.027485 0 0.25633 0.00851 0.4263 0.20713 0.42638 0.49826 1.953e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36226 0.13215-0.65608-0.073306-0.65613-0.4588-6.28e-5 -0.38556 0.2938-0.80504 0.65613-0.93662 0.068422-0.024919 0.13655-0.038114 0.20156-0.039466zm5.2913 0.78369-3.2947 1.1988v3.8247l3.2947-1.1981zm-10.132 1.239-3.2362 1.1769 3.1883 1.1614 3.2362-1.1769zm6.7177 0.00213-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2439-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.016195v3.8275l3.244 1.1805v-3.8254zm16.9 0.21143-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm-3.4124 1.2432-3.2947 1.1988v3.8254l3.2947-1.1988zm-6.6585 0.019027v3.8247l3.244 1.1805v-3.8254zm13.485 1.4497-3.2947 1.1988v3.8247l3.2947-1.1981zm-3.4145 1.2411-3.2926 1.2016v3.8247l3.2926-1.2009zm2.4018 0.38127c0.0093-1.83e-4 0.01833-3.16e-4 0.02749 0 0.25633 0.0085 0.4263 0.20713 0.42638 0.49826 1.97e-4 0.38532-0.29327 0.80469-0.65542 0.93662-0.36188 0.1316-0.65525-0.07375-0.65542-0.4588-1.95e-4 -0.38532 0.29328-0.80469 0.65542-0.93662 0.06842-0.02494 0.13655-0.03819 0.20156-0.03947zm-5.8142 0.86403-3.244 1.1805v1.4201l3.244 1.1805z", // svg path (https://simpleicons.org/icons/pypi.svg) + ], + }) +); diff --git a/docs/_static/custom.css b/docs/_static/custom.css new file mode 100644 index 00000000..2d8f54cf --- /dev/null +++ b/docs/_static/custom.css @@ -0,0 +1,66 @@ +/* Background of stable should be green */ +.version-switcher__container a[data-version-name*="stable"] { + position: relative; +} + +.version-switcher__container a[data-version-name*="stable"] span { + color: var(--pst-color-success); +} + +.version-switcher__container a[data-version-name*="stable"] span:before { + content: ""; + width: 100%; + height: 100%; + position: absolute; + left: 0; + top: 0; + background-color: var(--pst-color-success); + opacity: 0.1; +} + +/* custom CSS classes (used in docs/user_guide/extending.rst) NOTE: the begin + * and end markers are necessary for partial file includes! don't remove them. + */ + +/* begin-custom-color/* /custom.css */ + +div.admonition.admonition-olive { + border-color: olive; +} +div.admonition.admonition-olive > .admonition-title:before { + background-color: olive; +} +div.admonition.admonition-olive > .admonition-title:after { + color: olive; +} +/* end-custom-color */ + +/* begin-custom-icon/* /custom.css */ + +div.admonition.admonition-icon > .admonition-title:after { + content: "\f24e"; /* the fa-scale icon */ +} +/* end-custom-icon */ + +/* begin-custom-youtube/* /custom.css */ + +div.admonition.admonition-youtube { + border-color: #ff0000; /* YouTube red */ +} +div.admonition.admonition-youtube > .admonition-title:before { + background-color: #ff0000; +} +div.admonition.admonition-youtube > .admonition-title:after { + color: #ff0000; + content: "\f26c"; /* fa-solid fa-tv */ +} +/* end-custom-youtube */ + +.sphx-glr-thumbcontainer[tooltip]:hover::before, +.sphx-glr-thumbcontainer[tooltip]:hover::after { + display: none; +} +:root, html[data-theme="light"], body[data-theme="light"]{ + --sg-download-a-background-image: linear-gradient(to bottom, #20B2AA, #ADD8E6); + --sg-download-a-hover-background-color: #ADD8E6; +} \ No newline at end of file diff --git a/docs/_static/js/copybutton.js b/docs/_static/js/copybutton.js deleted file mode 100644 index fb971a77..00000000 --- a/docs/_static/js/copybutton.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2014 PSF. Licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 -// File originates from the cpython source found in Doc/tools/sphinxext/static/copybutton.js - -$(document).ready(function() { - /* Add a [>>>] button on the top-right corner of code samples to hide - * the >>> and ... prompts and the output and thus make the code - * copyable. */ - var div = $('.highlight-python .highlight,' + - '.highlight-python3 .highlight,' + - '.highlight-pycon .highlight,' + - '.highlight-default .highlight') - var pre = div.find('pre'); - - // get the styles from the current theme - pre.parent().parent().css('position', 'relative'); - var hide_text = 'Hide the prompts and output'; - var show_text = 'Show the prompts and output'; - var border_width = pre.css('border-top-width'); - var border_style = pre.css('border-top-style'); - var border_color = pre.css('border-top-color'); - var button_styles = { - 'cursor':'pointer', 'position': 'absolute', 'top': '0', 'right': '0', - 'border-color': border_color, 'border-style': border_style, - 'border-width': border_width, 'color': border_color, 'text-size': '75%', - 'font-family': 'monospace', 'padding-left': '0.2em', 'padding-right': '0.2em', - 'border-radius': '0 3px 0 0' - } - - // create and add the button to all the code blocks that contain >>> - div.each(function(index) { - var jthis = $(this); - if (jthis.find('.gp').length > 0) { - var button = $('>>>'); - button.css(button_styles) - button.attr('title', hide_text); - button.data('hidden', 'false'); - jthis.prepend(button); - } - // tracebacks (.gt) contain bare text elements that need to be - // wrapped in a span to work with .nextUntil() (see later) - jthis.find('pre:has(.gt)').contents().filter(function() { - return ((this.nodeType == 3) && (this.data.trim().length > 0)); - }).wrap(''); - }); - - // define the behavior of the button when it's clicked - $('.copybutton').click(function(e){ - e.preventDefault(); - var button = $(this); - if (button.data('hidden') === 'false') { - // hide the code output - button.parent().find('.go, .gp, .gt').hide(); - button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden'); - button.css('text-decoration', 'line-through'); - button.attr('title', show_text); - button.data('hidden', 'true'); - } else { - // show the code output - button.parent().find('.go, .gp, .gt').show(); - button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible'); - button.css('text-decoration', 'none'); - button.attr('title', hide_text); - button.data('hidden', 'false'); - } - }); -}); diff --git a/docs/_static/switcher.json b/docs/_static/switcher.json new file mode 100644 index 00000000..93116094 --- /dev/null +++ b/docs/_static/switcher.json @@ -0,0 +1,12 @@ +[ + { + "name": "latest", + "version": "latest", + "url": "https://abess.readthedocs.io/en/latest/" + }, + { + "name": "0.4.7 (stable)", + "version": "0.4.7", + "url": "https://abess.readthedocs.io/en/latest/" + } +] diff --git a/docs/_templates/autoapi/index.rst b/docs/_templates/autoapi/index.rst new file mode 100644 index 00000000..5f476502 --- /dev/null +++ b/docs/_templates/autoapi/index.rst @@ -0,0 +1,15 @@ +API References +============== + +This page contains auto-generated API reference documentation [#f1]_. + +.. toctree:: + :titlesonly: + + {% for page in pages %} + {% if page.top_level_object and page.display %} + {{ page.include_path }} + {% endif %} + {% endfor %} + +.. [#f1] Created with `sphinx-autoapi `_ diff --git a/docs/_templates/autoapi/python/attribute.rst b/docs/_templates/autoapi/python/attribute.rst new file mode 100644 index 00000000..ebaba555 --- /dev/null +++ b/docs/_templates/autoapi/python/attribute.rst @@ -0,0 +1 @@ +{% extends "python/data.rst" %} diff --git a/docs/_templates/autoapi/python/class.rst b/docs/_templates/autoapi/python/class.rst new file mode 100644 index 00000000..a791e3d6 --- /dev/null +++ b/docs/_templates/autoapi/python/class.rst @@ -0,0 +1,50 @@ +{% if obj.display %} +.. py:{{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %} +{% for (args, return_annotation) in obj.overloads %} + {{ " " * (obj.type | length) }} {{ obj.short_name }}{% if args %}({{ args }}){% endif %} +{% endfor %} + + + {% if obj.bases %} + {% if "show-inheritance" in autoapi_options %} + Bases: {% for base in obj.bases %}{{ base|link_objs }}{% if not loop.last %}, {% endif %}{% endfor %} + {% endif %} + + + {% if "show-inheritance-diagram" in autoapi_options and obj.bases != ["object"] %} + .. autoapi-inheritance-diagram:: {{ obj.obj["full_name"] }} + :parts: 1 + {% if "private-members" in autoapi_options %} + :private-bases: + {% endif %} + + {% endif %} + {% endif %} + {% if obj.docstring %} + {{ obj.docstring|indent(3) }} + {% endif %} + {% if "inherited-members" in autoapi_options %} + {% set visible_classes = obj.classes|selectattr("display")|list %} + {% else %} + {% set visible_classes = obj.classes|rejectattr("inherited")|selectattr("display")|list %} + {% endif %} + {% for klass in visible_classes %} + {{ klass.render()|indent(3) }} + {% endfor %} + {% if "inherited-members" in autoapi_options %} + {% set visible_attributes = obj.attributes|selectattr("display")|list %} + {% else %} + {% set visible_attributes = obj.attributes|rejectattr("inherited")|selectattr("display")|list %} + {% endif %} + {% for attribute in visible_attributes %} + {{ attribute.render()|indent(3) }} + {% endfor %} + {% if "inherited-members" in autoapi_options %} + {% set visible_methods = obj.methods|selectattr("display")|list %} + {% else %} + {% set visible_methods = obj.methods|rejectattr("inherited")|selectattr("display")|list %} + {% endif %} + {% for method in visible_methods %} + {{ method.render()|indent(3) }} + {% endfor %} +{% endif %} diff --git a/docs/_templates/autoapi/python/data.rst b/docs/_templates/autoapi/python/data.rst new file mode 100644 index 00000000..89417f1e --- /dev/null +++ b/docs/_templates/autoapi/python/data.rst @@ -0,0 +1,32 @@ +{% if obj.display %} +.. py:{{ obj.type }}:: {{ obj.name }} + {%+ if obj.value is not none or obj.annotation is not none -%} + :annotation: + {%- if obj.annotation %} :{{ obj.annotation }} + {%- endif %} + {%- if obj.value is not none %} = {% + if obj.value is string and obj.value.splitlines()|count > 1 -%} + Multiline-String + + .. raw:: html + +
Show Value + + .. code-block:: text + :linenos: + + {{ obj.value|indent(width=8) }} + + .. raw:: html + +
+ + {%- else -%} + {{ obj.value|string|truncate(100) }} + {%- endif %} + {%- endif %} + {% endif %} + + + {{ obj.docstring|indent(3) }} +{% endif %} diff --git a/docs/_templates/autoapi/python/exception.rst b/docs/_templates/autoapi/python/exception.rst new file mode 100644 index 00000000..92f3d38f --- /dev/null +++ b/docs/_templates/autoapi/python/exception.rst @@ -0,0 +1 @@ +{% extends "python/class.rst" %} diff --git a/docs/_templates/autoapi/python/function.rst b/docs/_templates/autoapi/python/function.rst new file mode 100644 index 00000000..6db8515c --- /dev/null +++ b/docs/_templates/autoapi/python/function.rst @@ -0,0 +1,18 @@ +{% if obj.display %} +.. py:function:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %} + +{% for (args, return_annotation) in obj.overloads %} + {{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %} + +{% endfor %} + {% if sphinx_version >= (2, 1) %} + {% for property in obj.properties %} + :{{ property }}: + {% endfor %} + {% endif %} + + {% if obj.docstring %} + {{ obj.docstring|indent(3) }} + {% else %} + {% endif %} +{% endif %} diff --git a/docs/_templates/autoapi/python/method.rst b/docs/_templates/autoapi/python/method.rst new file mode 100644 index 00000000..ff1b7767 --- /dev/null +++ b/docs/_templates/autoapi/python/method.rst @@ -0,0 +1,27 @@ +{%- if obj.display %} +{% if sphinx_version >= (2, 1) %} +.. py:method:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %} + +{% for (args, return_annotation) in obj.overloads %} + {{ obj.short_name }}({{ args }}){% if return_annotation is not none %} -> {{ return_annotation }}{% endif %} + +{% endfor %} + {% if obj.properties %} + {% for property in obj.properties %} + :{{ property }}: + {% endfor %} + + {% else %} + + {% endif %} +{% else %} +.. py:{{ obj.method_type }}:: {{ obj.short_name }}({{ obj.args }}) +{% for (args, return_annotation) in obj.overloads %} + {{ " " * (obj.method_type | length) }} {{ obj.short_name }}({{ args }}) +{% endfor %} + +{% endif %} + {% if obj.docstring %} + {{ obj.docstring|indent(3) }} + {% endif %} +{% endif %} diff --git a/docs/_templates/autoapi/python/module.rst b/docs/_templates/autoapi/python/module.rst new file mode 100644 index 00000000..d2714f6c --- /dev/null +++ b/docs/_templates/autoapi/python/module.rst @@ -0,0 +1,114 @@ +{% if not obj.display %} +:orphan: + +{% endif %} +:py:mod:`{{ obj.name }}` +=========={{ "=" * obj.name|length }} + +.. py:module:: {{ obj.name }} + +{% if obj.docstring %} +.. autoapi-nested-parse:: + + {{ obj.docstring|indent(3) }} + +{% endif %} + +{% block subpackages %} +{% set visible_subpackages = obj.subpackages|selectattr("display")|list %} +{% if visible_subpackages %} +Subpackages +----------- +.. toctree:: + :titlesonly: + :maxdepth: 3 + +{% for subpackage in visible_subpackages %} + {{ subpackage.short_name }}/index.rst +{% endfor %} + + +{% endif %} +{% endblock %} +{% block submodules %} +{% set visible_submodules = obj.submodules|selectattr("display")|list %} +{% if visible_submodules %} +Submodules +---------- +.. toctree:: + :titlesonly: + :maxdepth: 1 + +{% for submodule in visible_submodules %} + {{ submodule.short_name }}/index.rst +{% endfor %} + + +{% endif %} +{% endblock %} +{% block content %} +{% if obj.all is not none %} +{% set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %} +{% elif obj.type is equalto("package") %} +{% set visible_children = obj.children|selectattr("display")|list %} +{% else %} +{% set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %} +{% endif %} +{% if visible_children %} +{{ obj.type|title }} Contents +{{ "-" * obj.type|length }}--------- + +{% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list %} +{% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list %} +{% set visible_attributes = visible_children|selectattr("type", "equalto", "data")|list %} +{% if "show-module-summary" in autoapi_options and (visible_classes or visible_functions) %} +{% block classes scoped %} +{% if visible_classes %} +Classes +~~~~~~~ + +.. autoapisummary:: + +{% for klass in visible_classes %} + {{ klass.id }} +{% endfor %} + + +{% endif %} +{% endblock %} + +{% block functions scoped %} +{% if visible_functions %} +Functions +~~~~~~~~~ + +.. autoapisummary:: + +{% for function in visible_functions %} + {{ function.id }} +{% endfor %} + + +{% endif %} +{% endblock %} + +{% block attributes scoped %} +{% if visible_attributes %} +Attributes +~~~~~~~~~~ + +.. autoapisummary:: + +{% for attribute in visible_attributes %} + {{ attribute.id }} +{% endfor %} + + +{% endif %} +{% endblock %} +{% endif %} +{% for obj_item in visible_children %} +{{ obj_item.render()|indent(0) }} +{% endfor %} +{% endif %} +{% endblock %} diff --git a/docs/_templates/autoapi/python/package.rst b/docs/_templates/autoapi/python/package.rst new file mode 100644 index 00000000..fb9a6496 --- /dev/null +++ b/docs/_templates/autoapi/python/package.rst @@ -0,0 +1 @@ +{% extends "python/module.rst" %} diff --git a/docs/_templates/custom-template.html b/docs/_templates/custom-template.html new file mode 100644 index 00000000..0ed45ec1 --- /dev/null +++ b/docs/_templates/custom-template.html @@ -0,0 +1,6 @@ + diff --git a/docs/_templates/edit-this-page.html b/docs/_templates/edit-this-page.html new file mode 100644 index 00000000..0254d1a2 --- /dev/null +++ b/docs/_templates/edit-this-page.html @@ -0,0 +1,16 @@ +{% if sourcename is defined and theme_use_edit_page_button and page_source_suffix %} + {% set src = sourcename.split('.') %} + +{% endif %} diff --git a/docs/_templates/navbar-version.html b/docs/_templates/navbar-version.html new file mode 100644 index 00000000..b23c1ca1 --- /dev/null +++ b/docs/_templates/navbar-version.html @@ -0,0 +1,2 @@ + +TEST: v{{ version }} diff --git a/docs/_templates/test.html b/docs/_templates/test.html new file mode 100644 index 00000000..341b0d29 --- /dev/null +++ b/docs/_templates/test.html @@ -0,0 +1,2 @@ +{# This is just used for testing in our documentation #} + diff --git a/docs/conf.py b/docs/conf.py index d28a0051..bec80f42 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,14 +10,17 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # +from sphinx.application import Sphinx +from typing import Any, Dict import sphinx_gallery -import sphinx_rtd_theme +import pydata_sphinx_theme import sphinx_gallery.sorting -# import os +import os # import sys import sys # import abess import matplotlib +# sys.path.append("../python/") # sys.path.insert(0, os.path.join(os.path.abspath('..'), "python")) # import SampleModule # from sphinx_gallery.sorting import FileNameSortKey @@ -29,9 +32,15 @@ project = 'ABESS' copyright = '2020, abess-team' author = 'abess-team' +json_url = "https://abess.readthedocs.io/en/latest/_static/switcher.json" # The full version, including alpha/beta/rc tags -release = '0.4.5' +version = os.environ.get("READTHEDOCS_VERSION") +rd = os.environ.get("READTHEDOCS") + +if not rd: + version = "dev" + json_url = "_static/switcher.json" # -- General configuration --------------------------------------------------- @@ -49,11 +58,26 @@ "sphinx.ext.ifconfig", "sphinx.ext.githubpages", 'sphinx.ext.intersphinx', - 'sphinx_gallery.gen_gallery' + 'sphinx_gallery.gen_gallery', + "sphinx_design", + "sphinx_copybutton", + "numpydoc", + "sphinx_favicon", + "sphinx_togglebutton", + "IPython.sphinxext.ipython_console_highlighting", + "IPython.sphinxext.ipython_directive", + "matplotlib.sphinxext.plot_directive", # , # 'sphinx_toggleprompt' ] +if not os.environ.get("READTHEDOCS"): + extensions += ["sphinx_sitemap"] + + html_baseurl = os.environ.get("SITEMAP_URL_BASE", "http://127.0.0.1:8000/") + sitemap_locales = [None] + sitemap_url_scheme = "{link}" + matplotlib.use('agg') # -- numpydoc @@ -67,6 +91,8 @@ autoclass_content = "both" autodoc_default_flags = ["members", "inherited-members"] autodoc_member_order = "bysource" # default is alphabetical +autodoc_typehints = "description" +autodoc_class_signature = "separated" # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -84,7 +110,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +html_theme = 'pydata_sphinx_theme' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -94,13 +120,85 @@ pygments_style = "sphinx" smartquotes = False -html_theme = "sphinx_rtd_theme" -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] html_theme_options = { - # 'includehidden': False, - "collapse_navigation": False, - "navigation_depth": 3, - "logo_only": True, + "header_links_before_dropdown": 4, + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/abess-team/abess", + "icon": "fa-brands fa-github", + }, + { + "name": "PyPI", + "url": "https://pypi.org/project/abess/", + "icon": "fa-brands fa-python", + }, + { + "name": "CRAN", + "url": "https://cran.rstudio.com/web/packages/abess/index.html", + "icon": "fa-solid fa-r", + }, + ], + # alternative way to set twitter and github header icons + # "github_url": "https://github.com/pydata/pydata-sphinx-theme", + # "twitter_url": "https://twitter.com/PyData", + "logo": { + "text": "abess", + "image_dark": ".image/apple-touch-icon.png", + "alt_text": "abess", + }, + "use_edit_page_button": True, + "show_toc_level": 2, + "navbar_align": "left", # [left, content, right] For testing that the navbar items align properly + "navbar_center": ["version-switcher", "navbar-nav"], + # "announcement": """""", + # "show_nav_level": 2, + # "navbar_start": ["navbar-logo"], + # "navbar_end": ["theme-switcher", "navbar-icon-links"], + "navbar_persistent": [], + # "primary_sidebar_end": ["custom-template.html", "sidebar-ethical-ads.html"], + # "article_footer_items": ["test.html", "test.html"], + # "content_footer_items": ["test.html", "test.html"], + # "footer_start": ["test.html", "test.html"], + # "secondary_sidebar_items": ["page-toc.html"], # Remove the source buttons + "switcher": { + "json_url": json_url, + "version_match": version, + }, + "navbar_end": ["search-field.html","theme-switcher","navbar-icon-links.html"], + # "search_bar_position": "navbar", # TODO: Deprecated - remove in future version +} + +html_sidebars = { + "auto_gallery/**": [ + # "search-field", + "sidebar-nav-bs", + ], + "Python-package/**": [ + # "search-field", + "sidebar-nav-bs", + ], # This ensures we test for custom sidebars + "Contributing/**": [ + # "search-field", + "sidebar-nav-bs", + ], + # "examples/no-sidebar": [], # Test what page looks like with no sidebar items + # "examples/persistent-search-field": ["search-field"], + # Blog sidebars + # ref: https://ablog.readthedocs.io/manual/ablog-configuration-options/#blog-sidebars + # "examples/blog/*": [ + # "ablog/postcard.html", + # "ablog/recentposts.html", + # "ablog/tagcloud.html", + # "ablog/categories.html", + # "ablog/authors.html", + # "ablog/languages.html", + # "ablog/locations.html", + # "ablog/archives.html", + # ], } html_logo = "./image/apple-touch-icon.png" html_favicon = "./image/favicon-32x32.png" @@ -118,11 +216,6 @@ htmlhelp_basename = "abessdoc" -def setup(app): - # to hide/show the prompt in code examples: - app.add_js_file("js/copybutton.js") - - # sphinx-gallery configuration sphinx_gallery_conf = { 'doc_module': 'abess', @@ -147,6 +240,9 @@ def setup(app): } +html_css_files = ["custom.css"] +html_js_files = ["custom-icon.js"] + # configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { "numpy": ("https://numpy.org/doc/stable/", None), @@ -155,3 +251,40 @@ def setup(app): "sklearn": ("https://scikit-learn.org/dev/", None), 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None) } + +def setup_to_main( + app: Sphinx, pagename: str, templatename: str, context, doctree +) -> None: + """Add a function that jinja can access for returning an "edit this page" link pointing to `main`.""" + + def to_main(link: str) -> str: + """Transform "edit on github" links and make sure they always point to the main branch. + + Args: + link: the link to the github edit interface + + Returns: + the link to the tip of the main branch for the same file + """ + links = link.split("/") + idx = links.index("docs") + return "/".join(links[: idx + 1]) + "/source/" + "/".join(links[idx + 1 :]) + + context["to_main"] = to_main + + +def setup(app: Sphinx) -> Dict[str, Any]: + """Add custom configuration to sphinx app. + + Args: + app: the Sphinx application + Returns: + the 2 parralel parameters set to ``True``. + """ + app.connect("html-page-context", setup_to_main) + + return { + "parallel_read_safe": True, + "parallel_write_safe": True, + } + diff --git a/docs/index.rst b/docs/index.rst index ce292d0b..b39a250d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,14 +22,6 @@ FAQ Changelog <./Changelog> -.. toctree:: - :hidden: - :caption: USEFUL LINK - - abess @GitHub - abess @PyPI - abess @CRAN - Indices and tables ================== diff --git a/docs/record b/docs/record new file mode 100644 index 00000000..73175e11 Binary files /dev/null and b/docs/record differ diff --git a/docs/requirements.txt b/docs/requirements.txt index 6bdadbb7..9be4faf7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,12 +1,26 @@ -Sphinx==4.5.0 -docutils<0.17 +sphinx==5.3.0 +sphinx-copybutton==0.5.2 +pydata-sphinx-theme==0.14.1 sphinx-rtd-theme>=0.5.2 +docutils<0.17 +matplotlib==3.8.0 +seaborn==0.13.0 +ipython==8.15.0 sphinx-gallery sphinxcontrib-phpdomain -sphinx-autoapi +statsmodels==0.14.0 +cvxpy==1.3.2 +lifelines==0.27.8 +sphinx-design==0.5.0 +numpydoc==1.6.0 +sphinx-togglebutton==0.3.2 +sphinx-favicon==1.0.1 +sphinx-sitemap==2.5.1 +networkx==3.1 geomstats DoubleML pyts dowhy numpy<1.23 imbalanced-learn +abess \ No newline at end of file diff --git a/docs/sg_execution_times.rst b/docs/sg_execution_times.rst new file mode 100644 index 00000000..52442bc3 --- /dev/null +++ b/docs/sg_execution_times.rst @@ -0,0 +1,106 @@ + +:orphan: + +.. _sphx_glr_sg_execution_times: + + +Computation times +================= +**07:51.729** total execution time for 24 files **from all galleries**: + +.. container:: + + .. raw:: html + + + + + + + + .. list-table:: + :header-rows: 1 + :class: table table-striped sg-datatable + + * - Example + - Time + - Mem (MB) + * - :ref:`sphx_glr_auto_gallery_4-computation-tips_plot_large_dimension.py` (``Tutorial\4-computation-tips\plot_large_dimension.py``) + - 04:25.227 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_5-scikit-learn-connection_plot_3_double_machine_learning.py` (``Tutorial\5-scikit-learn-connection\plot_3_double_machine_learning.py``) + - 01:31.070 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_5-scikit-learn-connection_plot_1_scikit_learn.py` (``Tutorial\5-scikit-learn-connection\plot_1_scikit_learn.py``) + - 00:36.578 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_4-computation-tips_plot_specific_models.py` (``Tutorial\4-computation-tips\plot_specific_models.py``) + - 00:18.240 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_2-pca_plot_6_PCA.py` (``Tutorial\2-pca\plot_6_PCA.py``) + - 00:17.751 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_5-scikit-learn-connection_plot_4_pyts.py` (``Tutorial\5-scikit-learn-connection\plot_4_pyts.py``) + - 00:17.642 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_5-scikit-learn-connection_plot_5_dowhy.py` (``Tutorial\5-scikit-learn-connection\plot_5_dowhy.py``) + - 00:15.515 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_5-scikit-learn-connection_plot_6_imbalanced_learn.py` (``Tutorial\5-scikit-learn-connection\plot_6_imbalanced_learn.py``) + - 00:04.440 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_2-pca_plot_7_RPCA.py` (``Tutorial\2-pca\plot_7_RPCA.py``) + - 00:01.384 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_1-glm_plot_1_LinearRegression.py` (``Tutorial\1-glm\plot_1_LinearRegression.py``) + - 00:01.197 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_5-scikit-learn-connection_plot_2_geomstats.py` (``Tutorial\5-scikit-learn-connection\plot_2_geomstats.py``) + - 00:00.905 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_4-computation-tips_plot_sparse_inputs.py` (``Tutorial\4-computation-tips\plot_sparse_inputs.py``) + - 00:00.411 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_3-advanced-features_plot_cross_validation.py` (``Tutorial\3-advanced-features\plot_cross_validation.py``) + - 00:00.376 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_1-glm_plot_4_CoxRegression.py` (``Tutorial\1-glm\plot_4_CoxRegression.py``) + - 00:00.316 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_3-advanced-features_plot_best_regularized.py` (``Tutorial\3-advanced-features\plot_best_regularized.py``) + - 00:00.156 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_1-glm_plot_5_PossionGammaRegression.py` (``Tutorial\1-glm\plot_5_PossionGammaRegression.py``) + - 00:00.145 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_1-glm_plot_3_MultiTaskLearning.py` (``Tutorial\1-glm\plot_3_MultiTaskLearning.py``) + - 00:00.117 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_3-advanced-features_plot_best_nuisance.py` (``Tutorial\3-advanced-features\plot_best_nuisance.py``) + - 00:00.111 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_1-glm_plot_2_LogisticRegression.py` (``Tutorial\1-glm\plot_2_LogisticRegression.py``) + - 00:00.093 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_4-computation-tips_plot_large_sample.py` (``Tutorial\4-computation-tips\plot_large_sample.py``) + - 00:00.050 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_3-advanced-features_plot_best_group.py` (``Tutorial\3-advanced-features\plot_best_group.py``) + - 00:00.004 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_3-advanced-features_plot_initial_active_set.py` (``Tutorial\3-advanced-features\plot_initial_active_set.py``) + - 00:00.001 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_1-glm_plot_a2_abess_algorithm_details.py` (``Tutorial\1-glm\plot_a2_abess_algorithm_details.py``) + - 00:00.001 + - 0.0 + * - :ref:`sphx_glr_auto_gallery_1-glm_plot_a1_power_of_abess.py` (``Tutorial\1-glm\plot_a1_power_of_abess.py``) + - 00:00.000 + - 0.0