Codespaces Archives - The GitHub Blog https://github.blog/tag/codespaces/ Updates, ideas, and inspiration from GitHub to help developers build and design software. Tue, 13 Feb 2024 13:57:29 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://github.blog/wp-content/uploads/2019/01/cropped-github-favicon-512.png?fit=32%2C32 Codespaces Archives - The GitHub Blog https://github.blog/tag/codespaces/ 32 32 153214340 Bringing npm registry services to GitHub Codespaces https://github.blog/engineering/engineering-principles/bringing-npm-registry-services-to-github-codespaces/ Tue, 13 Feb 2024 18:00:19 +0000 https://github.blog/?p=76582 The npm engineering team recently transitioned to using GitHub Codespaces for local development for npm registry services. This shift to Codespaces has substantially reduced the friction of our inner development loop and boosted developer productivity.

The post Bringing npm registry services to GitHub Codespaces appeared first on The GitHub Blog.

]]>
The npm engineering team recently transitioned to using GitHub Codespaces for local development for npm registry services. This shift to Codespaces has substantially reduced the friction of our inner development loop and boosted developer productivity. In this post, we would like to share our experiences and learnings from this transition, hoping this information may be useful to you.

What are npm registry services

npm registry services, the Node.js microservices that power the npm registry, are distributed across 30+ different repositories. Each microservice has its own repository and is containerized using Docker. With Codespaces, we develop npm registry services using Docker on Codespaces with Visual Studio Code.

Codespaces reduces the friction of inner dev loop

Prior to Codespaces, a significant hurdle in npm local development was the difficulty in testing code across multiple services. We lacked a straightforward way to run multiple registry services locally, instead relying on our staging environment for testing. For example, to verify a code change in one service that affected a user workflow involving five other services, we could only run that service locally and connect to the remaining five in the staging environment. Due to security reasons, access to our staging environment is only possible via a VPN, adding another layer of complexity to the code testing process.

Codespaces addressed this issue by simplifying the process of running multiple registry services locally. When working in a codespace we no longer need a VPN connection for the inner dev loop. This change spares the team from potential issues related to VPN connectivity, and significantly simplifies the process of getting started.

As developers, we often rely on breakpoints for debugging. Now, with all registry services running within a single workspace, we can debug code and hit breakpoints across multiple services in Visual Studio Code as if they were one service. This is a significant improvement over previous developer experience, where hitting breakpoints in the services within the staging environment was not possible.

Codespaces boosts developer productivity

Codespaces has made it easier for outside contributors to participate. For example, if a GitHub engineer outside of the npm team wishes to contribute, they can get started within minutes with Codespaces, as the development environment is pre-configured and ready to go. Previously, setting up the development environment and granting permissions to access the staging resources would take days and often resulted in partners from other teams like design simply not contributing.

Port forwarding gives us access to TCP ports running within a codespace. Automatic port forwarding in Codespaces allows us to access services from a browser on our local machine for testing and debugging.

The in browser Codespaces experience, powered by Visual Studio Code for the Web, offers the flexibility to work from any computer. This is particularly helpful when you are away from your primary work computer, but need to test a quick change. The Web-based Codespaces experience provides a zero-install experience running entirely in your browser.

Remember those times when you were bogged down with a local environment issue that was not only time-consuming to troubleshoot but also difficult to reproduce on other machines? With Codespaces, you can quickly spin up a new Codespaces instance within minutes for a fresh start. The best part? There’s no need to fix the issue; you can simply discard the old codespace.

Things we learned from our use of Codespaces

Codespaces has tons of features to save you time and automate processes. Here are a few tips we learned from our use of Codespaces.

The prebuild feature of Codespaces is an excellent way to speed up the creation of a new codespace by creating a snapshot of your devcontainer and caching all the cloned repositories that can be used at startup time for the codespace. Codespaces prebuilds enable you to select branches and leverage GitHub Actions for automatic updates of these prebuilds.

You can store account-specific development secrets, such as access tokens, in Codespaces on a per-repository basis, ensuring secure usage within Codespaces. Those secrets are available as environment variables in your environment.

Another tip is specific to the Visual Studio Code Dev Container. Consider utilizing the Dev Container’s lifecycle events (such as postCreateCommand in devcontainer.json) to automate the Codespaces setup as much as possible. Ultimately, it’s a balance between time saved through automation and time invested in building and maintaining it. However, automation typically results in greater time savings because everyone who uses the configuration benefits.

Another trick is to use GitHub dotfiles to personalize your Codespaces. Dotfiles are files and folders on Unix-like systems starting with . that control the configuration of applications and shells on your system. You can use GitHub dotfiles to set up your personalized settings in Codespaces.

Conclusion

The adoption of GitHub Codespaces has substantially improved the developer experience of working on npm registry services. It has not only reduced the development environment setup time from hours to minutes but also facilitated better debugging experiences. Furthermore, it provides time-saving features like prebuilds. We hope this blog post offers valuable insights into our use of Codespaces. For more information, please refer to Codespaces documentation.

Harness the power of Codespaces. Learn more or get started now.

The post Bringing npm registry services to GitHub Codespaces appeared first on The GitHub Blog.

]]>
76582
How GitHub’s Developer Experience team improved innerloop development https://github.blog/engineering/engineering-principles/how-githubs-developer-experience-team-improved-innerloop-development/ Wed, 24 Jan 2024 23:21:49 +0000 https://github.blog/?p=76399 Our latest solution to the ubiquitous engineering problem of integration testing in a distributed service ecosystem here at GitHub.

The post How GitHub’s Developer Experience team improved innerloop development appeared first on The GitHub Blog.

]]>

Building confidence in new code before deploying is a crucial part of any good development loop. This is especially challenging when working in a distributed or microservice system with multiple teams operating on different services. This modular team structure gives rise to an important question: how can we provide teams with fast and reliable development cycles when testing and shipping requires them to test inside an ecosystem of other services? Optimizing the solution to this problem greatly improves engineering efficiency and can contribute to more successful outcomes for the organization as a whole.

This problem is one the Developer Experience (DX) team at GitHub grappled with again and again, ultimately delivering a solution we call “Hubber Codespace” (HCS). HCS is a tool that Hubbers (people who work at GitHub) can use to locally stand up the entire distributed GitHub ecosystem in any environment by simply querying an endpoint or adding a couple lines of configuration to their development containers.

In this post, we’ll tell you how we landed on the HCS solution to this common problem over some possible alternatives, and you’ll get a first-hand look at how GitHub’s developer-first mindset helped us deliver the best tool for Hubbers to ship code quickly and safely in our own distributed environment.

One big (un)-happy environment

To understand the problem we were trying to solve, we have to go back in time. There was a point at which GitHub was just a couple teams and a much simpler product. Back then, having a monorepo in which everyone iterated and built confidence in their changes made sense. Splitting responsibilities up across repositories would have added overhead that bogged down early Hubbers. Fast forward to today, and GitHub has grown into a big organization with hundreds of different teams. Now, the balancing act of evaluating between velocity vs. complexity can look very different.

Let’s consider these complexities a bit further. Different services can have entirely different sets of dependencies and even have dependencies on different versions of the same software (for example, one service requires Ruby 2.2 while another requires Ruby 2.4). In smaller collaborative settings, the engineers can easily reconcile these needs. But this complexity grows exponentially as more teams are introduced. Trying to provide a single environment in which these kinds of disparate services can run and interact in development becomes difficult to do. It can result in ad-hoc “hacks” in development loops like deleting a .ruby-version file depending on which service’s development loop you’re working through. These are the kinds of problems that you encounter when trying to work with a monorepo that contains the codebases for a set of disparate services.

So, we decided to design a new solution. Instead of bringing the developers to the ecosystem, what if we brought the ecosystem to the developers?

Enter HCS

This line of thinking led us to build HCS, a Docker-Compose project that does exactly that. In the post “How we build containerized services at GitHub using GitHub,” we detailed how we build containerized services that power microservices on the GitHub.com platform and many internal tools. Our task now was to take these containers and wire them up such that partner teams could spin up a full GitHub ecosystem on demand. This would allow them to test their changes in an integrated environment. Developers could see how their code behaves when introduced to GitHub’s distributed system, rather than only observing it in the isolated environment of the application being developed before deploying within the full system. In this way, developers could gain confidence that the services they were changing behaved correctly when interacting with their up and downstream dependencies.

When considering how to orchestrate all the required containers, a few solutions came to mind: Docker-Compose, an internal tool called Codespace-Compose that allows us to SSH tunnel between multiple codespaces, and Minikube. Any of these three solutions could solve the ecosystem problem and would have unique tradeoffs. Let’s look at some of those tradeoffs now.

Minikube offers a robust Kubernetes architecture, but we had concerns about the overall user experience. We ultimately decided against it as the issues we identified, such as networking complexity and long cycle times, could bog down development speed.

Codespace-Compose allows us to easily connect teams’ everyday development environments, but we reasoned that, since Codespace-Compose is an internal experiment without any SLA, we’d incur a maintenance cost on our own team by adopting this.

Docker-Compose seemed to fit our needs the best. It didn’t incur any additional maintenance burden since it’s publicly available and actively managed. It offers all the same benefits of Minikube without the long cycle time. Most importantly, using Docker in Docker in a codespace, which allows us to create docker containers on a host which is a docker container itself, is a well-paved path that has lots of prior art. Given all these considerations, we decided on orchestrating our containers using Docker-Compose.

After deciding on Docker-Compose as our orchestrator, the next steps were to figure out the interface. Docker-Compose already supplies end users with commands, but we wanted to optimize the UX around HCS. To do this, we built a user-friendly CLI in Golang with parallel versioning to HCS. This abstracted away all the complexity of using the two together. Simply download a specific release version for HCS, get the same version of the CLI binary, and you’re good to go!

CLI and release automation

Ensuring HCS is useful means ensuring a couple of things. One important goal is ease of use. Docker-Compose already offers an interface for end users, but considering some of the built in commands are long and use predictable options, we decided to wrap it in a custom Golang CLI. This abstracted many of the underlying details away, such as static file locations, formatting options, entrypoint commands, etc. to improve end-user experience. The code below shows this by juxtaposing the Docker-Compose commands with their equivalent HCS CLI command.

The following example compares the commands to start up the integrated environment provided by HCS.

# Start using Docker-Compose

docker compose --project-name hcs \
--file /workspaces/hubber-codespace-dist/docker-compose-hcs-actions.yml \
--file /workspaces/hubber-codespace-dist/docker-compose-hcs-base.yml \
--file /workspaces/hubber-codespace-dist/docker-compose-hcs-bg.yml \
--file /workspaces/hubber-codespace-dist/docker-compose-hcs-core.yml \
--file /workspaces/hubber-codespace-dist/docker-compose-hcs-volume.yml \
--file /workspaces/hubber-codespace-dist/docker-compose-hcs-test.yml \
--file /workspaces/hubber-codespace-dist/docker-compose-hcs-vendor.yml \
--profile full up -d --remove-orphans

# Start using CLI

hcs start

This next example compares how to get a shell to run commands from inside the various containers in GitHub’s distributed ecosystem. This allows developers to modularly interact with and make ephemeral changes to the system.

# Run command from inside a container in the system using Docker-Compose

docker compose --project-name hcs exec bash

# Run from inside a container using CLI

