Skip to content

Commit dc0be4d

Browse files
marlenezwhugovkpradyunsgbrettcannon
authored
Adding Codespaces Documentation (#1144)
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Pradyun Gedam <[email protected]> Co-authored-by: Brett Cannon <[email protected]>
1 parent d61215d commit dc0be4d

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

getting-started/setup-building.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,3 +655,72 @@ every rule.
655655

656656

657657
.. _issue tracker: https://github.com/python/cpython/issues
658+
659+
660+
.. _using-codespaces:
661+
662+
Contribute using GitHub Codespaces
663+
==================================
664+
665+
.. _codespaces-whats-codespaces:
666+
667+
What is GitHub Codespaces?
668+
--------------------------
669+
670+
If you'd like to start contributing to CPython without needing to set up a local
671+
developer environment, you can use
672+
`GitHub Codespaces <https://github.com/features/codespaces>`_.
673+
Codespaces is a cloud-based development environment offered by GitHub that
674+
allows developers to write, build, test, and debug code directly within their
675+
web browser or in Visual Studio Code (VS Code).
676+
677+
To help you get started, CPython contains a
678+
`devcontainer folder <https://github.com/python/cpython/tree/main/.devcontainer>`_
679+
with a JSON configuration file that provides consistent and versioned codespace
680+
configurations for all users of the project. It also contains a Dockerfile that
681+
allows you to set up the same environment but locally in a Docker container if
682+
you'd prefer to use that directly.
683+
684+
.. _codespaces-create-a-codespace:
685+
686+
Create a CPython codespace
687+
--------------------------
688+
689+
Here are the basic steps needed to contribute a patch using Codespaces.
690+
You first need to navigate to the
691+
`CPython repo <https://github.com/python/cpython>`_ hosted on GitHub.
692+
693+
Then you will need to:
694+
695+
1. Press the ``,`` key to launch the codespace setup screen for the current
696+
branch (alternatively, click the green :guilabel:`Code` button and choose
697+
the ``codespaces`` tab and then press the
698+
green :guilabel:`Create codespace on main` button).
699+
2. A screen should appear that lets you know your codespace is being set up.
700+
(Note: Since the CPython devcontainer is provided, codespaces will use the
701+
configuration it specifies.)
702+
3. A `web version of VS Code <https://vscode.dev/>`_ will open inside your web
703+
browser, already linked up with your code and a terminal to the remote
704+
codespace where CPython and its documentation have already been built.
705+
4. Use the terminal with the usual Git commands to create a new branch, commit
706+
and push your changes once you're ready!
707+
708+
If you close your repository and come back later you can always resume your
709+
codespace by navigating to the CPython repo, selecting the codespaces tab and
710+
selecting your most recent codespaces session. You should then be able to pick
711+
up from where you left off!
712+
713+
.. _codespaces-use-locally:
714+
715+
Use Codespaces Locally
716+
----------------------
717+
718+
On the bottom left side of the codespace screen you will see a green or grey
719+
square that says :guilabel:`Codespaces`. You can click this for additional
720+
options. If you prefer working in a locally installed copy of VS Code you can
721+
select the option ``Open in VS Code``. You will still be working on the remote
722+
codespace instance, thus using the remote instance's compute power. The compute
723+
power may be a much higher spec than your local machine which can be helpful.
724+
725+
726+
.. TODO: add docker instructions

0 commit comments

Comments
 (0)