Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Overhang.IO committed Dec 8, 2023
2 parents 2bed0bb + ff5d528 commit ef1c5b9
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 27 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Run tests

on:
pull_request:
branches: [master]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: |
pip install .[dev]
- name: Test lint, types, and format
run: make test
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ format: ## Format code automatically
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
isort --skip=templates ${SRC_DIRS}

changelog-entry: ## Create a new changelog entry.
scriv create

changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect

ESCAPE = 
help: ## Print this help
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
Expand Down
1 change: 1 addition & 0 deletions changelog.d/20231208_140856_codewithemad_ci_test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Improvement] Makefile updated and test added to the repository and formatted code with Black and isort. (by @CodeWithEmad)
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def load_about():
include_package_data=True,
python_requires=">=3.8",
install_requires=["tutor>=16.0.0,<17.0.0", "tutor-mfe>=16.0.0,<17.0.0"],
extras_require={"dev": "tutor[dev]>=16.0.0,<17.0.0"},
entry_points={
"tutor.plugin.v1": [
"jupyter = tutorjupyter.plugin"
Expand Down
51 changes: 24 additions & 27 deletions tutorjupyter/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import codecs
import os
import os.path
import typing as t
from glob import glob
from secrets import token_bytes

Expand All @@ -20,35 +21,33 @@
# CONFIGURATION
########################################

config: t.Dict[str, t.Dict[str, t.Any]] = {
"defaults": {
"VERSION": __version__,
"DOCKER_IMAGE_HUB": "{{ DOCKER_REGISTRY }}overhangio/jupyterhub:{{ JUPYTER_VERSION }}",
"DOCKER_IMAGE_LAB": "{{ DOCKER_REGISTRY }}overhangio/jupyterlab:{{ JUPYTER_VERSION }}",
"HOST": "jupyter.{{ LMS_HOST }}",
"DEFAULT_PASSPORT_ID": "jupyterhub",
"LTI_CLIENT_KEY": "openedx",
"HUB_MYSQL_DATABASE": "jupyterhub",
"HUB_MYSQL_USERNAME": "jupyterhub",
"LAB_CPU_LIMIT": None,
"LAB_MEMORY_LIMIT": "200M",
},
"unique": {
"HUB_COOKIE_SECRET": "{{ 32|jupyterhub_crypt_key }}",
"HUB_CRYPT_KEY": "{{ 32|jupyterhub_crypt_key }}",
"HUB_MYSQL_PASSWORD": "{{ 24|random_string }}",
"LTI_CLIENT_SECRET": "{{ 24|random_string }}",
},
}
hooks.Filters.CONFIG_DEFAULTS.add_items(
[
("JUPYTER_VERSION", __version__),
(
"JUPYTER_DOCKER_IMAGE_HUB",
"{{ DOCKER_REGISTRY }}overhangio/jupyterhub:{{ JUPYTER_VERSION }}",
),
(
"JUPYTER_DOCKER_IMAGE_LAB",
"{{ DOCKER_REGISTRY }}overhangio/jupyterlab:{{ JUPYTER_VERSION }}",
),
("JUPYTER_HOST", "jupyter.{{ LMS_HOST }}"),
("JUPYTER_DEFAULT_PASSPORT_ID", "jupyterhub"),
("JUPYTER_LTI_CLIENT_KEY", "openedx"),
("JUPYTER_HUB_MYSQL_DATABASE", "jupyterhub"),
("JUPYTER_HUB_MYSQL_USERNAME", "jupyterhub"),
("JUPYTER_LAB_CPU_LIMIT", None),
("JUPYTER_LAB_MEMORY_LIMIT", "200M"),
]
[(f"JUPYTER_{key}", value) for key, value in config.get("defaults", {}).items()]
)

hooks.Filters.CONFIG_UNIQUE.add_items(
[
("JUPYTER_HUB_COOKIE_SECRET", "{{ 32|jupyterhub_crypt_key }}"),
("JUPYTER_HUB_CRYPT_KEY", "{{ 32|jupyterhub_crypt_key }}"),
("JUPYTER_HUB_MYSQL_PASSWORD", "{{ 24|random_string }}"),
("JUPYTER_LTI_CLIENT_SECRET", "{{ 24|random_string }}"),
]
[(f"JUPYTER_{key}", value) for key, value in config.get("unique", {}).items()]
)
hooks.Filters.CONFIG_OVERRIDES.add_items(list(config.get("overrides", {}).items()))


def jupyterhub_crypt_key(size: int) -> str:
Expand Down Expand Up @@ -85,7 +84,6 @@ def jupyterhub_crypt_key(size: int) -> str:
# DOCKER IMAGE MANAGEMENT
########################################


hooks.Filters.IMAGES_BUILD.add_items(
[
(
Expand Down Expand Up @@ -134,7 +132,6 @@ def jupyterhub_crypt_key(size: int) -> str:
],
)


########################################
# PATCH LOADING
########################################
Expand Down

0 comments on commit ef1c5b9

Please sign in to comment.