hcs shell

This example compares how to check the status of the containers in the project so end-users can easily see the health of the entire system.

# Status using Docker-Compose

docker compose --project-name hcs ps --format json

# Status using CLI

hcs status

In addition to this easy-to-use and ergonomic CLI, we had to ensure that HCS runs an up-to-date version of the GitHub ecosystem. GitHub is made up of so many different moving pieces that testing new changes on code that’s even a couple days old would not be sufficient to build confidence. When iterating directly on the monorepo, this was a non-issue since folks just fetched the main branch. For HCS, this required us to build automation that cuts releases on a frequent cron schedule. A release of HCS is a software artifact containing the compiled Golang binary for HCS and its CLI that can be pulled using the gh CLI.

The diagram below illustrates how this process works.

This diagram shows the nightly release cycle of HCS. HCS's repository gets SHAs from the monorepo and other service repositories. Then it publishes a release with all the SHAs, the Docker-Compose configs, and the CLI binary.

End-user experience

Using HCS directly in your codespace

We’ve recently made efforts to push all development at GitHub onto GitHub Codespaces. A codespace is a custom development container, or devcontainer, based on a configuration file in a repository. A repository can have multiple codespaces associated with it as long as each has a unique configuration file. On top of the obvious benefits of having a reproducible environment on demand to develop and iterate in, devcontainers offer features. This abstraction allows developers to easily add software to their environments. HCS is also consumable this way. The code block below shows the couple lines needed to bring this entire ecosystem to a partner team’s preferred environment (that is, their codespace).

{
…
  "features": {
    …
    "ghcr.io/devcontainers/features/github-cli:1": {
      "version": "latest"
    },
    //docker-in-docker required for hcs
    "ghcr.io/devcontainers/features/docker-in-docker:2": {},
    // Include the hubber-codespace feature
    "ghcr.io/github/hubber-codespace/hcs:1": {},
    "ghcr.io/devcontainers/features/go:1": {}
    …
  }
}

Now, teams can perform integration testing against the many other services in GitHub’s ecosystem from directly in the codespace where they were doing local development.

Release binary

Even with the push towards codespaces, not every context that requires an ecosystem will be a devcontainer. In light of this, we also gave end users the option to download the release directly from the GitHub API. The commands to do so can be seen below. With a couple simple commands, Hubbers now have everything they need to bring the entire GitHub ecosystem to whatever environment they want.

gh release download --repo github/hubber-codespace  -p hcs -D /tmp/

chmod +x /tmp/hcs

sudo mv /tmp/hcs /usr/local/bin

hcs init

hcs pull

hcs start

Testimonials

But don’t just take my word for it. Check out what our partner teams have had to say about HCS improving their development loop:

“HCS has improved our dev loop for [our service] by making it simple to test [it] against [the rest of GitHub’s ecosystem]. It’s turned what used to be a number of manual steps to clone our repository into the [monorepo environment] into two simple commands in our own codespace. This has made it much easier to validate our changes without having to deploy to a staging environment.”

“Given that we are a service operating outside GitHub but with a heavy reliance on the services running within GitHub, we’ve had to go through a lot of bells and whistles to ensure we can have a smooth development experience. In my four years working on [our service], HCS has been the most seamless experience in going from a blank devbox to breakpointing live running code for our service.”

Conclusion

Solving the ecosystem problem is always a balancing act. Luckily, thanks to GitHub’s push towards containerization, and tooling such as repository automation and publishing/consuming releases through the GitHub CLI, we were adequately equipped to develop a solution with HCS. Hubbers can now leverage a development loop that allows them to deploy with confidence, having tested their changes within GitHub’s complex multi-service system.

The post How GitHub’s Developer Experience team improved innerloop development appeared first on The GitHub Blog.

]]>
76399
Optimize your GitHub Codespaces costs with upgraded virtual machines https://github.blog/engineering/architecture-optimization/how-github-reduces-costs-with-upgraded-codespaces/ Thu, 31 Aug 2023 15:00:52 +0000 https://github.blog/?p=73937 See how much more you can get out of GitHub Codespaces by taking advantage of the improved processing power and increased headroom in the next generation of virtual machines.

The post Optimize your GitHub Codespaces costs with upgraded virtual machines appeared first on The GitHub Blog.

]]>
Since we released GitHub Codespaces in 2021, we’ve made a number of updates aimed at improving usability, controlling cost, and more (for example, free usage for all, one click into templates, and concurrency policies). Now, GitHub has improved our developer experience and reduced usage costs at the same time by taking advantage of new virtual machines that provide all of our users twice the RAM, and approximately 10-30% improved CPU performance after adopting Advanced Micro Devices (AMD)-based hosts. These changes enable you to achieve the same (or better) machine performance for half the cost of the previous machine generation.

How this change helps you

In our previous VM generation, memory intensive workloads often had to overprovision CPUs just to get enough RAM in order to run, particularly when running multiple services. For professional developers this was particularly frustrating because of the increased complexity of their development environments, and their higher expectations for performance. Now, rather than having to choose between paying a premium for larger developer machines or sacrificing developer experience and productivity, you can get the best of both worlds.

For example, at GitHub we use our own software and services to build GitHub itself. GitHub uses Codespaces to build not only Codespaces, but the entire platform. GitHub has a large Ruby monolith that requires significant CPU and RAM to test, and also sets an extremely high bar for developer experience. In order to operate these environments while maximizing developer happiness, GitHub used the largest virtual machines available in Codespaces.

Once the new machine types were available, GitHub’s internal developer experience (DX) team started by moving a few dev teams with RAM-hungry workflows to machines with half the CPU count, but the same RAM, to test whether they would be sufficient. With very little effort, and nearly zero developer impact, testing showed that developers were just as successful on the smaller machines, and GitHub incurred half the cost. As additional teams tried moving the fewer-core machines, there was only one build process that turned out to be CPU architecture dependent. The fix was simple—to specify the CPU architecture so that QEMU could emulate appropriately. No other negative impacts were identified.

Due to the success of the initial trials, we quickly rolled out the changes to more teams. The result? Approximately 50% savings!

Figure 1: Codespaces cost for GitHub during the introduction of the AMD machines

Since we’ve rolled out the AMD machines for GitHub, we’ve seen no problems and had only happy users.

You can do the same in your organization by working with your development teams using GitHub Codespaces to test smaller machines on your existing development environments. All Codespaces virtual machines have been upgraded, so testing is as simple as having some developers try working in a smaller machine than they usually do. In most cases, no other configuration changes are necessary!

Once you have found the sweet spot for performance and experience, you can set a policy within your organization to restrict machine types, ensuring cost controls while providing environments that allow your developers to do their best work.

Save costs while empowering your developers

Now that these changes are in your hands, we invite you to see how much more you can get out of GitHub Codespaces by taking advantage of the improved processing power and increased headroom the RAM provides. As ever, please reach out to your account team, or participate in the GitHub Codespaces Community Discussions to provide us your feedback.


The post Optimize your GitHub Codespaces costs with upgraded virtual machines appeared first on The GitHub Blog.

]]>
73937
Unleashing GitHub Codespaces templates to ignite your development https://github.blog/developer-skills/github/unleashing-github-codespaces-templates-to-ignite-your-development/ Thu, 24 Aug 2023 16:57:10 +0000 https://github.blog/?p=73825 Learn how to leverage templating features in GitHub Codespaces to streamline your project setup, improve consistency, and simplify collaboration within your development team.

The post Unleashing GitHub Codespaces templates to ignite your development appeared first on The GitHub Blog.

]]>
Ever found yourself struggling to set up a brand-new Integrated Development Environment (IDE) for a project? The overwhelming process of dealing with build errors, dependencies, and configurations can leave you feeling frustrated and short on time. Trust me, I’ve been there, too. As an avid developer, I understand the struggles and challenges firsthand.

That’s when I discovered GitHub Codespaces, and it’s a game-changer. GitHub Codespaces is a cloud-based coding environment for collaborative development accessible through a browser. Templates include specific configurations of tools, libraries, and settings within GitHub Codespaces, enabling developers to quickly create consistent coding environments for various projects without having to set up everything from scratch.

With customizable environments, streamlined workflows, and easy setup sharing, you can be more productive and focus on creating exceptional software.

With the rich offering of existing templates available at my disposal, I quickly realized there are many possibilities. As I was working on My Android app, I was looking for a template that would let me build My Android app. However, because there was no Android template, I decided to build my own.

Together, let’s conquer setup challenges and unlock a world of coding possibilities. With great power comes great coding!

Step 1: Customizing a GitHub Codespaces template and connecting to a repository

While you can find a number of templates for React, Django, and Ruby on Rails in the template library, I couldn’t find the one I needed for Android.

Fortunately, creating a custom template is a breeze! Just head to GitHub Codespaces and select the “Blank” template. Starting with a blank template opens a codespace that I can configure per my needs.

Screenshot showing the "Blank" template listing, with the description, "Start with a blank canvas or import any packages you need."

Clicking on “Use this template” launches a codespace in a separate tab within your browser.

Screenshot of the blank template opened in a browser tab.

My new codespace is called “vigilant potato” as you can see from the URL in the screenshot above. Your codespace will get its own unique, and maybe cute, name.

If you get distracted by something else, and need to come back to your codespace, you can access it from github.com/codespaces by looking for the “vigilant potato” among the list of codespaces—you might need to scroll down to find it if you have other codespaces.

Screenshot showing a list of codespaces owned by the logged-in user, include the recently created "vigilant potato."

Click on the three horizontal dots at the end of the row and select “Publish to a new repository.” This flow seamlessly lets you create a new repository and preserves your development environment and any code you might have added that belongs to your project.

Screenshot of the menu with the option "Publish to a new repository" selected.

Once your repository is created, you’ll be able to see it in your GitHub Settings > your repositories. Or, if you’d like to connect to an existing repository, you can do so through the terminal.

Step 2: Configuring your environment: devcontainer.json/Dockerfile

There are two ways to customize your environment in a template. The two ways: using either a devcontainer.json file or a Dockerfile. The devcontainer.json file focuses on configuring the development environment within Visual Studio Code, while a Dockerfile allows you to create a custom Docker image that forms the basis of the entire development environment. Both files are essential for defining and customizing the development environment to meet the specific requirements of your project.

For my Android development environment, I have to create a Dockerfile. To harness this power, I simply navigate to the root of my repository and create a new file called Dockerfile. You can define the base image, specify environment variables, copy files and directories, install dependencies, execute commands, expose ports, define the working directory, run services, and set the entrypoint or command. These instructions allow you to tailor the Docker image to include the necessary tools, configurations, and dependencies required for your project.

Watch the magic unfold as a tailored, fully-configured development environment materializes in the cloud. In an instant, you’ll be immersed in a seamless coding experience, equipped with all the necessary tools. Say goodbye to setup hassles and dive straight into your code. With a customized codespace template, you’ll have a portable development sanctuary that follows you everywhere. For my Android repository, I very easily followed these steps and a brand new codespace built from the blank template opened for my repository in a separate browser tab.

Screenshot of the codespace's Dockerfile.

Here are a few snippets from my Android Dockerfile to demonstrate its power.

Automating Android SDK installation

