Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Codespaces Documentation #1144

Merged
merged 19 commits into from
Aug 2, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions getting-started/setup-building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,52 @@ every rule.


.. _issue tracker: https://github.com/python/cpython/issues


.. _using-codespaces:

Contribute Using Github Codespaces
===================================
marlenezw marked this conversation as resolved.
Show resolved Hide resolved

.. _codespaces-whats-codespaces:

What is Github Codespaces
-------------------------
marlenezw marked this conversation as resolved.
Show resolved Hide resolved

If you'd like to start contributing to CPython without needing to set up a local developer environment, you can use `Github Codespaces <https://github.com/features/codespaces>`_.
marlenezw marked this conversation as resolved.
Show resolved Hide resolved
Codespaces is a cloud-based development environment offered by GitHub that allows developers to write, build, test, and debug code directly within their web browser or in Visual Studio Code (VS Code).

To help you get started CPython contains a `devcontainer folder <https://github.com/python/cpython/tree/main/.devcontainer>`_ with a json file that provides consistent and versioned codespace configurations for all users of the project.
marlenezw marked this conversation as resolved.
Show resolved Hide resolved
It also contains a docker file that allows you to set up the same environment but locally in a docker container if you'd prefer to do that.
marlenezw marked this conversation as resolved.
Show resolved Hide resolved

.. _codespaces-create-a-codespace:

Create A CPython Codespace
marlenezw marked this conversation as resolved.
Show resolved Hide resolved
--------------------------

Here are the basic steps needed to contribute a patch using Codespaces.
You first need to navigate to the `CPython repo <https://github.com/python/cpython>`_ hosted on GitHub.

Then you will need to:

1. Click the green :guilabel:`Code` button and choose the ``codespaces`` tab.
2. Press the green :guilabel:`create a new codespace on main` button.
marlenezw marked this conversation as resolved.
Show resolved Hide resolved
3. A screen should appear that lets you know your codespace is being set up. (Note: Since the CPython devcontainer is provided codespaces will use the configurations it specifies.)
4. VS Code will open inside of your web browser, already linked up with your code and a terminal to the remote codespace.
5. Use the terminal with the usual git commands to create a new branch, commit and push your changes once you're ready!
marlenezw marked this conversation as resolved.
Show resolved Hide resolved

If you close your repository and come back later you can always resume your codespace by navigating to the CPython repo, selecting the codespaces tab and selecting your most recent codespaces session.
You should then be able to pick up from where you left off!

.. _codespaces-use-locally:

Use Codespaces Locally
-----------------------
marlenezw marked this conversation as resolved.
Show resolved Hide resolved

On the bottom left side of the codespace screen you will see a green or grey square that says :guilabel:`Codespaces`.
You can click on this for additional options. If you prefer working on a locally installed copy of VS Code you can select the option ``Open in VS Code``.
marlenezw marked this conversation as resolved.
Show resolved Hide resolved
You will still be working on the remote codespace instance, thus utilising the remote instance compute power.
The compute power may be a much higher spec than your local machine which can be helpful.
marlenezw marked this conversation as resolved.
Show resolved Hide resolved


.. TODO: add docker instructions
Loading