diff --git a/.github/workflows/deploy-book.yml b/.github/workflows/deploy-book.yml new file mode 100644 index 0000000..5502eea --- /dev/null +++ b/.github/workflows/deploy-book.yml @@ -0,0 +1,35 @@ +# copied from https://jupyterbook.org/publish/gh-pages.html?highlight=github%20pages + +name: deploy-book + +# Only run this when the master branch changes +on: + push: + branches: + - main + +# This job installs dependencies, build the book, and pushes it to `gh-pages` +jobs: + deploy-book: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + environment-file: environment.yml + auto-activate-base: false + activate-environment: arcdocs-jb + + # Build the book + - name: Build the book + shell: bash -l {0} + run: | + conda activate arcdocs-jb + jupyter-book build ./book/ + # Push the book's HTML to master branch (because this is an organisation homepage) + - name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v3.6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./book/_build/html + publish_branch: gh-pages \ No newline at end of file diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml new file mode 100644 index 0000000..bfdef4a --- /dev/null +++ b/.github/workflows/test-build.yml @@ -0,0 +1,33 @@ +# copied from https://jupyterbook.org/publish/gh-pages.html?highlight=github%20pages + +name: test-build + +# Only run this when a PR suggests changes to main branch +on: + pull_request: + branches: + - main + +# This job installs dependencies and builds the book +jobs: + deploy-book: + runs-on: ${{ matrix.os }} + strategy: + # test build on multiple OS + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + environment-file: environment.yml + auto-activate-base: false + activate-environment: arcdocs-jb + + # Build the book + - name: Build the book + shell: bash -l {0} + run: | + conda activate arcdocs-jb + jupyter-book build ./book/ + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..964487d --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# gitignore for template-jb-docs + +# built book +**/_build/* + +# vagrant stuff +**/.vagrant/* \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..386f571 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,129 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at ask-rc@leeds.ac.uk. + +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a0d06a2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Contributing to the template jupyter book docs repository + +:tada: **Welcome to the template jupyter book docs GitHub repository!** :tada: + +_Thank you for wanting to contribute to this project!_ + +We hope that this guideline document will make it as easy as possible for you to get involved. + +We welcome all contributions to this project via GitHub issues and pull requests. +Please follow these guidelines to make sure your contributions can be easily integrated in the project. + +If you have any questions that aren't discussed below, please let us know through one of the many ways to [get in touch](#get-in-touch). + +## Pull Request Process + +1. Ensure the site builds fully on your local system within the conda environment provided +2. Your pull request will be test built locally by one of the maintainers +3. Any Continuous Integration steps must complete successfully +4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you + do not have permission to do that, you may request the second reviewer to merge it for you. + +## Get in touch + +You can get in touch with the Research Computing Team at Leeds via the following channels: +- Open an [issue](https://github.com/ARCTraining/template-jb-docs/issues) +- Email the Research Computing Team via [ask-rc@leeds.ac.uk](mailto:ask-rc@leeds.ac.uk) + diff --git a/README.md b/README.md new file mode 100644 index 0000000..5669696 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# A template jupyter book documentation repository + +This is a template repository that can be used when generating documentation using [Jupyter-books](https://github.com/executablebooks/jupyter-book) and hosting the site via GitHub pages. + +## Working with this project locally + +You can get this project working locally by using the environment.yml file to create a conda environment that contains all the dependencies required to get started. + +```{bash} +$ git clone https://github.com/ARCTraining/template-jb-docs.git + +$ conda env create -f environment.yml +``` + +To build the html content locally you can use the `jupyter-book` command line tool: + +```{bash} +# navigate to the repository root +$ cd template-jb-docs +# sometimes worth running jupyter-book clean book/ to remove old files +$ jupyter-book build book/ +``` +### Windows + +Jupyterbook now supports [Windows](https://jupyterbook.org/en/stable/advanced/windows.html) although the steps for configuring a development environment using Vagrant are available below: + +#### Set up a development environment using Vagrant + +To aid with this we have created a `Vagrantfile` that can allow Windows users who have a virtualisation provider installed (such as [VirtualBox](https://www.virtualbox.org/)) and [Vagrant](https://www.vagrantup.com/) installed to create a headless virtual Linux machine that will build the jupyter book. You can do this with the following steps once you've installed a virtualisation provider and vagrant: +``` +# within git-bash or powershell +$ cd template-jb-docs +$ vagrant up + +# to rebuild the site after changes with the vagrant box running +$ vagrant reload --provision + +# don't forget to destroy the box when you're done +$ vagrant destroy +``` + +This will build the jupyter-book html files on your Windows file system (by navigating via /vagrant) so your local build will still persist after you've destroyed your vagrant box. \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..8938962 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,10 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "hashicorp/bionic64" + + config.vm.hostname = "arcdocsSite" + + config.vm.provision :shell, path: "vagrant/bootstrap.sh" +end diff --git a/book/_config.yml b/book/_config.yml new file mode 100644 index 0000000..c65e61b --- /dev/null +++ b/book/_config.yml @@ -0,0 +1,38 @@ +# Book settings +title: Template documentation jupyter book +author: University of Leeds Research Computing Team +logo: ./assets/img/logo/logo.png +email: ask-rc@leeds.ac.uk +copyright: "2023" + +# execute settings +execute: + execute_notebooks: auto + +# HTML-specific settings +html: + favicon : "./assets/img/logo/favicon-32x32.png" # A path to a favicon image + navbar_number_sections : False # Add a number to each section in your left navbar + google_analytics_id : "" # A GA id that can be used to track book views. + home_page_in_navbar : true # Whether to include your home page in the left Navigation Bar + use_repository_button: true + use_issues_button: true + use_edit_page_button: true + baseurl : "https://arctraining.github.io/template-jb-docs" # The base URL where your book will be hosted. Used for creating image previews and social links. e.g.: https://mypage.com/mybook/ + +# Launch button settings +launch_buttons: + notebook_interface : "classic" # The interface interactive links will activate ["classic", "jupyterlab"] + binderhub_url : "https://mybinder.org" # The URL of the BinderHub (e.g., https://mybinder.org) + jupyterhub_url : "" # The URL of the JupyterHub (e.g., https://datahub.berkeley.edu) + thebelab : false # Add a thebelab button to pages (requires the repository to run on Binder) + +repository: + url : https://github.com/ARCTraining/template-jb-docs # The URL to your book's repository + path_to_book : "book/" # A path to your book's folder, relative to the repository root. + branch : gh-pages # Which branch of the repository should be used when creating links + + +latex: + latex_documents: + targetname: leedsarcdocs.tex diff --git a/book/_toc.yml b/book/_toc.yml new file mode 100644 index 0000000..fd7df89 --- /dev/null +++ b/book/_toc.yml @@ -0,0 +1,13 @@ +# updating for latest jupyter book version + +format: jb-article +# ===== Main Landing Page ======================================== +root: welcome + +# ===== Getting started ========================================== +sections: +- file: example_section/start + sections: + - file: example_section/example +- url: https://arc.leeds.ac.uk + title: Research Computing Website diff --git a/book/assets/img/logo/favicon-32x32.png b/book/assets/img/logo/favicon-32x32.png new file mode 100755 index 0000000..e69bcae Binary files /dev/null and b/book/assets/img/logo/favicon-32x32.png differ diff --git a/book/assets/img/logo/logo.png b/book/assets/img/logo/logo.png new file mode 100644 index 0000000..b3f2654 Binary files /dev/null and b/book/assets/img/logo/logo.png differ diff --git a/book/example_section/example.md b/book/example_section/example.md new file mode 100644 index 0000000..d9373e5 --- /dev/null +++ b/book/example_section/example.md @@ -0,0 +1,3 @@ +# Foo + +Bar bar foo foo \ No newline at end of file diff --git a/book/example_section/start.md b/book/example_section/start.md new file mode 100644 index 0000000..c829c02 --- /dev/null +++ b/book/example_section/start.md @@ -0,0 +1 @@ +# Example section \ No newline at end of file diff --git a/book/welcome.md b/book/welcome.md new file mode 100644 index 0000000..b3fb5e1 --- /dev/null +++ b/book/welcome.md @@ -0,0 +1,3 @@ +# Welcome + +Welcome to a template Documentation site for the [Research Computing Team](https://arcleeds.github.io) at the [University of Leeds](https://www.leeds.ac.uk). diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..9170976 --- /dev/null +++ b/environment.yml @@ -0,0 +1,9 @@ +name: arcdocs-jb +channels: + - defaults + - conda-forge +dependencies: + - python=3.9 + - jinja2=3.0.3 + - jupyter-book=0.15.1 + diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh new file mode 100644 index 0000000..d26373c --- /dev/null +++ b/vagrant/bootstrap.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +apt-get update +apt-get install git +wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh +chmod +x miniconda.sh +./miniconda.sh -b -p /home/vagrant/miniconda +# ensures conda loaded in shell +echo "source /home/vagrant/miniconda/etc/profile.d/conda.sh" >> /home/vagrant/.bashrc +source /home/vagrant/miniconda/etc/profile.d/conda.sh +chown -R vagrant:vagrant /home/vagrant/miniconda + +# create environment and build book +cd /vagrant +conda env create -f environment.yml +conda activate arcdocs-jb +jb clean book/ +jb build book/ \ No newline at end of file