# Update package list and install packages required for Android app development
RUN apt-get update -yqq && \
apt-get install -y \
curl \
expect \
git \
make \
wget \
unzip \
vim \
openssh-client \
locales \
libarchive-tools && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

In this example, I am using regular shell commands to install the Android SDK.

Setting environment variables

# Set environment variables used by the Android SDK
ENV ANDROID_SDK_HOME /opt/android-sdk-linux
ENV ANDROID_SDK_ROOT /opt/android-sdk-linux
ENV ANDROID_HOME /opt/android-sdk-linux
ENV ANDROID_SDK /opt/android-sdk-linux

This snippet showcases how the Dockerfile lets you set environment variables that are necessary for development.

This remarkable file guarantees a breeze for anyone cloning my repository, effortlessly setting up a standardized development environment. Say goodbye to manual setup hassles and welcome a seamless and efficient collaborative experience.

Conclusion

By embracing these steps, I’ve discovered that the entire process of creating and using GitHub Codespaces templates can be incredibly easy, enjoyable, and efficient. Leveraging the power of templates and devcontainer.json files means I never have to start from scratch again. What used to be a painstaking, day plus process of downloading and installing all of the Android SDK and Java components, setting the environment variables, getting the libraries, and maintaining their updates is no more through using my pre-configured Android template. I have created additional templates for work that are Java and Python development environments.

Remember, with great coding comes great responsibility,and a lot fewer debugging sessions! Happy coding, and may the bugs be ever in your favor!

If you’re also an Android developer, try out my template or explore the other templates GitHub offers and customize your own.

The post Unleashing GitHub Codespaces templates to ignite your development appeared first on The GitHub Blog.

]]>
73825
Revolutionize your open source workflows: the top 3 reasons why GitHub Codespaces is a must-have for maintainers https://github.blog/open-source/maintainers/revolutionize-your-open-source-workflows-the-top-3-reasons-why-github-codespaces-is-a-must-have-for-maintainers/ Wed, 10 May 2023 19:09:40 +0000 https://github.blog/?p=71844 GitHub Codespaces is reliable, accessible, and always-ready. Try it out during Maintainer Month and take your projects to new heights!

The post Revolutionize your open source workflows: the top 3 reasons why GitHub Codespaces is a must-have for maintainers appeared first on The GitHub Blog.

]]>
Lee este articulo en español

Imagínate esto: te sientas en tu escritorio con una taza de café caliente y una relajante lista de reproducción lofi que se reproduce de fondo. Abres ansiosamente tu computadora, listo para comenzar a codificar. Pero para tu consternación, se ve afectado por una espera de una hora para que tu máquina local se inicie. Tu café se enfría, y la inspiración que tenías se ha ido hace mucho tiempo para cuando tu computadora finalmente se pone en marcha.

Ahora, ¿qué pasaría si hubiera una solución que te proporcionara un entorno de desarrollo accesible, confiable y siempre listo, sin problemas de compatibilidad ni tiempo de inactividad extenso? Con GitHub Codespaces, puedes codificar sin interrupciones y disfrutar de tu café mientras aún está caliente.

GitHub Codespaces es más que un entorno de desarrollo alojado en la nube: es un cambio de juego para los mantenedores de código abierto. Ya sea que seas un profesional experimentado o recién comiences, GitHub Codespaces ofrece una variedad de beneficios que pueden ayudarte a optimizar tu flujo de trabajo, mejorar la colaboración y garantizar la confiabilidad de tu proyecto. En este blog, exploraremos las tres razones principales por las que deberías considerar usar GitHub Codespaces para tus proyectos de código abierto.

Pero primero, ¿qué es GitHub Codespaces?

GitHub Codespaces es un revolucionario entorno de desarrollo basado en la nube que hace que sea más fácil que nunca crear, administrar y colaborar en código en la nube. Puede poner en marcha un entorno de desarrollo preconfigurado en poco tiempo, completo con todas las herramientas y dependencias que necesita para comenzar tu proyecto. Si eres nuevo en GitHub Codespaces, puedes aprender cómo comenzar aquí.

Este proceso simplificado elimina la necesidad de tareas de configuración manual, liberando un tiempo valioso para ti y tus colaboradores. Y con GitHub Codespaces, los colaboradores pueden acceder fácilmente a tu IDE desde cualquier lugar con una conexión a Internet. Esto significa que pueden trabajar en tu proyecto desde cualquier dispositivo, en cualquier momento, sin preocuparse por problemas de compatibilidad.

GitHub Codespaces ya es un cambio de juego comprobado para proyectos de código abierto, que incluyen:

  • fastai/course22 usa GitHub Codespaces para proporcionar un entorno hospedado en la nube para ejecutar blocs de notas de Jupyter durante los cursos de aprendizaje profundo.
  • apache/airflow Apache Airflow es una plataforma de código abierto para crear, programar y monitorear flujos de trabajo mediante programación. El proyecto está utilizando GitHub Codespaces, y los colaboradores pueden poner en marcha un entorno de desarrollo completamente configurado con todas las dependencias y herramientas necesarias para trabajar en Airflow.
  • mastodon/mastodon, una plataforma de redes sociales, ha implementado GitHub Codespaces para simplificar la experiencia de desarrollo para sus colaboradores.
  • Astropy, una biblioteca de astronomía, aprovecha GitHub Codespaces para proporcionar un entorno de desarrollo para colaboradores y simplifica el proceso de instalación de dependencias.

Tres beneficios de GitHub Codespaces para mantenedores

Los Codespaces de GitHub ofrecen una gama de beneficios que pueden ayudar a agilizar los flujos de trabajo y aumentar la productividad. Aquí hay tres formas clave en que GitHub Codespaces puede ayudarte como mantenedor en tu proyecto de código abierto:

1. Fácil instalación y configuración = menor tiempo a empezar desarrollo

Como mantenedores de proyectos de código abierto, a menudo nos encontramos con el desafío de ayudar a los nuevos contribuyentes a establecer un entorno local. Este proceso puede llevar mucho tiempo y puede llevar desde un día hasta una semana, dependiendo de la calidad de la documentación disponible.

Una de las principales ventajas de usar GitHub Codespaces es la facilidad de instalación y el tiempo de configuración. Cuando se trata de administrar repositorios de código grandes o complejos, las precompilaciones de GitHub Codespaces pueden acelerar significativamente el proceso de creación de nuevos espacios de código. Esto es particularmente beneficioso para bases de código considerables que de otro modo requerirían largos tiempos de configuración.

GitHub Codespaces puede automatizar el proceso de incorporación de colaboradores y mantenedores al proporcionar un entorno personalizado preconfigurado que incluye todas las extensiones, dependencias y variables de entorno necesarias. Esto significa que cuando un nuevo colaborador está listo para contribuir, simplemente puede abrir un espacio de código y omitir la configuración del entorno local. Esto es particularmente útil para los mantenedores y colaboradores de código abierto que necesitan administrar o contribuir a múltiples proyectos con diferentes configuraciones.

Para los nuevos colaboradores, configurar pruebas y garantizar que las solicitudes de extracción estén en la forma correcta para los mantenedores puede ser un proceso frustrante. Esto puede retultar en que muchos nuevos contribuyentes abandonen tus esfuerzos y los mantenedores tengan dificultades para fomentar nuevos contribuyentes. Sin embargo, GitHub Codespaces puede ayudar creando una experiencia fluida y eficiente para contribuir al repositorio. Esto puede mejorar significativamente las posibilidades de que los nuevos contribuyentes se queden y mantengan experiencias positivas tanto para los contribuyentes como para los mantenedores.

2. Entornos de desarrollo coherentes y personalizables

Un beneficio clave de usar GitHub Codespaces es que ofrece una experiencia consistente y poderosa tanto para mantenedores como para colaboradores. Al preconfigurar el entorno de desarrollo, los mantenedores pueden proporcionar a los colaboradores una experiencia coherente, independientemente de tu máquina física. Esto significa que los colaboradores pueden trabajar con los mismos recursos potentes, lo que les permite colaborar en proyectos sin ningún problema de configuración.

Los Codespaces de GitHub ofrecen capacidades de personalización incomparables que se pueden adaptar a las necesidades únicas de cada proyecto. Al incluir un archivo devcontainer.json en el repositorio del proyecto, los desarrolladores pueden desbloquear una multitud de opciones de personalización similares a las que se encuentran en VS Code Dev Containers.

Estas personalizaciones pueden variar desde elegir el sistema operativo basado en Linux hasta configurar variables de entorno, instalar tiempos de ejecución, marcos y herramientas, reenviar puertos de uso común e incluso establecer configuraciones y extensiones preferidas del editor. Con GitHub Codespaces, los desarrolladores tienen la flexibilidad de crear entornos de desarrollo que se adapten perfectamente a los requisitos de tu proyecto. Este nivel de personalización permite a los equipos colaborar de manera más eficiente y, en última instancia, entregar código de mayor calidad.

Aquí hay un ejemplo de un contenedor de desarrollo para el proyecto etcd-io / etcd. La siguiente imagen muestra un archivo de configuración JSON para un contenedor de desarrolladores, que utiliza la imagen de Microsoft Go con la versión 1.19 en la distribución Bullseye de Debian como base. El contenedor tiene características adicionales habilitadas, como docker-in-docker y la CLI de GitHub, y reenvía los puertos 2379 y 2380 del contenedor a la máquina local. Una vez creado el contenedor, ejecuta el comando “make build”. Las propiedades opcionales específicas de la herramienta se pueden agregar en la sección “personalizaciones”.

Screenshot of the devcontainer.json file in the etcd project.

3. Mejor Seguridad

Otro beneficio clave de usar GitHub Codespaces es la seguridad mejorada. Debido a que tu entorno de desarrollo está alojado en la nube, no tienes que preocuparte por las vulnerabilidades de seguridad en las máquinas locales.

GitHub Codespaces está diseñado para ser seguro de forma predeterminada y garantiza el aislamiento de GitHub Codespaces entre sí al asignar a cada uno tu propia máquina virtual y red. Además de ofrecer una multitud de opciones de personalización, utilizar un archivo devcontainer.json para configurar tus espacios de código de GitHub también puede desempeñar un papel vital para asegurar el entorno de desarrollo de tus colaboradores. Al especificar las herramientas y configuraciones necesarias para el entorno de desarrollo a través del archivo devcontainer.json, puede asegurarte de que los colaboradores tengan un entorno de desarrollo seguro y coherente.

Esto incluye especificar la configuración relacionada con la seguridad, como los requisitos de cifrado, las reglas de firewall y los controles de acceso. Al hacerlo, puede reducir el riesgo de posibles vulnerabilidades de seguridad y ayudar a proteger la información confidencial.

Cómo comenzar con GitHub Codespaces

Los Codespaces de GitHub ofrecen una amplia gama de beneficios que pueden ayudar a mejorar tu proceso de desarrollo y alcanzar los objetivos de tu proyecto. Con GitHub Codespaces, puedes disfrutar de una instalación y configuración sencillas, colaboración mejorada, seguridad mejorada y sobrecarga de mantenimiento reducida.

Si está buscando una herramienta para optimizar tu flujo de trabajo y llevar tu proyecto al siguiente nivel, entonces GitHub Codespaces puede ser la solución perfecta.

¿Listo para probarlo?

