Skip to content

Commit 0f36eea

Browse files
committed
init hub
0 parents  commit 0f36eea

File tree

368 files changed

+65537
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+65537
-0
lines changed

.coveragerc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[run]
2+
parallel = True
3+
branch = False
4+
omit =
5+
jupyterhub/tests/*
6+
jupyterhub/alembic/*
7+
8+
[report]
9+
exclude_lines =
10+
if self.debug:
11+
pragma: no cover
12+
raise NotImplementedError
13+
if __name__ == .__main__.:
14+
ignore_errors = True
15+
omit =
16+
jupyterhub/tests/*
17+
jupyterhub/alembic/*
18+
*/site-packages/*

.dockerignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
examples
2+
bench
3+
jupyterhub_cookie_secret
4+
jupyterhub.sqlite
5+
jupyterhub_config.py
6+
node_modules
7+
docs
8+
.git
9+
dist
10+
build

.flake8

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[flake8]
2+
# Ignore style and complexity
3+
# E: style errors
4+
# W: style warnings
5+
# C: complexity
6+
# F401: module imported but unused
7+
# F403: import *
8+
# F811: redefinition of unused `name` from line `N`
9+
# F841: local variable assigned but never used
10+
# E402: module level import not at top of file
11+
# I100: Import statements are in the wrong order
12+
# I101: Imported names are in the wrong order. Should be
13+
ignore = E, C, W, F401, F403, F811, F841, E402, I100, I101, D400
14+
builtins = c, get_config
15+
exclude =
16+
.cache,
17+
.github,
18+
docs,
19+
jupyterhub/alembic*,
20+
onbuild,
21+
scripts,
22+
share,
23+
tools,
24+
setup.py

.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.md

Whitespace-only changes.

.github/workflows/release.yml

+231
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
3+
#
4+
# Test build release artifacts (PyPI package, Docker images) and publish them on
5+
# pushed git tags.
6+
#
7+
name: Release
8+
9+
on:
10+
pull_request:
11+
paths-ignore:
12+
- "docs/**"
13+
- "**.md"
14+
- "**.rst"
15+
- ".github/workflows/*"
16+
- "!.github/workflows/release.yml"
17+
push:
18+
paths-ignore:
19+
- "docs/**"
20+
- "**.md"
21+
- "**.rst"
22+
- ".github/workflows/*"
23+
- "!.github/workflows/release.yml"
24+
branches-ignore:
25+
- "dependabot/**"
26+
- "pre-commit-ci-update-config"
27+
tags:
28+
- "**"
29+
workflow_dispatch:
30+
31+
jobs:
32+
build-release:
33+
runs-on: ubuntu-20.04
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions/setup-python@v2
37+
with:
38+
python-version: 3.8
39+
40+
- uses: actions/setup-node@v1
41+
with:
42+
node-version: "14"
43+
44+
- name: install build package
45+
run: |
46+
pip install --upgrade pip
47+
pip install build
48+
pip freeze
49+
50+
- name: build release
51+
run: |
52+
python -m build --sdist --wheel .
53+
ls -l dist
54+
55+
- name: verify wheel
56+
run: |
57+
cd dist
58+
pip install ./*.whl
59+
# verify data-files are installed where they are found
60+
cat <<EOF | python
61+
import os
62+
from jupyterhub._data import DATA_FILES_PATH
63+
print(f"DATA_FILES_PATH={DATA_FILES_PATH}")
64+
assert os.path.exists(DATA_FILES_PATH), DATA_FILES_PATH
65+
for subpath in (
66+
"templates/page.html",
67+
"static/css/style.min.css",
68+
"static/components/jquery/dist/jquery.js",
69+
):
70+
path = os.path.join(DATA_FILES_PATH, subpath)
71+
assert os.path.exists(path), path
72+
print("OK")
73+
EOF
74+
75+
# ref: https://github.com/actions/upload-artifact#readme
76+
- uses: actions/upload-artifact@v2
77+
with:
78+
name: jupyterhub-${{ github.sha }}
79+
path: "dist/*"
80+
if-no-files-found: error
81+
82+
- name: Publish to PyPI
83+
if: startsWith(github.ref, 'refs/tags/')
84+
env:
85+
TWINE_USERNAME: __token__
86+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
87+
run: |
88+
pip install twine
89+
twine upload --skip-existing dist/*
90+
91+
publish-docker:
92+
runs-on: ubuntu-20.04
93+
94+
services:
95+
# So that we can test this in PRs/branches
96+
local-registry:
97+
image: registry:2
98+
ports:
99+
- 5000:5000
100+
101+
steps:
102+
- name: Should we push this image to a public registry?
103+
run: |
104+
if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then
105+
# Empty => Docker Hub
106+
echo "REGISTRY=" >> $GITHUB_ENV
107+
else
108+
echo "REGISTRY=localhost:5000/" >> $GITHUB_ENV
109+
fi
110+
111+
- uses: actions/checkout@v2
112+
113+
# Setup docker to build for multiple platforms, see:
114+
# https://github.com/docker/build-push-action/tree/v2.4.0#usage
115+
# https://github.com/docker/build-push-action/blob/v2.4.0/docs/advanced/multi-platform.md
116+
- name: Set up QEMU (for docker buildx)
117+
uses: docker/setup-qemu-action@25f0500ff22e406f7191a2a8ba8cda16901ca018 # associated tag: v1.0.2
118+
119+
- name: Set up Docker Buildx (for multi-arch builds)
120+
uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609 # associated tag: v1.1.2
121+
with:
122+
# Allows pushing to registry on localhost:5000
123+
driver-opts: network=host
124+
125+
- name: Setup push rights to Docker Hub
126+
# This was setup by...
127+
# 1. Creating a Docker Hub service account "jupyterhubbot"
128+
# 2. Creating a access token for the service account specific to this
129+
# repository: https://hub.docker.com/settings/security
130+
# 3. Making the account part of the "bots" team, and granting that team
131+
# permissions to push to the relevant images:
132+
# https://hub.docker.com/orgs/jupyterhub/teams/bots/permissions
133+
# 4. Registering the username and token as a secret for this repo:
134+
# https://github.com/jupyterhub/jupyterhub/settings/secrets/actions
135+
if: env.REGISTRY != 'localhost:5000/'
136+
run: |
137+
docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}"
138+
139+
# image: jupyterhub/jupyterhub
140+
#
141+
# https://github.com/jupyterhub/action-major-minor-tag-calculator
142+
# If this is a tagged build this will return additional parent tags.
143+
# E.g. 1.2.3 is expanded to Docker tags
144+
# [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest] unless
145+
# this is a backported tag in which case the newer tags aren't updated.
146+
# For branches this will return the branch name.
147+
# If GITHUB_TOKEN isn't available (e.g. in PRs) returns no tags [].
148+
- name: Get list of jupyterhub tags
149+
id: jupyterhubtags
150+
uses: jupyterhub/action-major-minor-tag-calculator@v2
151+
with:
152+
githubToken: ${{ secrets.GITHUB_TOKEN }}
153+
prefix: "${{ env.REGISTRY }}jupyterhub/jupyterhub:"
154+
defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub:noref"
155+
branchRegex: ^\w[\w-.]*$
156+
157+
- name: Build and push jupyterhub
158+
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
159+
with:
160+
context: .
161+
platforms: linux/amd64,linux/arm64
162+
push: true
163+
# tags parameter must be a string input so convert `gettags` JSON
164+
# array into a comma separated list of tags
165+
tags: ${{ join(fromJson(steps.jupyterhubtags.outputs.tags)) }}
166+
167+
# image: jupyterhub/jupyterhub-onbuild
168+
#
169+
- name: Get list of jupyterhub-onbuild tags
170+
id: onbuildtags
171+
uses: jupyterhub/action-major-minor-tag-calculator@v2
172+
with:
173+
githubToken: ${{ secrets.GITHUB_TOKEN }}
174+
prefix: "${{ env.REGISTRY }}jupyterhub/jupyterhub-onbuild:"
175+
defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub-onbuild:noref"
176+
branchRegex: ^\w[\w-.]*$
177+
178+
- name: Build and push jupyterhub-onbuild
179+
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
180+
with:
181+
build-args: |
182+
BASE_IMAGE=${{ fromJson(steps.jupyterhubtags.outputs.tags)[0] }}
183+
context: onbuild
184+
platforms: linux/amd64,linux/arm64
185+
push: true
186+
tags: ${{ join(fromJson(steps.onbuildtags.outputs.tags)) }}
187+
188+
# image: jupyterhub/jupyterhub-demo
189+
#
190+
- name: Get list of jupyterhub-demo tags
191+
id: demotags
192+
uses: jupyterhub/action-major-minor-tag-calculator@v2
193+
with:
194+
githubToken: ${{ secrets.GITHUB_TOKEN }}
195+
prefix: "${{ env.REGISTRY }}jupyterhub/jupyterhub-demo:"
196+
defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub-demo:noref"
197+
branchRegex: ^\w[\w-.]*$
198+
199+
- name: Build and push jupyterhub-demo
200+
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
201+
with:
202+
build-args: |
203+
BASE_IMAGE=${{ fromJson(steps.onbuildtags.outputs.tags)[0] }}
204+
context: demo-image
205+
# linux/arm64 currently fails:
206+
# ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
207+
# ERROR: executor failed running [/bin/sh -c python3 -m pip install notebook]: exit code: 1
208+
platforms: linux/amd64
209+
push: true
210+
tags: ${{ join(fromJson(steps.demotags.outputs.tags)) }}
211+
212+
# image: jupyterhub/singleuser
213+
#
214+
- name: Get list of jupyterhub/singleuser tags
215+
id: singleusertags
216+
uses: jupyterhub/action-major-minor-tag-calculator@v2
217+
with:
218+
githubToken: ${{ secrets.GITHUB_TOKEN }}
219+
prefix: "${{ env.REGISTRY }}jupyterhub/singleuser:"
220+
defaultTag: "${{ env.REGISTRY }}jupyterhub/singleuser:noref"
221+
branchRegex: ^\w[\w-.]*$
222+
223+
- name: Build and push jupyterhub/singleuser
224+
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
225+
with:
226+
build-args: |
227+
JUPYTERHUB_VERSION=${{ github.ref_type == 'tag' && github.ref_name || format('git:{0}', github.sha) }}
228+
context: singleuser
229+
platforms: linux/amd64,linux/arm64
230+
push: true
231+
tags: ${{ join(fromJson(steps.singleusertags.outputs.tags)) }}

.github/workflows/support-bot.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# https://github.com/dessant/support-requests
2+
name: "Support Requests"
3+
4+
on:
5+
issues:
6+
types: [labeled, unlabeled, reopened]
7+
8+
permissions:
9+
issues: write
10+
11+
jobs:
12+
action:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: dessant/support-requests@v2
16+
with:
17+
github-token: ${{ github.token }}
18+
support-label: "support"
19+
issue-comment: |
20+
Hi there @{issue-author} :wave:!
21+
22+
I closed this issue because it was labelled as a support question.
23+
24+
Please help us organize discussion by posting this on the http://discourse.jupyter.org/ forum.
25+
26+
Our goal is to sustain a positive experience for both users and developers. We use GitHub issues for specific discussions related to changing a repository's content, and let the forum be where we can more generally help and inspire each other.
27+
28+
Thanks you for being an active member of our community! :heart:
29+
close-issue: true
30+
lock-issue: false
31+
issue-lock-reason: "off-topic"

.github/workflows/test-docs.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
3+
#
4+
# This workflow validates the REST API definition and runs the pytest tests in
5+
# the docs/ folder. This workflow does not build the documentation. That is
6+
# instead tested via ReadTheDocs (https://readthedocs.org/projects/jupyterhub/).
7+
#
8+
name: Test docs
9+
10+
# The tests defined in docs/ are currently influenced by changes to _version.py
11+
# and scopes.py.
12+
on:
13+
pull_request:
14+
paths:
15+
- "docs/**"
16+
- "jupyterhub/_version.py"
17+
- "jupyterhub/scopes.py"
18+
- ".github/workflows/*"
19+
- "!.github/workflows/test-docs.yml"
20+
push:
21+
paths:
22+
- "docs/**"
23+
- "jupyterhub/_version.py"
24+
- "jupyterhub/scopes.py"
25+
- ".github/workflows/*"
26+
- "!.github/workflows/test-docs.yml"
27+
branches-ignore:
28+
- "dependabot/**"
29+
- "pre-commit-ci-update-config"
30+
tags:
31+
- "**"
32+
workflow_dispatch:
33+
34+
env:
35+
# UTF-8 content may be interpreted as ascii and causes errors without this.
36+
LANG: C.UTF-8
37+
PYTEST_ADDOPTS: "--verbose --color=yes"
38+
39+
jobs:
40+
validate-rest-api-definition:
41+
runs-on: ubuntu-20.04
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- name: Validate REST API definition
46+
uses: char0n/swagger-editor-validate@182d1a5d26ff5c2f4f452c43bd55e2c7d8064003
47+
with:
48+
definition-file: docs/source/_static/rest-api.yml
49+
50+
test-docs:
51+
runs-on: ubuntu-20.04
52+
steps:
53+
- uses: actions/checkout@v2
54+
- uses: actions/setup-python@v2
55+
with:
56+
python-version: "3.9"
57+
58+
- name: Install requirements
59+
run: |
60+
pip install -r docs/requirements.txt pytest -e .
61+
62+
- name: pytest docs/
63+
run: |
64+
pytest docs/

0 commit comments

Comments
 (0)