Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparrow0hawk committed May 23, 2022
0 parents commit cd524a6
Show file tree
Hide file tree
Showing 16 changed files with 378 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy-book.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/_build/html
publish_branch: gh-pages
33 changes: 33 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -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/
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# gitignore for template-jb-docs

# built book
**/_build/*

# vagrant stuff
**/.vagrant/*
129 changes: 129 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -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 [email protected].

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.
27 changes: 27 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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 [[email protected]](mailto:[email protected])

42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 10 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions book/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Book settings
title: Template documentation jupyter book
author: University of Leeds Research Computing Team
logo: ./assets/img/logo/logo.png
email: [email protected]
copyright: "2020"

# 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/
navbar_footer_text :
'Visit the <a href="https://arcleeds.github.io/">Research Computing Home Site</a>
<div>
This book is powered by <a href="https://jupyterbook.org">Jupyter Book</a>
</div>' # Will be displayed underneath the left navbar.


# 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
17 changes: 17 additions & 0 deletions book/_toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# these comments are borrowed from https://github.com/alan-turing-institute/the-turing-way/blob/master/book/website/_toc.yml
# Each entry has the following schema:
#
# - title: mytitle # Title of chapter or subchapter
# file: myfile # filename relative to the folder.
# sections: # Contains a list of more entries that make up the chapter's subchapters
#
# Below are some special values that trigger specific behavior:
# - header: My Header # Will insert a header with no link in the sidebar

# ===== Main Landing Page ========================================
- file: welcome

# ===== Getting started ==========================================
- file: example_section/start
sections:
- file: example_section/example
Binary file added book/assets/img/logo/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/assets/img/logo/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions book/example_section/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Foo

Bar bar foo foo
1 change: 1 addition & 0 deletions book/example_section/start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Example section
3 changes: 3 additions & 0 deletions book/welcome.md
Original file line number Diff line number Diff line change
@@ -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).
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: arcdocs-jb
channels:
- defaults
dependencies:
- python=3.7.6
- jinja2=3.0.3
- pip=20
- pip:
- jupyter-book==0.9.1
18 changes: 18 additions & 0 deletions vagrant/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -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/

0 comments on commit cd524a6

Please sign in to comment.