GitHub Codespaces presenta una emocionante oportunidad de optimización de colaboración para proyectos de código abierto; con 60 horas de uso gratuito disponibles para cuentas individuales, es fácil comenzar con GitHub Codespaces.

Esta poderosa combinación de uso gratuito y almacenamiento preconstruido gratuito puede ayudar a que los proyectos de código abierto crezcan y florezcan, ya que los contribuyentes trabajan juntos sin problemas. Nos apasiona potenciar los proyectos de código abierto, y estamos entusiasmados de ayudarte a llevar tu proyecto a nuevas alturas. Si tienes alguna pregunta o estás interesado en obtener más información, no dudes en dejar un comentario en nuestra discussion de retroalimentacion.

¡Gracias por todo lo que haces y feliz mantenimiento!

El mes de mayo es el Mes del Mantenedor ✨ y queremos tomar un momento para apreciar todo el arduo trabajo que los mantenedores de código abierto como tu hacen para que el mundo sea un lugar mejor a través del software 💗 ¡Gracias! Echa un vistazo a todos los talleres y eventos gratuitos que se realizan durante todo el mes.


Leia este artigo em português

Imagine o seguinte: você se senta em sua mesa com uma xícara de café quente e uma playlist lofi relaxante tocando ao fundo. Você abre ansiosamente seu computador, para começar a codar. Mas, para seu desespero, ele é mostra uma espera de uma hora para que sua máquina local inicialize. Seu café fica frio, e a inspiração que você tinha já se foi há muito tempo quando seu computador finalmente inicializa.

Agora, e se houvesse uma solução que fornecesse um ambiente de desenvolvimento acessível, confiável e sempre pronto, sem problemas de compatibilidade ou tempo de inatividade extenso? Com o GitHub Codespaces, você pode codar perfeitamente e desfrutar seu café enquanto ele ainda está quente.

O GitHub Codespaces é mais do que um ambiente de desenvolvimento hospedado na nuvem – é um divisor de águas para pessoas mantenedoras de código aberto. Se você é alguéml experiente ou está apenas começando, o GitHub Codespaces oferece uma variedade de benefícios que podem ajudá-lo a simplificar seu fluxo de trabalho, melhorar a colaboração e garantir a confiabilidade de seu projeto. Neste blog, exploraremos as três principais razões pelas quais você deve considerar o uso de Codespaces do GitHub para seus projetos de código aberto.

Mas primeiro, o que é o GitHub Codespaces?

O GitHub Codespaces é um ambiente de desenvolvimento revolucionário baseado em nuvem que torna mais fácil do que nunca criar, gerenciar e colaborar em código na nuvem. Você pode colocar um ambiente de desenvolvimento pré-configurado em funcionamento rapidamente, completo com todas as ferramentas e dependências necessárias para iniciar seu projeto. Se você é novo no GitHub Codespaces, saiba como começar aqui.

Esse processo simplificado elimina a necessidade de tarefas manuais de configuração, liberando um tempo valioso para você e colaboradores. E com o GitHub Codespaces, as pessoas que colaboram com seus projetos podem acessar facilmente seu IDE de qualquer lugar com uma conexão com a Internet. Isso significa que elas podem trabalhar em seu projeto de qualquer dispositivo, a qualquer momento, sem se preocupar com problemas de compatibilidade.

O GitHub Codespaces já é um divisor de águas comprovado para projetos de código aberto, incluindo:

  • fastai/course22 usa o GitHub Codespaces para fornecer um ambiente hospedado na nuvem para executar blocos de anotações Jupyter durante cursos de aprendizado profundo.
  • apache/airflow O Apache Airflow é uma plataforma de código aberto para criar, programar e monitorar fluxos de trabalho programaticamente. O projeto está usando o GitHub Codespaces, e as pessoas colaboradoras podem iniciar um ambiente de desenvolvimento totalmente configurado com todas as dependências e ferramentas necessárias para trabalhar no Airflow.
  • Mastodon/Mastodon, uma plataforma de mídia social, implementou o GitHub Codespaces para simplificar a experiência de desenvolvimento para euas pessoas colaboradoras.
  • O Astropy, uma biblioteca de astronomia, aproveita os Codespaces do GitHub para fornecer um ambiente de desenvolvimento para as pessoas que colaboradoram e simplifica o processo de instalação de dependências.

Três benefícios do GitHub Codespaces para pessoas mantenedoras

Os Codespaces do GitHub oferecem uma série de benefícios que podem ajudar a simplificar os fluxos de trabalho e aumentar a produtividade. Aqui estão três maneiras principais pelas quais o GitHub Codespaces pode ajudá-lo como pessoa mantenedora em seu projeto de código aberto:

1. Fácil instalação e configuração = menos tempo para iniciar o desenvolvimento

Como pessoas mantenedoras de projetos de código aberto, muitas vezes encontramos o desafio de ajudar novas pessoas colaboradoras a estabelecer um ambiente local. Esse processo pode ser demorado e pode levar de um dia a uma semana, dependendo da qualidade da documentação disponível.

Uma das principais vantagens de usar o GitHub Codespaces é a facilidade de instalação e tempo de configuração. Quando se trata de gerenciar repositórios de código grandes ou complexos, pré-compilações de Codespaces do GitHub Eles podem acelerar significativamente o processo de criação de novos espaços de código. Isso é particularmente benéfico para bases de código consideráveis que, de outra forma, exigiriam longos tempos de configuração.

O GitHub Codespaces pode automatizar o processo de integração fornecendo um ambiente personalizado pré-configurado que inclui todas as extensões, dependências e variáveis de ambiente necessárias. Isso significa que, quando uma nova pessoa colaborada estiver pronto para contribuir, ela poderá simplesmente abrir um espaço de código e ignorar a configuração da localidade. Isso é particularmente útil para pessoas que precisam gerenciar ou contribuir para vários projetos com configurações diferentes.

Para nova colaborações, configurar testes e garantir que as PRs estejam na forma certa pode ser um processo frustrante. Isso pode resultar em muitos novos contribuintes abandonando seus esforços e mantenedores tendo dificuldade em incentivar novas contribuições. No entanto, o GitHub Codespaces pode ajudar criando uma experiência suave e eficiente para contribuir com o repositório. Isso pode melhorar significativamente as chances de nova pessoas permanecerem e manterem experiências positivas tanto para os contribuintes quanto para os mantenedores.

2. Ambientes de desenvolvimento consistentes e personalizáveis

Um dos principais benefícios do uso do GitHub Codespaces é que ele oferece uma experiência consistente e poderosa para pessoas mantenedoras e colaboradoras. Ao pré-configurar o ambiente de desenvolvimento, pessoas mantenedoras podem fornecer as colaboradoras uma experiência consistente, independentemente de sua máquina física. Isso significa que as pessoas colaboradoras podem trabalhar com os mesmos recursos poderosos, permitindo que colaborem em projetos sem problemas de configuração.

Os Codespaces do GitHub oferecem recursos de personalização incomparáveis que podem ser adaptados às necessidades exclusivas de cada projeto. Ao incluir um arquivo devcontainer.json no repositório do projeto, os devs podem desbloquear uma infinidade de opções de personalização semelhantes às encontradas nos contêineres de desenvolvimento de código VS.

Essas personalizações podem variar desde a escolha do sistema operacional baseado em Linux até a configuração de variáveis de ambiente, instalação de tempos de execução, estruturas e ferramentas, encaminhamento de portas comumente usadas e até mesmo a definição de configurações e extensões preferenciais do editor. Com o GitHub Codespaces, pessoas desenvolvedoras têm a flexibilidade de criar ambientes de desenvolvimento que se encaixam perfeitamente em seus requisitos de projeto. Esse nível de personalização permite que as equipes colaborem de forma mais eficiente e, em última análise, forneçam código de maior qualidade.

Aqui está um exemplo de um contêiner de desenvolvimento para o projeto etcd-io/etcd. A imagem a seguir mostra um arquivo de configuração JSON para um contêiner de desenvolvedor, que usa a imagem do Microsoft Go com a versão 1.19 na distribuição Debian Bullseye como base. O contêiner tem recursos adicionais habilitados, como docker-in-docker e a CLI do GitHub, e encaminha as portas 2379 e 2380 do contêiner para a máquina local. Depois que o contêiner for criado, execute o comando “make build”. Propriedades opcionais específicas da ferramenta podem ser adicionadas na seção “personalizações”.

Screenshot of the devcontainer.json file in the etcd project.

3. Melhor segurança

Outro benefício importante do uso do GitHub Codespaces é a segurança aprimorada. Como seu ambiente de desenvolvimento está hospedado na nuvem, você não precisa se preocupar com vulnerabilidades de segurança em computadores locais.

O GitHub Codespaces foi projetado para ser seguro por padrão e garante o isolamento dos Codespaces do GitHub uns dos outros, atribuindo a cada um sua própria máquina virtual e rede. Além de oferecer uma infinidade de opções de personalização, usar um arquivo devcontainer.json para configurar seus espaços de código do GitHub também pode desempenhar um papel vital na proteção do ambiente de desenvolvimento de suas pessoas colaboradoras. Especificando as ferramentas e configurações necessárias para seu ambiente de desenvolvimento por meio do arquivo devcontainer.json, você pode garantir um ambiente de desenvolvimento seguro e consistente.

Isso inclui especificar configurações relacionadas à segurança, como requisitos de criptografia, regras de firewall e controles de acesso. Ao fazer isso, você pode reduzir o risco de possíveis vulnerabilidades de segurança e ajudar a proteger informações confidenciais.

Introdução ao GitHub Codespaces

Os Codespaces do GitHub oferecem uma ampla gama de benefícios que podem ajudar a melhorar seu processo de desenvolvimento e atingir suas metas de projeto. Com o GitHub Codespaces, você pode desfrutar de fácil instalação e configuração, colaboração aprimorada, segurança aprimorada e sobrecarga de manutenção reduzida.

Se você está procurando uma ferramenta para simplificar seu fluxo de trabalho e levar seu projeto para o próximo nível, o GitHub Codespaces pode ser a solução perfeita.

Pronto para experimentá-lo?

O GitHub Codespaces apresenta uma oportunidade empolgante de otimização de colaboração para projetos de código aberto; Com 60 horas de uso gratuito disponíveis para contas individuais, é fácil começar a usar o GitHub Codespaces.

Essa poderosa combinação de armazenamento pré-criado e gratuito pode ajudar os projetos de código aberto a crescer e florescer, à medida que pessoas colaboradoras trabalham juntas sem problemas. Somos apaixonados por capacitar projetos de código aberto e estamos entusiasmados em ajudá-lo a levar seu projeto a novos patamares. Se você tiver alguma dúvida ou estiver interessado em saber mais, sinta-se à vontade para deixar um comentário em nossa discussão de feedback.

Obrigado por tudo que você faz e manutenção feliz!

O mês de maio é o Mês da Pessoa Mantenedora ✨ e queremos tirar um momento para apreciar todo o trabalho árduo das pessoas que mantêm código aberto como você faz para tornar o mundo um lugar melhor através do software 💗. Confira todas as oficinas e eventos gratuitos que acontecem ao longo do mês. E confira também nosso novo site criado especialmente para a comunidade de código aberto brasileira GitHubBrasil.com.



