GitHub Codespaces is a revolutionary tool developed by GitHub that allows developers to create and access complete and customized development environments remotely, directly from a web browser. With Codespaces, there is no longer a need to set up complex local environments, as it provides a ready-to-use development environment in the cloud.
In this blog post, I want to share more insights about Codespaces and why I decided to start using it in software development projects.
When a developer sets up a Codespace, a virtual instance is created in the cloud and it contains all the necessary tools and configurations to develop an application. This space can be accessed from any compatible web browser or connected from popular IDEs, providing great flexibility and portability for developers.
Key Features of Codespaces:
Let’s learn the main aspects of the tool:
- Customization of the development environment: Developers can customize their development environment by choosing the specific tools, languages, and configurations they need for their projects. By modifying a few simple configuration files, one can set up the development environment to be replicable and usable in the same way for all project users.
- Access from any browser: Codespaces allows developers to access their development environment from any compatible web browser. This means you can work on your project from your personal computer, a friend’s computer, or even a tablet.
- Integration with Git and GitHub: As part of the GitHub product family, Codespaces is closely integrated with Git and GitHub. This means that changes made in a Codespace can be easily managed with Git and synchronized with a GitHub repository.
- Support for popular extensions and tools: Codespaces supports a wide range of extensions and popular tools used by developers. You can use and install the extensions and libraries you want in Codespace. You can also connect to one or more Codespaces without leaving Visual Studio Code, thereby keeping your themes, shortcuts, and extensions.
- Hardware resource savings: By using Codespaces, developers do not need to invest in expensive or powerful hardware to run local development environments. The cloud infrastructure provided by GitHub handles all the heavy lifting, allowing developers to use lighter machines and save resources. Virtual machines with different resource capacities can be selected as needed, and you only pay for the time in which you use them.
- Elimination of the need to configure and maintain local environments: By using Codespaces, developers can forget about configuring and maintaining complex local environments. Codespaces provides a ready-to-use development environment, saving time and reducing potential frustrations related to environment setup. This greatly facilitates the onboarding of new employees by providing them with a ready-to-use development environment without the need for knowledge transfer on environment configuration.
- Multiple “disposable” development environments: GitHub allows us to create multiple Codespaces simultaneously from the same repository without the need to discard the one we are using. This is a great advantage over a local development environment, where if we want to work on another task or branch, or even review our colleague’s code, we would have to switch our environment to the new one. This tool allows us to create a new environment, use it, and discard it whenever we want.
Getting Started with Codespaces:
If the benefits convinced you, let me give you a quick tutorial on how to kick off your own Codespace.
- Sign in to your GitHub account and navigate to the repository you want to work on.
- Click on the “Code” button at the top right of the repository and select “Open with Codespaces” from the dropdown menu.
- This will open a new window with the Codespaces development environment. You can customize the environment by installing extensions, adjusting settings, and defining your preferences.
- Start working on your project using the tools and features available in the Codespaces environment. You can edit files, run commands, and use Git as you usually would in a local environment.
- Once you have finished working, you can save and synchronize your changes with the GitHub repository.
It’s that simple! Remember to check the pricing for each machine type. The cheapest option allows 60 free hours per month, so don’t hesitate to try it.
Use Cases and Real Examples:
In my case, I have been using Codespaces exclusively for a project for over a year. The project has a heavy development environment that makes local development difficult, slow, and frustrating. Codespaces allow me to work on the project with a simpler local computer and a virtual machine that adjusts to the project’s needs. But above all, the functionality I use the most is setting up multiple Codespaces to review my colleagues’ pull requests and work on multiple tasks with minimal effort.
As previously mentioned, another example widely used by developers is setting up Codespaces as a powerful virtual machine to train and use artificial intelligence models. These models often require a significant amount of computational resources for an extended period, which can push our personal computers to their limits. Here is an example of how we can train a model in a Codespace to generate images.
Lastly, a use case we have employed in my team is using Codespaces for mobile development. Many mobile applications require a back end to function, wherein they request HTTP to retrieve the information to display to the user. Setting up a mobile development environment is already resource-intensive and slow, and adding a back end to it can be detrimental to our computer’s performance. In our case, each developer can set up the back end in their Codespace and use its URL as the back end for the mobile application.
A Codespace for Each Necessity
In conclusion, GitHub Codespaces is a revolutionary tool that allows developers to access complete, customized development environments remotely and directly from a web browser. With Codespaces, developers can avoid configuring and maintaining complex local environments, saving time and reducing potential frustrations related to environment setup.
Real-world use cases for Codespaces are diverse. It can be used for collaborative development, testing and debugging, code review, learning and teaching, and development on devices with limited resources. Additionally, the ability to create multiple “disposable” development environments from the same repository provides great flexibility and efficiency.
In summary, GitHub Codespaces simplifies the software development process by providing complete and customized development environments in the cloud. With its easy access, customizability, and elimination of the need to maintain complex local environments, Codespaces has become an invaluable tool for developers, enhancing productivity and collaboration in software projects.
Keep reading about Git and how it works internally here.
See related posts
In this post, we take a closer look at the Tech Lead role, and how crucial they are for a project’s success.