Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sglyon committed Jan 19, 2024
1 parent 7888080 commit d5d6124
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,6 @@ jupyter-lite.json
_output
.jupyterlite.doit.db
.yarn
public
.pnp.cjs
.pnp.loader.mjs
20 changes: 11 additions & 9 deletions dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def task_build():


def update_jlite_json_quickbuild():
jlite_config_path = "../public/jlite/jupyter-lite.json"
jlite_config_path = "./public/jlite/jupyter-lite.json"
# first read in existing jupyter-lite.jsonfile
with open(jlite_config_path, "r") as f:
jlite = json.load(f)
Expand All @@ -42,6 +42,7 @@ def update_jlite_json_quickbuild():
for f in os.listdir("./jupyteach_jupyterlite_contents/labextension/static")
if f.startswith("remoteEntry.")
][0]
print("found remoteEntry file:", remoteEntry)

# find the object within jlite['federated_extensions'] that has name == '@jupyteach/jupyterlite-contents'
ext = None
Expand All @@ -65,7 +66,7 @@ def update_jlite_json_quickbuild():


def create_api_contents():
path = "../public/jlite/api/contents/all.json"
path = "./public/jlite/api/contents/all.json"

# first make sure the directory exists
os.makedirs(os.path.dirname(path), exist_ok=True)
Expand All @@ -74,15 +75,16 @@ def create_api_contents():

print("created file")


def task_devbuild():
return {
"actions": [
"rm -rf _output",
"rm -rf _output public",
"npm run build:prod",
"rm -rf ../public/jlite/extensions/@jupyteach/jupyterlite-contents",
"mkdir -p ../public/jlite/extensions/@jupyteach/jupyterlite-contents",
"jupyter lite build --force",
"rsync -av --delete ./_output/ ../public/jlite/",
"mkdir public",
"rsync -av --delete ./_output/ ./public/jlite/",
"rsync -av --delete ./jupyteach_jupyterlite_contents/labextension/static/ ./public/jlite/extensions/@jupyteach/jupyterlite-contents/static/",
update_jlite_json_quickbuild,
create_api_contents,
],
Expand All @@ -93,9 +95,9 @@ def task_quickbuild():
return {
"actions": [
"npm run build:prod",
"rm -rf ../public/jlite/extensions/@jupyteach/jupyterlite-contents",
"mkdir -p ../public/jlite/extensions/@jupyteach/jupyterlite-contents",
"rsync -av --delete ./jupyteach_jupyterlite_contents/labextension/static/ ../public/jlite/extensions/@jupyteach/jupyterlite-contents/static/",
"rm -rf ./public/jlite/extensions/@jupyteach/jupyterlite-contents",
"mkdir -p ./public/jlite/extensions/@jupyteach/jupyterlite-contents",
"rsync -av --delete ./jupyteach_jupyterlite_contents/labextension/static/ ./public/jlite/extensions/@jupyteach/jupyterlite-contents/static/",
update_jlite_json_quickbuild,
create_api_contents,
],
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dependencies:
- pandas
- statsmodels
- scikit-learn
- requests
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jupyteach/jupyterlite-contents",
"version": "0.2.0",
"version": "0.2.1",
"description": "A JupyterLite server extension.",
"keywords": [
"jupyter",
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ jupyterlite-core==0.1.0
jupyterlite-xeus-python==0.9.0
jupyterlite-pyodide-kernel==0.0.8
jupyterlab_myst==1.2.0
requests
11 changes: 9 additions & 2 deletions src/contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,16 @@ export class JupyteachContents extends Contents {

if (matchPath === matchNbPath && this.el) {
// Only if we are trying to get the exact file we said we wanted...
// if we set forceRefresh to false, then grab from super
// if we set forceRefresh to false, then try to grab
if (haveRefreshArg && !forceRefresh) {
return await super.get(path, options);
try {
const fromSuper = await super.get(path, options);
if (fromSuper !== null) {
return fromSuper;
}
} catch (e) {
console.error('Failed to get from super.get', e);
}
}

// We read this content on mount. Just package it
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"strict": true,
"strictNullChecks": true,
"target": "es2020",
"sourceMap": true,
"types": []
},
"include": ["src/*"]
Expand Down

0 comments on commit d5d6124

Please sign in to comment.