Picture this—you settle down at your desk with a piping hot cup of coffee, and a relaxing lofi playlist playing in the background. You eagerly open up your computer, ready to start coding. But to your dismay, you’re hit with an hour-long wait for your local machine to boot up. Your coffee goes cold, and the inspiration you had is long gone by the time your computer finally gets up and running.

Now, what if there was a solution that provided you with an accessible, dependable, and always-ready development environment, with no compatibility issues or extensive downtime? With GitHub Codespaces, you can code without interruptions, and enjoy your coffee while it’s still hot.

GitHub Codespaces is more than just a cloud-hosted development environment—it’s a game-changer for open source maintainers. Whether you’re an experienced pro or just starting out, GitHub Codespaces offers a range of benefits that can help you streamline your workflow, improve collaboration, and ensure the reliability of your project. In this blog, we’ll explore the top three reasons why you should consider using GitHub Codespaces for your open source projects.

But first, what is GitHub Codespaces?

GitHub Codespaces is a revolutionary cloud-based development environment that makes it easier than ever to create, manage, and collaborate on code in the cloud. You can spin up a pre-configured development environment in no time, complete with all the tools and dependencies you need to get started on your project. If you’re new to GitHub Codespaces, you can learn how to get started here.

This streamlined process eliminates the need for manual configuration tasks, freeing up valuable time for you and your contributors. And with GitHub Codespaces, contributors can easily access their IDE from anywhere with an internet connection. This means they can work on your project from any device, at any time, without worrying about compatibility issues.

GitHub Codespaces is already a proven game-changer for open source projects, including:

  • fastai/course22 uses GitHub Codespaces to provide a cloud-hosted environment for running Jupyter notebooks during deep learning courses.
  • apache/airflow Apache Airflow is an open source platform to programmatically author, schedule, and monitor workflows. The project is using GitHub Codespaces, and contributors can spin up a fully configured development environment with all the necessary dependencies and tools to work on Airflow.
  • mastodon/mastodon, a social network platform, has implemented GitHub Codespaces to simplify the development experience for its contributors.
  • Astropy, an astronomy library, leverages GitHub Codespaces to provide a development environment for its contributors and simplify the installation process of dependencies.

Screenshot of the welcome message file of the Astropy open source project, which uses GitHub Codespaces to make sure you have all the dependencies installed.

Three benefits of GitHub Codespaces for maintainers

GitHub Codespaces offer a range of benefits that can help streamline workflows and boost productivity. Here are three key ways GitHub Codespaces can help you as a maintainer in your open source project:

1. Easy setup and configuration = shorter time to development

As maintainers of open source projects, we often encounter the challenge of helping new contributors set up a local environment. This process can be time-consuming, and can take anywhere from a day to a week, depending on the quality of the documentation available.

One of the main advantages of using GitHub Codespaces is the ease of setup and time to configuration. When it comes to managing large or complex code repositories, GitHub Codespaces’ prebuilds can significantly speed up the process of creating new codespaces. This is particularly beneficial for sizeable codebases that would otherwise require lengthy setup times.

GitHub Codespaces can automate the contributor and maintainer onboarding process by providing a preconfigured, custom environment that includes all necessary extensions, dependencies, and environment variables. This means that when a new contributor is ready to contribute, they can simply open a codespace and skip the local environment setup. This is particularly useful for open source maintainers and contributors who need to manage or contribute to multiple projects with different configurations.

For new contributors, setting up tests and ensuring that pull requests are in the correct shape for maintainers can be a frustrating process. This can result in many new contributors abandoning their efforts and maintainers having a hard time fostering new contributors. However, GitHub Codespaces can help by creating a seamless and efficient experience for contributing to the repository. This can significantly improve the chances of new contributors sticking around and maintaining positive experiences for both contributors and maintainers.

2. Consistent and customizable development environments

A key benefit of using GitHub Codespaces is that it offers a consistent and powerful experience for maintainers and contributors alike. By pre-configuring the development environment, maintainers can provide contributors with a consistent experience, regardless of their physical machine. This means that contributors can work with the same powerful resources, enabling them to collaborate on projects without any setup hassle.

GitHub Codespaces offer unparalleled customization capabilities that can be tailored to each project’s unique needs. By including a devcontainer.json file in the project repository, developers can unlock a multitude of customization options similar to those found in VS Code Dev Containers.

These customizations can range from choosing the Linux-based operating system to configuring environment variables, installing runtimes, frameworks, and tools, forwarding commonly used ports, and even setting preferred editor settings and extensions. With GitHub Codespaces, developers have the flexibility to create development environments that are perfectly suited for their project’s requirements. This level of customization empowers teams to collaborate more efficiently and ultimately deliver higher quality code.

Here’s an example of a dev container for project etcd-io/etcd. The image below shows a JSON configuration file for a developer container, which uses the Microsoft Go image with version 1.19 on the Bullseye distribution of Debian as its base. The container has additional features enabled, such as docker-in-docker and the GitHub CLI, and forwards the 2379 and 2380 ports from the container to the local machine. After the container is created, it runs the “make build” command. Optional tool-specific properties can be added in the “customizations” section.

Screenshot of the devcontainer.json file in the etcd project.

Enhanced security

Another key benefit of using GitHub Codespaces is enhanced security. Because your development environment is hosted in the cloud, you don’t have to worry about security vulnerabilities on local machines.

GitHub Codespaces is designed to be secure by default and ensures the isolation of GitHub Codespaces from each other by assigning each one its own virtual machine and network. In addition to offering a multitude of customization options, utilizing a devcontainer.json file to configure your GitHub Codespaces can also play a vital role in securing your contributors’ development environment. By specifying the necessary tools and configurations for your development environment through the devcontainer.json file, you can ensure that your contributors have a secure and consistent development environment.

This includes specifying security-related settings, such as encryption requirements, firewall rules, and access controls. By doing so, you can reduce the risk of potential security vulnerabilities and help to protect sensitive information.

Getting you and your projects started with GitHub Codespaces

GitHub Codespaces offer a wide range of benefits that can help improve your development process and achieve your project goals. With GitHub Codespaces, you can enjoy easy setup and configuration, improved collaboration, enhanced security, and reduced maintenance overhead.

If you’re looking for a tool to streamline your workflow and take your project to the next level, then GitHub Codespaces may be the perfect solution.

Quote from Craig Peters, Staff Product Manager at GitHub: "For open source maintainers, GitHub Codespaces provide a reliable and cloud-based environment that can help foster positive experiences for both contributors and maintainers."

Ready to give it a try?

GitHub Codespaces present an exciting collaboration optimization opportunity for open source projects; with 60 hours of free usage available for individual accounts, it’s easy to get started with GitHub Codespaces.

This powerful combination of free usage and free prebuilt storage can help open source projects to grow and flourish, as contributors work together seamlessly. We are passionate about empowering open source projects, and we’re excited to help you take your project to new heights. If you have any questions or are interested in learning more, please feel free to drop a comment in our discussion.


Thank you for all you do and happy maintaining!

The month of May is Maintainer Month ✨ and we want to take a moment to appreciate all the hard work that open source maintainers like you do to make the world a better place through software 💗 Thank You! Checkout all the free workshops and events happening throughout the month.

Thanks, y'all! "Behind every successful open source project is a dedicated group of maintainers. Thank you for your tireless effort and commitment to making the world a better place, one line of code at a time."

The post Revolutionize your open source workflows: the top 3 reasons why GitHub Codespaces is a must-have for maintainers appeared first on The GitHub Blog.

]]>
71844
How to automate your dev environment with dev containers and GitHub Codespaces https://github.blog/developer-skills/github/how-to-automate-your-dev-environment-with-dev-containers-and-github-codespaces/ Mon, 06 Mar 2023 17:27:47 +0000 https://github.blog/?p=70517 GitHub Codespaces enables you to start coding faster when coupled with dev containers. Learn how to automate a portion of your development environment by adding a dev container to an open source project using GitHub Codespaces.

The post How to automate your dev environment with dev containers and GitHub Codespaces appeared first on The GitHub Blog.

]]>
When I started my first role as a software engineer, I remember taking about four days to set up my local development environment. I had so many issues with missing dependencies, incorrect versions, and failed installations. When I finally finished setting up all the tools and software I needed to be a productive member of the team, I cloned one of our repositories to my machine, set up my environment variables, ran npm run dev and received so many errors because I forgot to install the dependencies (and read the README) or switch to the right node version. Ugh! I can’t tell you how many times this happened to me in my first year!

Back then, I wished I had a way that was streamlined—something I set up only once, that just worked every time I accessed the repository. Although I did learn how to automate my computer setup with a Brewfile, I wish I could just get to coding in a repository without thinking about configuration.

Gif from the animated show Spongebob Squarepants of a character picking up a computer as if to toss it away, saying "I'll show you automated."
source

When I think about how we work on projects in a repository, I realize that many of the processes we need to get started on that project can be automated with the help of dev containers, in this case, by using a devcontainer.json file and Codespaces.

Let’s take a look at how we can automate our dev environment by adding a dev container to this open source project—Tech is Hiring in GitHub Codespaces.

For a TLDR of this post, GitHub Codespaces enables you to start coding faster when coupled with dev containers. See image below for a summary of how:

Image of a table entitled "Start coding faster with Codespaces." The left column is labeled "Old Way" and the right column is labeled "New Way." The rest of this blog post will enumerate the items listed in the image.

Now, let’s get some definitions out of the way.

What is GitHub Codespaces?

GitHub Codespaces is a development environment in the cloud. It is hosted by GitHub in an isolated environment (Docker container) that runs on a virtual machine. If you’re not familiar with virtual machines or Docker containers, take a look at these videos: what is a virtual machine? and what are Docker containers?.

Currently, individual developers have 60 hours of free codespaces usage per month, so definitely take advantage of this awesomeness to build from anywhere.

What are dev containers?

Dev containers allow us to run our code in a preconfigured, isolated environment (container). It gives us the ability to predefine our dev environment in our repositories and use a consistent, reliable environment across the board without worrying about configuration files—since it’s all set up for us from the beginning with a devcontainer.json file.

What is the devcontainer.json file?

The devcontainer.json file is a document that defines how your project will build, display, and run. Simply put, it allows us to specify the behavior we want in our dev environment. For example, if we have a devcontainer.json file that includes installing the ESLint extension in VS Code, once we open up a workspace, ESLint will be automatically installed for us.

Automating your workflow with dev containers and GitHub Codespaces

To start using GitHub Codespaces, we don’t need to set up a devcontainer.json file. By default, GitHub Codespaces uses the universal dev container image, which caters to a vast array of languages and tools. This means, whenever you open up a new codespace without a devcontainer.json file your codespace will automagically load so you can code instantly. However, adding a devcontainer.json file gives us the ability to automate a lot of our dev environment workflows to our liking.

Okay, okay, that was a lot of chatter—let’s now get into what you really came here for!

Gif of the character Mary Poppins pinching shut the mouth of her talking umbrella handle and telling it, "The will be quite enough of that, thank you." She then opens the umbrella and floats away.
source

Using the open source project, Tech is Hiring, let’s walk through how we typically work with a repository using our local dev environment.

What work typically looks like

