Jupyter notebooks for teaching Dynamo flavour python

We have some renewed interest at our company in python development, so I’d like them to be able to launch a cloud-based IDE if possible?

Has anyone managed to get Jupyter notebooks set up with IronPython and the required stubs? or a github code space template for VS code?

2 Likes

If anyones interested, I set up a Github workspace with the stubs, the docker file required is:

FROM python:2.7

Install dependencies

RUN apt-get update && apt-get install -y
build-essential
libssl-dev
libffi-dev
python-dev
python-pip

Set up the working directory

WORKDIR /workspace

Copy the requirements file

COPY …/requirements.txt .

Install the project dependencies

RUN pip install -r requirements.txt

Set the default command

CMD [“python”]

and the devcontainer.json which configures the space is set up by:

{
“name”: “Python 2.7 environment with VS Code”,
“dockerFile”: “Dockerfile”,
“context”: “.”,
“remoteUser”: “root”,
“runArgs”: [
//“-v”,
//“${LOCALAPPDATA}/Code/User:/root/.config/Code/User”,
//“-v”,
//“${workspaceFolder}:/workspace”
],
“forwardPorts”: [
3000
],
“extensions”: [
“ms-python.python”,
“ms-python.vscode-pylance”,
“oderwat.indent-rainbow”,
“GitHub.vscode-pull-request-github”,
“GrapeCity.gc-excelviewer”,
“2gua.rainbow-brackets”
],
“postCreateCommand”: “python -m venv /workspace/.venv && source /workspace/.venv/bin/activate && python -m pip install -U pip && python -m pip install -r /workspace/requirements.txt”,
// “extrapath”: [
// “/workspace/stubs/stubs.min”
// ],
“settings”: {
“terminal.integrated.shell.linux”: “/bin/bash”,
“python.pythonPath”: “/usr/local/bin/python”,
“python.linting.enabled”: true,
“python.linting.pylintEnabled”: true,
“python.formatting.autopep8Path”: “/usr/local/py-utils/bin/autopep8”,
“python.formatting.blackPath”: “/usr/local/py-utils/bin/black”,
“python.formatting.yapfPath”: “/usr/local/py-utils/bin/yapf”,
“python.linting.banditPath”: “/usr/local/py-utils/bin/bandit”,
“python.linting.flake8Path”: “/usr/local/py-utils/bin/flake8”,
“python.linting.mypyPath”: “/usr/local/py-utils/bin/mypy”,
“python.linting.pycodestylePath”: “/usr/local/py-utils/bin/pycodestyle”,
“python.linting.pydocstylePath”: “/usr/local/py-utils/bin/pydocstyle”,
“python.linting.pylintPath”: “/usr/local/py-utils/bin/pylint”,
“python.linting.pep8Enabled”: false,
“python.analysis.extraPaths”: [
“/workspace/stubs/stubs.min”,
“./stubs/stubs.min”
]
}
}

Happy to explain the set up in more detail if needed.

1 Like