Github codespace portability
Recently i been working on open project with relation to home aquarium statistics and discovered little piece of configuration which instantly set-ups your codespace environment. Within few seconds you have your environment up and running. I’m using visual studio code as development tool which comes with codespace as default.
What is github codespace?
Once you login to github and navigate to your project, you can quickly set-up cloud based development environment where you can edit and run code. Select Code and Create codespace on main. This will create new visual studio code environment.
Get Lucas’s stories in your inbox
Join Medium for free to get updates from this writer.
How to create codespace configuration
In your project create folder called .devcotainer/ with file devcontainer.json
I have created configuration in file devcontainer.json which set-ups container and installs all python packages from the project using pip.
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
},
"postCreateCommand": "python -m venv .venv && .venv/bin/pip install -r requirements.txt",
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": ".venv/bin/python",
"python.venvPath": "${containerWorkspaceFolder}/.venv"
}
}
}
}Once deployment is completed, you can use your working environment right away with fully configured setup.
Conclusion
This little trick allows you to have your working environment quickly deployed and ideas implemented within minutes in any place available with access to internet.