At first glance, we see that this project uses Nextjs, Tailwind CSS, Chakra UI, TypeScript, Storybook, Vite, Cypress, Axios, and Reactjs as some of its dependencies. We’d need to install all these dependencies to our local machine to get this project running.

  1. Let’s clone the repository, and cd into the project.

    Gif of the terminal output as the Tech is Hiring repository is cloned.

  2. Then, let’s install dependencies to get the project running locally.

    Gif showing terminal output as the necessary dependencies are installed.

  3. This project uses storybook, so let’s run both storybook and spin up the actual app locally.

    Gif of the user's desktop with a terminal app running commands.

The process is not so bad, but it took a bit of time. We also need to check to make sure we’re using the correct node version, check if we need any environment variables, and if there are any runtime errors to resolve. Thankfully, I didn’t encounter any errors while working on this, but it still took a bit of time.

Going faster with GitHub Codespaces and dev containers

Let’s make the process better by adding a devcontainer.json file to this project and opening it in GitHub Codespaces to see what happens.

We can either use the VS Code command palette to add a pre-existing dev container or we can write the configuration file ourselves (which we’ll do below).

  1. Let’s first create a .devcontainer folder in the root of the project and a devcontainer.json file in the new folder.

    Creating a a `.devcontainer` folder in the root of the project and a `devcontainer.json` file in the new folder.

  2. Now, let’s automate installing dependencies, starting the dev server, opening a preview of our app on localhost:3000, and installing vscode extensions. Once we get everything configured, your json file should look like this:

    {
      // image being used
       "image": "mcr.microsoft.com/devcontainers/universal:2",
      // set minimum cpu
       "hostRequirements": {
           "cpus": 4
       },
       // install dependencies and start app
       "updateContentCommand": "npm install",
       "postAttachCommand": "npm run dev",
       // open app.tsx once container is built
       "customizations": {
           "codespaces": {
               "openFiles": [
                   "src/pages/_app.tsx"
               ]
           },
           // install some vscode extensions
           "vscode": {
               "extensions": [
                   "dbaeumer.vscode-eslint",
                   "github.vscode-pull-request-github",
                   "eamodio.gitlens",
                   "christian-kohler.npm-intellisense"
               ]
           }
       },
       // connect to remote server
       "forwardPorts": [3000],
       // give port a label and open a preview of the app
       "portsAttributes": {
          "3000": {
             "label": "Application",
             "onAutoForward": "openPreview"
           }
         }
    }
    

    Sidenote: I’ve broken down the purpose of the properties in this file for you by adding comments before each. To learn more about each property, continue reading at container.dev. I also installed a few extensions that are not needed, but I wanted to show you that you could automate installing extensions, too!

  3. Let’s commit the file and merge it into the main branch, then open up the project in GitHub Codespaces.

    Committing a file, merging it to the main branch, and then opening GitHub Codespaces.

    When we open up the application in GitHub Codespaces, our dependencies will be installed, the server will start, and a preview will automatically open for us. If we needed environment variables to work on this repository, those would have already been configured for us as a repository secret on GitHub. We also didn’t need to install hefty node_modules to our machine.

I call this a win!

Comparing both ways

There’s plenty more that we can do with dev containers and GitHub Codespaces to automate our dev environment. But let’s summarize what we just did in GitHub Codespaces and with the help of dev containers:

  • We clicked the GitHub Codespaces button on the GitHub repository.
  • Everything was setup/installed for us (thanks json file!).
  • We got to work and started coding.

Now, isn’t that better?

Wrapping up

So, what’s the point of GitHub Codespaces and why should you care as a developer? Well, for one, you can automate most of the startup processes you need to access a repository. You can also do a lot more customizations to your dev environment with dev containers. Take a look at all the options you have—and watch out for my next blog post where I’ll go through the anatomy of a devcontainer.json file.

Secondly, you can code from anywhere. I hate it when I’m not able to access one of my side projects on a different machine because that one machine is configured perfectly to suit the project. With GitHub Codespaces, you can start coding at the click of a button and from any machine that supports a modern browser.

I encourage you to get started with GitHub Codespaces today and try adding a devcontainer.json file to one of your projects! I promise you won’t regret it.

Until next time, happy coding!

The post How to automate your dev environment with dev containers and GitHub Codespaces appeared first on The GitHub Blog.

]]>
70517
10 things you didn’t know you could do with GitHub Codespaces https://github.blog/developer-skills/github/10-things-you-didnt-know-you-could-do-with-github-codespaces/ Tue, 28 Feb 2023 18:00:50 +0000 https://github.blog/?p=70332 Unlock the full potential of GitHub Codespaces with these 10 tips and tricks! From generating AI images to running self-guided coding workshops, discover how to optimize your software development workflow with this powerful tool.

The post 10 things you didn’t know you could do with GitHub Codespaces appeared first on The GitHub Blog.

]]>
Ever feel like you’re coding on a plane mid-flight? When I first learned to code about five years ago, my laptop was painstakingly slow, but I couldn’t afford a better one. That’s why I relied on browser-based IDEs like jsbin.com to run my code.

Now fast forward to today, where GitHub Codespaces provides a fully-fledged, browser-based Integrated Development Environment (IDE) on a virtual machine. This means you can code without draining your local machine’s resources. Cloud-powered development is a game-changer for folks with less powerful machines, but that barely scratches the surface of GitHub Codespaces’ versatility.

In this blog post, we’ll discuss a few ways that you can get the most out of GitHub Codespaces!

Generate AI images 🎨

You can run Stable Diffusion with GitHub Codespaces. Like DALL-E and Midjourney, Stable Diffusion is one of many machine-learning models using deep learning to convert text into art.

Stable Diffusion takes the following steps to convert text into art:

  • AI receives an image
  • AI adds noise to the image until the image becomes completely unrecognizable. (Noise is another way of saying pixelated dots.)
  • AI removes the noise until it produces a clear, high-quality image
  • AI learns from a database called LAION-Aesthetics. The database has image-text pairs to learn to convert text into images.

This entire process is resource-intensive! Experts recommend using a computer with a powerful graphics processing unit (GPU) to run data-heavy tasks like Stable Diffusion. However, not everyone has a computer with that type of computing power (including me), so instead, I use GitHub Codespaces.

Since your codespace is hosted on a virtual machine, you can set the machine type from 2-core to 32-core. You can request access to a GPU-powered codespace if you need a more powerful machine. This means a machine learning engineer can use an iPad or Chromebook to perform data-heavy deep learning computations via GitHub Codespaces.

Check out my DEV post and repository to learn more about how I generated art inside my codespace.

Below you can see the code and AI image that GitHub Codespaces helped me produce:


from torch import autocast # Change prompt for image here! prompt = "a cartoon black girl with cotton candy hair and a pink dress standing in front of a pink sky with cotton candy clouds" with autocast(device): image = pipe(prompt, height=768, width=768).images[0] image

Computer-generated drawing-style image of a Black woman wearing a pink t-shirt, standing in front of a green field and some trees, with a pink cloud floating above her in the blue sky.

Manage GitHub Codespaces from the command line 🧑‍💻

Back in the 2000s, I would inadvertently close my documents, or my computer would suddenly shut down, and my work would be lost forever. Fortunately, it’s 2023, and many editors protect against that, including GitHub Codespaces. If you close a codespace, it will save your work even if you forget to commit your changes.

However, if you’re done with a codespace because you pushed your code to a repository, you can feel free to delete it. GitHub Codespace management is important for the following reasons:

  • You don’t want to get confused with all your GitHub Codespaces and accidentally delete the wrong one.
  • By default, inactive GitHub Codespaces automatically delete every 30 days.

You can manage your GitHub Codespaces through the GitHub UI or GitHub CLI. The GitHub CLI allows you to do things like:

Create a codespace

gh codespace create -r OWNER/REPO_NAME [-b BRANCH]

List all your codespaces

gh codespace list

Delete a codespace:

gh codespace delete -c CODESPACE-NAME

Rename a codespace

gh codespace edit -c CODESPACE-NAME -d DISPLAY-NAME

Change the machine type of a codepace

gh codespace edit -m MACHINE-TYPE-NAME

This is not an exhaustive list of all ways you can manage GitHub Codespaces via the CLI. You learn more about managing your codespaces from the command line here!

Pair program with a teammate 👥

Pair programming when you’re working remotely is challenging. It’s harder to share your screen and your code when you’re not sitting next to your teammate. However, it’s worthwhile when it works because it helps both parties improve their communication and technical skills. Installing the Live Share extension and forward ports can make remote pair programming easier with GitHub Codespaces.

Share your forwarded ports

You can share the URL of your locally hosted web app and make it available to your teammates or collaborators. If you right-click on the port you’d like to share, you’ll see the option to switch the port visibility from “Private” to “Public.” If you copy the value in the local address and share it with necessary collaborators, they can view, test, and debug your locally hosted web app even though they’re in a different room than you.

Screenshot of how to share the URL of your locally hosted web app by setting its port to public.

Live Share

The Live Share extension allows you and your teammate(s) to type in the same project simultaneously. It highlights your teammate’s cursor versus your cursor, so you can easily identify who is typing, and it’s completely secure!

Screenshot of code in an editor showing sections highlighted and labeled with the names of users currently working on those lines.

Pair program with AI 🤖

Visual Studio Code’s marketplace offers a wide variety of extensions compatible with GitHub Codespaces, including GitHub Copilot. If you need to exchange ideas while you code, but there’s no one around, try installing the GitHub Copilot extension to pair program with AI. GitHub Copilot is an AI-powered code completion tool that helps you write code faster by suggesting code snippets and completing code for you.

Beyond productivity through code completion, GitHub Copilot empowers developers of varied backgrounds. One of my favorite GitHub Copilot tools is “Hey, GitHub,” a hands-free, voice-activated AI programmer. Check out the video below to learn how “Hey, GitHub” improves the developer experience for folks with limited physical dexterity or visual impairments.



Learn about more use cases for GitHub Copilot here.

Gif demonstrating how Copilot can recommend lines of code.

Teach people to code 👩‍🏫

While educating people about coding via bootcamps, classrooms, meetups, and conferences, I’ve learned that teaching people how to code is hard. Sometimes in workshops, attendees spend most of the time trying to set up their environment so that they can follow along. However, teaching people to code or running a workshop in GitHub Codespaces creates a better experience for all participants. Instead of expecting beginner developers to understand how to clone repositories to work with a template, they can open up a codespace and work in a development environment you’ve configured. Now, you can have the peace of mind that everyone has the same environment as you and can easily follow along. This reduces tons of time, stress, and chaos.

We made GitHub Codespaces more accessible for teachers and students by offering 180 free hours of usage (equivalent to five assignments per month for a class of 50). Check out my tutorial on configuring GitHub Codespaces and leveraging extensions like CodeTour to run self-guided workshops.

Learn how CS50, Harvard’s largest class, uses GitHub Codespaces to teach students to code.

Learn a new framework 📝

When you’re learning to code, it’s easy to over-invest your time into following tutorials. Learning is often more effective when you balance tutorial consumption with building projects. GitHub Codespaces’ quickstart templates are a speedy and efficient way to learn a framework.

Quickstart templates include boilerplate code, forwarded ports, and a configured development container for some of the most common application frameworks, including Next.js, React.js, Django, Express, Ruby on Rails, Preact, Flask, and Jupyter Notebook. Templates provide developers with a sandbox to build, test, and debug applications in a codespace. It only takes one click to open a template and experiment with a new framework.

