From a831522bde32096fd94a443fc887976abc9148fb Mon Sep 17 00:00:00 2001 From: Henry Webel Date: Mon, 16 Sep 2024 17:08:18 +0200 Subject: [PATCH] :sparkles: first version of dsp notes --- .github/workflows/build_website.yaml | 38 +++++++ .gitignore | 7 ++ about.md | 9 ++ azure/creating_ressources.md | 5 + azure/running_nextflow_on_azure.md | 3 + conf.py | 97 ++++++++++++++++++ index.md | 37 +++++++ jupyter_execute/conf.ipynb | 142 +++++++++++++++++++++++++++ python/percent_notebooks.py | 23 +++++ requirements.txt | 6 ++ 10 files changed, 367 insertions(+) create mode 100644 .github/workflows/build_website.yaml create mode 100644 .gitignore create mode 100644 about.md create mode 100644 azure/creating_ressources.md create mode 100644 azure/running_nextflow_on_azure.md create mode 100644 conf.py create mode 100644 index.md create mode 100644 jupyter_execute/conf.ipynb create mode 100644 python/percent_notebooks.py create mode 100644 requirements.txt diff --git a/.github/workflows/build_website.yaml b/.github/workflows/build_website.yaml new file mode 100644 index 0000000..4db0811 --- /dev/null +++ b/.github/workflows/build_website.yaml @@ -0,0 +1,38 @@ +name: deploy-website + +# Only run this when the master branch changes +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +# This job installs dependencies, builds the website and pushes it to `gh-pages` +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Install dependencies + run: | + pip install -r requirements.txt + + - name: Build the site + run: | + sphinx-build -nW --keep-going -b html . _build + + # # Hide pages behind a password + # - uses: actions/setup-node@v3 + # - run: npm install -g staticrypt + # - run: find _build/hidden -type f -name "*.html" -exec staticrypt {} TEST -o {} \; + + # If we've pushed to main, push the book's HTML to github-pages + - if: ${{ github.ref == 'refs/heads/main' }} + name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_build + # cname: website.com diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8fdfcc --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Local build folder +_build +jupyter_execute + +# Hidden files +.DS_Store +.ipynb_checkpoints diff --git a/about.md b/about.md new file mode 100644 index 0000000..f58ebf3 --- /dev/null +++ b/about.md @@ -0,0 +1,9 @@ +# About + +> More information about us and our work. + +The Data Sciene Platform at Novo Nordisk Foundation Center for Biosustainability +is part of the Informatics Platform, see our aims and goals +[here](https://www.biosustain.dtu.dk/technologies/informatics/data-science-platform). + + diff --git a/azure/creating_ressources.md b/azure/creating_ressources.md new file mode 100644 index 0000000..b3ffdb3 --- /dev/null +++ b/azure/creating_ressources.md @@ -0,0 +1,5 @@ +# Create Azure resources + +How to create azure resources in a common VNET + +> good first issue for Albert:) diff --git a/azure/running_nextflow_on_azure.md b/azure/running_nextflow_on_azure.md new file mode 100644 index 0000000..27a8dee --- /dev/null +++ b/azure/running_nextflow_on_azure.md @@ -0,0 +1,3 @@ +# How to run a nextflow pipleline on Azure + +> to be written diff --git a/conf.py b/conf.py new file mode 100644 index 0000000..01f4cf7 --- /dev/null +++ b/conf.py @@ -0,0 +1,97 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- + +project = "Data Science Platform notes" +# ! update if someone adds information +copyright = "2024, Henry Webel" +author = "Henry Webel" + + +# -- General configuration --------------------------------------------------- + + +extensions = [ + "myst_nb", + # "sphinx_design", # interactive webcomponents + # "sphinx_copybutton", + # "sphinx_examples", + "sphinx_new_tab_link", +] + +templates_path = ["_templates"] +exclude_patterns = [ + "_build", + "Thumbs.db", + ".DS_Store", + "**/pandoc_ipynb/inputs/*", + ".nox/*", + "README.md", + "**/.ipynb_checkpoints/*", + "jupyter_execute", + "conf.py", +] + + +html_theme = "pydata_sphinx_theme" +# html_theme = "sphinx_book_theme" # alternative + + +# https://myst-nb.readthedocs.io/en/latest/computation/execute.html +nb_execution_mode = "auto" + +myst_enable_extensions = ["dollarmath", "amsmath"] + +# Plolty support through require javascript library +# https://myst-nb.readthedocs.io/en/latest/render/interactive.html#plotly +html_js_files = [ + "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js" +] + +# https://myst-nb.readthedocs.io/en/latest/configuration.html +# Execution +nb_execution_raise_on_error = True +# Rendering +nb_merge_streams = True + +# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats +nb_custom_formats = { + ".py": ["jupytext.reads", {"fmt": "py:percent"}] +} + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# See: +# https://github.com/executablebooks/MyST-NB/blob/master/docs/conf.py +# html_title = "" +html_theme = "sphinx_book_theme" +# html_logo = "_static/logo-wide.svg" +# html_favicon = "_static/logo-square.svg" +html_theme_options = { + "github_url": "https://github.com/biosustain/", + "repository_url": "https://github.com/biosustain/dsp_notes", + # "repository_branch": "main", + # "home_page_in_toc": True, + # "path_to_docs": "docs", + "show_navbar_depth": 1, + # "use_edit_page_button": True, + "use_repository_button": True, + "use_download_button": True, + "launch_buttons": { + "colab_url": "https://colab.research.google.com" + # "binderhub_url": "https://mybinder.org", + # "notebook_interface": "jupyterlab", + }, + "navigation_with_keys": False, +} +# 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, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] diff --git a/index.md b/index.md new file mode 100644 index 0000000..ff44851 --- /dev/null +++ b/index.md @@ -0,0 +1,37 @@ +# DTU Biosustain's Data Science Platform Documentation + +Welcome to the documentation of the Data Science Platform at DTU Biosustain. This is a +place to keep general notes on how to do things, +DTU infrastructure specific trics and institute wide educational material. + +The Data Sciene Platform at Novo Nordisk Foundation Center for Biosustainability +is part of the Informatics Platform, see our aims and goals +[here](https://www.biosustain.dtu.dk/technologies/informatics/data-science-platform). + +```{toctree} +:maxdepth: 2 +:hidden: + +about +``` + +```{toctree} +:maxdepth: 2 +:hidden: +:caption: Azure + +azure/creating_ressources +azure/running_nextflow_on_azure +``` + +```{toctree} +:maxdepth: 2 +:hidden: +:caption: Python + +python/percent_notebooks +``` + + + + diff --git a/jupyter_execute/conf.ipynb b/jupyter_execute/conf.ipynb new file mode 100644 index 0000000..a504ef4 --- /dev/null +++ b/jupyter_execute/conf.ipynb @@ -0,0 +1,142 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "86487a2c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "zsh:1: command not found: update\r\n" + ] + } + ], + "source": [ + "# Configuration file for the Sphinx documentation builder.\n", + "#\n", + "# This file only contains a selection of the most common options. For a full\n", + "# list see the documentation:\n", + "# https://www.sphinx-doc.org/en/master/usage/configuration.html\n", + "\n", + "# -- Project information -----------------------------------------------------\n", + "\n", + "project = \"Data Science Platform notes\"\n", + "! update if someone adds information\n", + "copyright = \"2024, Henry Webel\"\n", + "author = \"Henry Webel\"\n", + "\n", + "\n", + "# -- General configuration ---------------------------------------------------\n", + "\n", + "\n", + "extensions = [\n", + " \"myst_nb\",\n", + " # \"sphinx_design\", # interactive webcomponents\n", + " # \"sphinx_copybutton\",\n", + " # \"sphinx_examples\",\n", + " \"sphinx_new_tab_link\",\n", + "]\n", + "\n", + "templates_path = [\"_templates\"]\n", + "exclude_patterns = [\n", + " \"_build\",\n", + " \"Thumbs.db\",\n", + " \".DS_Store\",\n", + " \"**/pandoc_ipynb/inputs/*\",\n", + " \".nox/*\",\n", + " \"README.md\",\n", + " \"**/.ipynb_checkpoints/*\",\n", + " \"jupyter_execute\",\n", + "]\n", + "\n", + "\n", + "html_theme = \"pydata_sphinx_theme\"\n", + "# html_theme = \"sphinx_book_theme\" # alternative\n", + "\n", + "\n", + "# https://myst-nb.readthedocs.io/en/latest/computation/execute.html\n", + "nb_execution_mode = \"auto\"\n", + "\n", + "myst_enable_extensions = [\"dollarmath\", \"amsmath\"]\n", + "\n", + "# Plolty support through require javascript library\n", + "# https://myst-nb.readthedocs.io/en/latest/render/interactive.html#plotly\n", + "html_js_files = [\n", + " \"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js\"\n", + "]\n", + "\n", + "# https://myst-nb.readthedocs.io/en/latest/configuration.html\n", + "# Execution\n", + "nb_execution_raise_on_error = True\n", + "# Rendering\n", + "nb_merge_streams = True\n", + "\n", + "# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats\n", + "nb_custom_formats = {\n", + " \".py\": [\"jupytext.reads\", {\"fmt\": \"py:percent\"}]\n", + "}\n", + "\n", + "\n", + "# -- Options for HTML output -------------------------------------------------\n", + "\n", + "# The theme to use for HTML and HTML Help pages. See the documentation for\n", + "# a list of builtin themes.\n", + "# See:\n", + "# https://github.com/executablebooks/MyST-NB/blob/master/docs/conf.py\n", + "# html_title = \"\"\n", + "html_theme = \"sphinx_book_theme\"\n", + "# html_logo = \"_static/logo-wide.svg\"\n", + "# html_favicon = \"_static/logo-square.svg\"\n", + "html_theme_options = {\n", + " \"github_url\": \"https://github.com/biosustain/\",\n", + " \"repository_url\": \"https://github.com/biosustain/dsp_notes\",\n", + " # \"repository_branch\": \"main\",\n", + " # \"home_page_in_toc\": True,\n", + " # \"path_to_docs\": \"docs\",\n", + " \"show_navbar_depth\": 1,\n", + " # \"use_edit_page_button\": True,\n", + " \"use_repository_button\": True,\n", + " \"use_download_button\": True,\n", + " \"launch_buttons\": {\n", + " \"colab_url\": \"https://colab.research.google.com\"\n", + " # \"binderhub_url\": \"https://mybinder.org\",\n", + " # \"notebook_interface\": \"jupyterlab\",\n", + " },\n", + " \"navigation_with_keys\": False,\n", + "}\n", + "# Add any paths that contain custom static files (such as style sheets) here,\n", + "# relative to this directory. They are copied after the builtin static files,\n", + "# so a file named \"default.css\" will overwrite the builtin \"default.css\".\n", + "# html_static_path = ['_static']" + ] + } + ], + "metadata": { + "jupytext": { + "cell_metadata_filter": "-all", + "main_language": "python", + "notebook_metadata_filter": "-all", + "text_representation": { + "extension": ".py", + "format_name": "percent" + } + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} \ No newline at end of file diff --git a/python/percent_notebooks.py b/python/percent_notebooks.py new file mode 100644 index 0000000..604942f --- /dev/null +++ b/python/percent_notebooks.py @@ -0,0 +1,23 @@ +# %% [markdown] +# # Percent Notebooks in VSCode (and other editior) +# This site is written as a jupyter notebook which is then executed and converted to html +# by mystnb and sphinx. +# +# A brief example: +# ``` +# # %% [markdown] +# # # Heading 1 +# # Some text +# # +# # %% +# # print("Hello World") +# +# ``` +# Find more information on +# [jupytext's documentation](https://jupytext.readthedocs.io/en/latest/formats-scripts.html) + +# %% +print("Hello World form a percent notebook") + +# %% [markdown] +# This notebook was executed using `jupytext` and `mystnb` by `sphinx`. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d714a64 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +sphinx +sphinx-book-theme +myst-nb +ipywidgets +sphinx-new-tab-link!=0.2.2 +jupytext