Skip to content

Commit a0555c4

Browse files
committed
MAINT: Add noxfile and build instructions
1 parent 23b60f4 commit a0555c4

File tree

3 files changed

+55
-28
lines changed

3 files changed

+55
-28
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ Gemfile.lock
55
vendor
66
.bundle
77
.sass-cache
8+
.nox
9+
__pycache__/

README.md

+35-28
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,59 @@
22

33
This is the source to [Jupyter.org](https://jupyter.org/).
44

5-
# Build instructions
5+
## Build the site locally
66

7-
The site is built using GitHub Pages Jekyll, see [Jekyll
8-
website](https://jekyllrb.com/) for customizing the build process, and detail on how
9-
what where.
7+
The site is built with Jekyll, see [the Jekyll website](https://jekyllrb.com/) for how to customize the build process.
108

11-
# Quick local testing
9+
The easiest way to build the site locally is by using the [`nox` command line tool](https://nox.thea.codes/). This tool makes it easy to automate commands in a repository, and we have included a `build` command to quickly install the dependencies and build the site.
1210

13-
Clone this repository locally, and cd into it:
11+
To build and preview the site locally, follow these steps:
1412

15-
```
16-
git clone https://github.com/jupyter/jupyter.github.io
17-
cd jupyter.github.io
18-
```
19-
20-
Install `bundler`, and use it to install the dependencies to build the website:
13+
1. **Clone this repository**.
14+
15+
```console
16+
$ git clone https://github.com/jupyter/jupyter.github.io
17+
$ cd jupyter.github.io
18+
```
19+
2. **Install `nox`**
2120

22-
```
23-
gem install bundler
24-
bundle install
25-
```
21+
```console
22+
$ pip install nox
23+
```
24+
3. **Run the `build` command**
25+
26+
```console
27+
$ nox -s build
28+
```
2629

27-
Now you can ask Jekyll to build the website.
2830

29-
```
30-
bundle exec jekyll serve liveserve
31-
```
31+
This will install the needed dependencies in a virtual environment using [the `conda` package manager](https://docs.conda.io/en/latest/).
3232

33-
Open your browser to localhost:4000.
33+
**When the build is finished, go to `localhost:4000`**. When Jekyll finishes building your site, it will open a port on your computer and serve the website there so that you may preview it.
3434

35-
Edit the various parts, the `liveserve` option should automatically rebuild and
36-
refresh the pages when changes occur.
35+
**You can make changes and watch the preview auto-update**. When you make changes to the website, they will automatically be updated in your preview in the browser.
3736

3837
To stop serving the website, press **`Ctrl`**-`C` in your terminal
3938

40-
Enjoy.
39+
### Build the site manually
40+
41+
To build the site manually, check out the installation commands that are in `noxfile.py`. These use `nox` syntax, but they should give you a clear idea of which packages must be installed in order to build the documentation.
42+
43+
## Where the site is hosted
4144

42-
# What is where
45+
The site is automatically built with [Netlify](https://netlify.com), a hosting service for static websites. When any changes are merged into the `master` branch, Netlify will automatically build them and update the website at [jupyter.org](https://jupyter.org).
46+
47+
**You can preview changes in Pull Requests**. Netlify will automatically build a preview of the website in an open Pull Request. To see this, click on the **`Show all checks`** button just above the comment box in the Pull Request window. Then click on **`deploy/netlify`** to see a preview of the built site.
48+
49+
## Structure of this website
4350

4451
Most pages are located at the place where their URL is, nothing fancy. Headers
4552
and footer are in `_includes/head.html`, `_includes/header.html`,
4653
`_includes/footer.html`.
4754

4855
The **navbar** is in `_data/nav.yml` and looks like that:
4956

50-
```
57+
```yaml
5158
head:
5259
- Home
5360
- title: Install
@@ -70,7 +77,7 @@ which means, insert in order the following links into the navbar:
7077
The navbar will automatically target `_blank` pages where the url is explicit,
7178
and mark the correct link as the "current" one.
7279

73-
# How do I create a new page?
80+
## Create a new page
7481

7582
Create `my_page.html` (will have url `https://jupyter.org/my_page.html`)
7683
or `my_page/index.html` (will have url `https://jupyter.org/my_page/`), start with the following:
@@ -88,7 +95,7 @@ You cannot do it yet with .md file, but you will be able soon.
8895

8996
Add commit (and don't forget to add to `_data/nav.yml`).
9097

91-
# Previewing a Pull Request
98+
## Preview a Pull Request
9299

93100
Netlify is used to provide a link to a rendered website with the changes proposed
94101
in a PR. This convenience helps reviewers see how the change would look

noxfile.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import nox
2+
3+
nox.options.reuse_existing_virtualenvs = True
4+
5+
CONDA_DEPS = ["c-compiler", "compilers", "cxx-compiler", "ruby", "python=3.8"]
6+
7+
def install_deps(session):
8+
# Jekyll w/ Conda installation instructions roughly pulled from
9+
# https://s-canchi.github.io/2021-04-30-jekyll-conda/
10+
session.conda_install("--channel=conda-forge", *CONDA_DEPS)
11+
session.run(*"gem install jekyll bundler".split())
12+
session.run(*"bundle install".split())
13+
14+
15+
@nox.session(venv_backend='conda')
16+
def build(session):
17+
install_deps(session)
18+
session.run(*"bundle exec jekyll serve liveserve".split())

0 commit comments

Comments
 (0)