Experimenting with a framework in a codespace can help developers better understand a framework’s structure and functionalities, leading to better retention and mastery. For example, I’m not familiar with Jupyter Notebook, but I’ve used a Jupyter Notebook template in GitHub Codespaces. The boilerplate code helped me to experiment with and better understand the structure of a Jupyter Notebook. I even built a small project with it!

Check out this blog post and template, where we use GitHub Codespaces to guide developers through writing their first lines of React.

Screenshot showing a list of available codespace templates.

Store environment variables 🔐

In the past, I’ve had multiple moments where I’ve accidentally shared or mishandled my environment variables. Here are a few cringe-worthy moments where I’ve mishandled environment variables:

  • I’ve shown them to an audience during a live demo.
  • I’ve pushed them to GitHub.
  • I couldn’t figure out a great way to share the values with teammates.

To avoid these moments, I could’ve used GitHub Codespaces secrets. You can store API Keys, environment variables, and secret credentials in your GitHub Codespaces secrets for each of your GitHub Codespaces.

After you store them in your GitHub Codespaces secrets, you can refer to the environment variables in your code as: process.env.{SUPER_SECRET_API_KEY}.

Check out this tutorial for more information on securely storing your environment variables with GitHub Codespaces

Screenshot showing how to securely store your environment variables with GitHub Codespaces.

Onboard developers faster 🏃💨

Typically, software engineers are responsible for setting up their local environment when they join a team. Local environment setup can take a day or a week, depending on the quality of the documentation. Fortunately, organizations can automate the onboarding process using GitHub Codespaces to configure a custom environment. When a new engineer joins the team, they can open a codespace and skip the local environment setup because the required extensions, dependencies, and environment variables exist within the codespace.

In 2021, the GitHub Engineering Team migrated from our macOS model to GitHub Codespaces for the development of GitHub.com. After over 14 years, our repository accrued almost 13 GB on disk. It took approximately 45 minutes to clone, set up dependencies, and bootstrap our repository. After fully migrating to GitHub Codespaces, it only takes 10 seconds to launch GitHub.com in a preconfigured, reliable codespace.

However, you don’t have to take our word for it. Ketan Shah, Manager of Information Services at TELUS, a telecommunications company, attests, “GitHub shaves off entire days from the new employee onboarding process. New developers are up and running within minutes because everything is all in one place.”

Learn more about GitHub Codespaces can quickly onboard developers:

Conduct technical interviews 💼

Take-home projects, technical screens, and live coding are often painful, but necessary parts of the interview experience for software developers, but using GitHub Codespaces can help ease some of the difficulties. By providing candidates with a well-configured and reliable environment, interviewers can help reduce anxiety and improve performance. With GitHub Codespaces, candidates no longer have to worry about setting up their environment. Interviewers can use GitHub codespaces to provide real-time feedback and collaborate using built-in tools like Visual Studio Code Live Share. Furthermore, GitHub Codespaces offers a secure and isolated environment for the interview process, ensuring that sensitive information and data remain protected.

Learn how various engineering teams at GitHub use GitHub Codespaces to conduct interviews.

Code in the cloud with your preferred editor ☁

I love Visual Studio Code; it’s my primary editor. However, depending on your role and other factors, you might have a different preference. GitHub Codespaces supports the following editors, in addition to Visual Studio Code:

  • Jupyter Notebook
  • IntelliJ IDEA
  • RubyMine
  • GoLand
  • PyCharm
  • PhpStorm
  • WebStorm

But, wait, there’s more!

GitHub Codespaces’ superpower is that you can code from any device and get a standardized environment as long as you have internet. However, it also includes features that make software development workflows easier. With 60 hours of free access per month for GitHub users and 90 hours per month for GitHub Pro users, there’s no reason not to try it out and experience its benefits for yourself. So why not give it a try today?

The post 10 things you didn’t know you could do with GitHub Codespaces appeared first on The GitHub Blog.

]]>
70332
A beginner’s guide to learning to code with GitHub Codespaces https://github.blog/developer-skills/github/a-beginners-guide-to-learning-to-code-with-github-codespaces/ Wed, 22 Feb 2023 23:30:17 +0000 https://github.blog/?p=70222 When you’re new to coding, it’s easy to get stuck completing endless tutorials. You can apply what you’ve learned (and learn even more) through GitHub Codespaces. The best part is you don’t need a powerful computer to get started.

The post A beginner’s guide to learning to code with GitHub Codespaces appeared first on The GitHub Blog.

]]>
It doesn’t matter what stage you’re at in your software engineering career, there’s always something new to learn. As a beginner, it’s so easy to spend more time-consuming tutorials on how to code rather than actually putting it into practice. “See one, do one, teach one” is a learning methodology that suggests effective learning happens when you observe, apply, and then teach a new concept. When you’re new to a programming concept, the “see one, do one, and teach one” is extremely valuable in building your development skills. However, one of the reasons we got stuck in the observation phase is that we don’t know how to apply it. “What projects do I build?” is a common question that new developers ask me. And I’ll admit, I sometimes find myself asking the same question.

Fortunately, GitHub Codespaces is an effective tool that can help you apply what you’ve learned. Let’s discover how to learn new languages and frameworks with GitHub Codespaces, together.

Have a GitHub account? Login to GitHub

To get started, you will need to log in to GitHub and skip to the next step titled, “Your first Codespace.”

Screenshot of GitHub's login screen.

Are you a new GitHub user?

If you’ve never used GitHub before, welcome! GitHub is a platform that developers use to store and collaborate on code. To get started, navigate to GitHub.com, click “Sign Up”, and complete the signup workflow.

Your first Codespace

Click this link and choose “Use this template” to enter the codespace that I’ve created specially for you! Once our codespace is fully loaded, you will see a live preview of your web app on a tab titled, “Simple Browser.” (If you don’t see the “Simple Browser” tab yet, give it a few minutes to load.) It should look like the image below:

Screenshot of GitHub Codespaces.

Let’s start coding!

Change some words

Currently, the web app states that “GitHub Codespaces ♥ React.” Let’s replace the words “GitHub Codespaces” with our GitHub username by following these steps:

  1. In the Codespace, a file called App.js is already open. The App.js file is where all the content lives. (If you accidentally close the App.js file, you can find it in a folder called “src” and reopen it).
  2. On line 9 of the App.js file, you will see the words “GitHub Codespaces ♥ React” wrapped in a paragraph tag represented by these characters “.
  3. Change the words “GitHub Codespaces” on line 9 to your GitHub username.
  4. Save the changes you made in your App.js file by pressing the keys “command and s” for Mac or “control and s” for Windows.
  5. Check for the reflected changes in your Simple Browser tab. In GitHub Codespaces, we have a process that notices saved file changes, then updates and reloads your browser “automagically.” ✨

My GitHub username is blackgirlbytes, so my web app says “blackgirlbytes ♥ React.”

Screenshot of GitHub Codespaces.

Change the background color

The background color for the React app is currently gray. Gray might be someone’s favorite color, but it’s not mine. Let’s brighten it up by following the steps below:

  1. Navigate to the App.css file in the src folder. This is where the styles of the web app live.
  2. On line 11 of the App.css file, you will see the following code:
    background-color: #282c34; #282c34 is the hex code for the color gray.
  3. Try replacing the #282c34 with the word purple. (That’s my favorite color!)
  4. Save the changes you made in your App.css file by pressing the keys “command and s” for Mac or “control and s” for Windows.
  5. Check for the reflected changes in your simple browser tab.

The final version should resemble the image below:

Screenshot of GitHub Codespaces.

Need extra help?

I’ve included a guided tour in the codespace to help you make changes to the web app. To initiate the tour, take the following steps:

  1. Choose the “Explorer Icon” on the left sidebar of your editor.Screenshot of GitHub Codesapces' explorer tab.
  2. Toggle the “CodeTour” panel on the left sidebar of your editor.Screenshot of GitHub Codesapces' explorer tab.
  3. Press the “Play button” to start the tour.Screenshot of GitHub Codesapces' explorer tab.
  4. Your CodeTour will begin! Follow the CodeTour’s steps to make updates to the web app.Screenshot of GitHub Codesapces' CodeTour.

Publish the codespace

This looks amazing! (If you want it to render different words or colors, feel free to experiment, but I’m happy with our creation). Let’s publish the codespace so that we can return to it in the future, continue to enhance the web app, and share it with others!

We’re going to save our code in a project folder on GitHub called a repository. To do this, follow the instructions below:

  1. Navigate to https://github.com/codespaces. Don’t worry about leaving the tab or window because GitHub Codespaces will save your changes.
  2. Scroll down to the bottom of the page, and you will see the codespace you created. It might have a silly name. GitHub Codespace automatically generates names for each codespace as a form of identification. My codespace is named “ubiquitous acorn.”Screenshot showing Codespaces overview.
  3. Click the three dots on the right-hand side and choose the option “Publish to new repository.”
  4. Here, you can give your project a more identifiable name, make the project public, and view your repository with the button “See repository.”
  5. This will lead you to your repository on GitHub. It will show the different files within the project, too. You can share the link to your repository for other developers to collaborate with you or explore your codebase!

Bonus tip

Now that your code is in a repository, you can delete your codespace. Don’t worry; if you delete your codespace, you’re not going to lose your code! Your code will always live in the repository, and you can share this with folks who want to collaborate with you or learn from you.

If you want to reopen your code in a codespace, choose the “Code” button in your repository and click the “+” in the codespaces tab.

Screenshot showing how to open a GitHub Codespace.

Check out the quickstart templates

Quickstart templates include boilerplate code for some of the most common application frameworks, including Next.js, React.js, Django, Express, Ruby on Rails, Preact, Flask, and Jupyter Notebook. These templates provide developers with a sandbox to build, test, and debug applications in a codespace. This means you don’t have to start from scratch with coding because we already have a working project that you can enhance into the project you’re envisioning. You can use templates to understand how developers structure their projects written in various programming languages. And you can use it to understand how different files communicate with each other.

For example, I’ve always wanted to learn more about artificial intelligence (AI) and machine learning, but I had no clue where to start. I used a Jupyter Notebooks template to generate AI images. The template already had all the tools I needed. I just had to change a few lines of code.

Screenshot showing Codespaces templates.

What’s next?

Congratulations, you just leveled up your programming knowledge. Now, you can continue experimenting with different frameworks and learning new languages in GitHub Codespaces. Check out the other templates if you’re interested in starting a project or learning a new framework language with Preact, Jupyter Notebook, Flask, Django, Express, Ruby on Rails, or Node.

If you are interested in diving into more advanced concepts around GitHub Codespaces, check out our documentation.

Share your creation

If you set up a project and GitHub Codespaces that you’re excited about, share it with us on social media with the hashtag #ShareYourCodespace! ❤

The post A beginner’s guide to learning to code with GitHub Codespaces appeared first on The GitHub Blog.

]]>
70222
Increase developer productivity, save time on developer onboarding, and drive ROI in 2023 https://github.blog/enterprise-software/collaboration/increase-developer-productivity-save-time-on-developer-onboarding-and-drive-roi-in-2023/ Tue, 20 Dec 2022 18:00:26 +0000 https://github.blog/?p=69237 Forrester's Total Economic Impact™ study dives into how GitHub Enterprise Cloud and GitHub Advanced Security help businesses drive ROI, increase developer productivity, and save time on developer onboarding.

The post Increase developer productivity, save time on developer onboarding, and drive ROI in 2023 appeared first on The GitHub Blog.

]]>
What if you could remove days from your onboarding process and have developers up and running in minutes? Or save developers hours per week with more automation? How much work could your developers get done if they spent less time switching between different tools and tasks? And what if reducing the amount of tools also reduced your operational costs?

These are common struggles developer teams face and were some of the challenges Canadian communications and IT provider TELUS experienced with their fragmented tech stack and engineering teams. They constantly had to define, maintain, and provision development environments, making it so that developers spent too much time context switching between different tools and not enough time writing code. But when they decided to use GitHub Enterprise as their one, centralized and integrated platform for end to end software development, magic happened:

  • Onboarding happens in minutes now for new developers
  • Two hours of time saved per developer each week
  • One minute of time saved per GitHub Actions executed

We hear these stories from GitHub customers all the time. And to dig further into just how much GitHub impacts developers and businesses, we commissioned a Total Economic Impact™ (TEI) study from Forrester Consulting to examine the potential return on investment (ROI) businesses can gain by using GitHub Enterprise Cloud (GHEC) and GitHub Advanced Security (GHAS).

To understand the benefits, costs, and risks associated with investing in GitHub’s platform, they interviewed and surveyed individuals with experience using GHEC and GHAS, and aggregated these experiences into a composite organization1.

So, what did Forrester find? Over three years, using GitHub drove 433% ROI for the organization simply with the combined power of all GitHub’s enterprise products.

Let’s take a look at other ways GitHub helps developers be more productive, onboard faster, and remediate security vulnerabilities all while increasing efficiency.

Better code, faster ⚡

Developer productivity is an important metric that’s incredibly difficult to quantify and define. Is it influenced by developer happiness? Is it defined by how much time a developer spends writing code? Or, is it the speed at which developers complete tasks?

With more and more businesses grappling with increasingly complicated tech stacks, we know that simplifying the tools developers use on a daily basis positively impacts developer productivity.

Key challenges

Before using GitHub, interviewees’ organizations faced many tech stack challenges, including having to “write homegrown solutions to address the context switching between one open source tool to another,” and “discovering security flaws late in the SDLC or after the code was deployed into production.” In addition, team productivity was impacted by the decentralized management of maintaining legacy open source tools and infrastructure.

But after using GHEC and GHAS for three years, the composite organization saw:

  • Developer productivity gains of 22%
  • Tool maintenance productivity gains of 75% by phasing out legacy tools

Ultimately, GitHub helps enterprises produce better and more secure code—and more quickly—with faster code drops into production.

Improved security 🔐

Adopting the right approach to DevSecOps reduces risk and allows teams to deploy quickly and securely. But many businesses find this easier said than done when using legacy tools that aren’t optimized for modern development practices.

Key challenges

The organization faced numerous security challenges before moving to GitHub. For one, “interviewees reported that without automation in their organization’s CI/CD environment, software defects and security vulnerabilities made it far into the SDLC before being detected.” DevOps and DevSecOps teams spent large amounts of time writing custom code to detect code defects and security vulnerabilities across all platforms. And in order to comply with IT audit requirements, respondents said that they had teams of auditors—many who worked full time—gathering documentation and performing internal and external audits from decentralized environments.

When they implemented GHEC, GHAS, GitHub Pages, GitHub Actions, and Codespaces, the organization saw the following benefits over three years:

  • Time savings of $2.7 million USD in IT auditors preparing for audits
  • Improved DevOps, DevSecOps, and site reliability engineer efficiency by 15%
  • Reduction in time spent on code remediation, resulting in savings of $5.2 million USD

With fewer vulnerabilities in code production and more granular controls, GitHub is a secure solution for enterprises combating both internal and external threats.

Recruit and retain talent 🧑‍💻

The world of work looks vastly different than it did a couple of years ago. With that, businesses have to think about what it takes to recruit and retain employees for the long term. And when it comes to software development specifically, intentionally placing the developer experience at the core of your efforts can attract new employees, improve retention, and increase productivity.

Key challenges

The onboarding process for a new developer is crucial to ensuring their short-term success and ability to make an immediate impact on the business. Before switching to GitHub, onboarding new developers took 10 days according to interviewees, forcing the organization to pay for unproductive work since “…new developers need to be trained on the organization’s methods of coding, but developers also had to learn how to use the various tools that they would need during the SDLC.”

After implementing GitHub, organizations drastically reduced the time spent training new developers by 80%.

Ultimately, developers want to use the tools they know and love at work. When businesses use GitHub’s entire platform, tenured developers are happier and new developers can make an impact from day one.

Reduced costs 💸

In an increasingly unpredictable macroeconomic environment, business leaders have to be even more strategic when it comes to reducing operational costs and driving efficiency in their organizations.

Key challenges

When Forrester interviewed the DevOps and DevSecOps teams in their research, they found that using and maintaining infrastructure for legacy tools incurred annual infrastructure, software, and labor costs to maintain. But by standardizing their development on GHEC and using the power of GHAS and GitHub Actions to perform centralized tasks, many of the legacy servers could be deprecated over time.

After deploying GHEC, the organization retired its use of legacy tools and realized a total cost of ownership savings of $811,900 USD over three years.

In short, moving to GitHub eliminates redundant costs and improves site reliability.

Experience the power of GitHub yourself 🪄

As the home for all developers, we build tools that help developers do the best work of their lives. How to make developers more productive, collaborative, happy, and innovative are our bread and butter. And by dedicating ourselves to these goals, we help the companies that hire them meet their goals, too.

After all, GitHub is the #1 ranked DevOps platform on G2 for a reason! With automated workflows via GitHub Actions, supercharged collaboration tools in the cloud with Codespaces, and native security throughout the developer workflow with GHAS, GitHub improves your time-to-market, increases your revenue growth, and reduces your hardware costs and time spent managing platforms.

Interested in reading the study and driving ROI for your enterprise? Download it today.

Notes


  1. The composite organization is an enterprise with 120,000 employees and 7,000 developers, growing at 500 per year. In addition to using GHEC and GHAS, they also deploy GitHub Actions, Codespaces, GitHub Discussions, and GitHub Pages, and are testing GitHub Copilot. The development team manages 20,000 code repositories and $100,000 in legacy hardware. It used GitHub for five years. 

The post Increase developer productivity, save time on developer onboarding, and drive ROI in 2023 appeared first on The GitHub Blog.

]]>
69237
Exciting new GitHub features powering machine learning https://github.blog/developer-skills/github/exciting-new-github-features-powering-machine-learning/ Tue, 22 Nov 2022 19:00:35 +0000 https://github.blog/?p=68806 Discover the exciting enhancements in GitHub that empower Machine Learning practitioners to do more.

The post Exciting new GitHub features powering machine learning appeared first on The GitHub Blog.

]]>
I’m a huge fan of machine learning: as far as I’m concerned, it’s an exciting way of creating software that combines the ingenuity of developers with the intelligence (sometimes hidden) in our data. Naturally, I store all my code in GitHub – but most of my work primarily happens on either my beefy desktop or some large VM in the cloud.

So I think it goes without saying, the GitHub Universe announcements made me super excited about building machine learning projects directly on GitHub. With that in mind, I thought I would try it out using one of my existing machine learning repositories. Here’s what I found.

Jupyter Notebooks

Machine learning can be quite messy when it comes to the exploration phase. This process is made much easier by using Jupyter notebooks. With notebooks you can try several ideas with different data and model shapes quite easily. The challenge for me, however, has been twofold: it’s hard to have ideas away from my desk, and notebooks are notoriously difficult to manage when working with others (WHAT DID YOU DO TO MY NOTEBOOK?!?!?).

Screenshot of github.com tlaloc/notebooks/generate.ipynb

This improved rendering experience is amazing (and there’s a lovely dark mode too). In a recent pull-request I also noticed the following:

Pull request with side by side differences within cells

Not only can I see the cells that have been added, but I can also see side-by-side the code differences within the cells, as well as the literal outputs. I can see at a glance the code that has changed and the effect it produces thanks to NbDime running under the hood (shout out to the community for this awesome package).

Notebook Execution (and more)

While the rendering additions to GitHub are fantastic, there’s still the issue of executing the things in a reliable way when I’m away from my desk. Here’s a couple of gems we introduced at GitHub Universe to make these issues go away:

  1. GPUs for Codespaces
  2. Zero-config notebooks in Codespaces
  3. Edit your notebooks from VS Code, PyCharm, JupyterLab, on the web, or even using the CLI (powered by Codespaces)

I decided to try these things out for myself by opening an existing forecasting project that uses PyTorch to do time-series analysis. I dutifully created a new Codespace (but with options since I figured I would need to tell it to use a GPU).

Screenshot of Codespaces with options menu showing

Sure enough, there was a nice GPU option:

Screenshot - Create codespace for sethjuarez/tlaloc with GPU options showing

That was it! Codespaces found my requirements.txt file and went to work pip installing everything I needed.

Screenshot of terminal running pip install.

After a few minutes (PyTorch is big) I wanted to check if the GPU worked (spoiler alert below):

Screenshot of terminal

This is incredible! And, the notebook also worked exactly as it does when working locally:

Screenshot of notebook working locally

Again, this is in a browser! For kicks and giggles, I wanted to see if I could run the full blown model building process. For context, I believe notebooks are great for exploration but can become brittle when moving to repeatable processes. Eventually MLOps requires the movement of the salient code to their own scripts modules/scripts. In fact, it’s how I structure all my ML projects. If you sneak a peek above, you will see a notebooks folder and then a folder that contains the model training Python files. As an avid VSCode user I also set up a way to debug the model building process. So I crossed my fingers and started the debugging process:

screenshot of debugging process

I know this is a giant screenshot, but I wanted to show the full gravity of what is happening in the browser: I am debugging the build of a deep learning PyTorch model – with breakpoints and everything – on a GPU.

The last thing I wanted to show is the new JupyterLab feature enabled via the CLI or directly from the Codespaces page:

Screenshot of Codespaces with options open. Option to open in JupyterLab chosen

For some, JupyterLab is an indispensable part of their ML process – which is why it’s something we now support in its full glory:

Screenshot with code

What if you’re a JupyterLab user only and don’t want to use the “Open In…” menu every time? There’s a setting for that here:

Screenshot showing Editor preference options

And because there’s always that one person who likes to do machine learning only from the command line (you know who I’m talking about):

Machine learning from the command line

For good measure I wanted to show you that given it’s the same container, the GPU is still available.

Now, what if you want to just start up a notebook and try something? A File -> New Notebook experience is also available simply using this link: https://codespace.new/jupyter.

Summary

Like I said earlier, I’m a huge fan of machine learning and GitHub. The fact that we’re adding features to make the two better together is awesome. Now this might be a coincidence (I personally don’t think so), but the container name selected by Codespaces for this little exercise sums up how this all makes me feel: sethjuarez-glorious-winner (seriously, look at container url).

Would love to hear your thoughts on these and any other features you think would make machine learning and GitHub better together. In the meantime, get ready for the upcoming GPU SKU launch by signing up to be on waitlist. Until next time!

The post Exciting new GitHub features powering machine learning appeared first on The GitHub Blog.

]]>
68806