This repository serves as a starting point for creating Code Ocean capsules via GitHub import. The capsule defined here uses a Python environment by default, but can easily be switched to R, C++, or any of the other supported starter environments after importing to Code Ocean.
Note: do not import this repository directly. Instead, use this repository as a template to create a new capsule.
-
Create a new repository from this template:
In the following screen, you can choose a name for your repository and optionally enter a description. You can add the
-capsulesuffix to your repository name to make it easier to identify. -
In your newly created repository, update the
metadata/metadata.ymlfile with the name and description of your capsule. You can also update theauthorsfield with your name. -
Ensure that your GitHub credentials have been added to your Code Ocean account:
See the Git provider integration guide for instructions.
-
In Code Ocean, click the + symbol in the left sidebar to create a new capsule, then click "Clone from Git":
-
In the pop-up dialog, enter the URL of the GitHub repository you created in step 1. Click "Clone". Once the clone is complete, you will be taken to the capsule IDE where you can view the code, add data, and perform reproducible runs.
-
Update the code to perform analysis and test it by running it on data! All analysis code should go in the
code/directory, and results should always be written to/results. (Note the leading slash! Code Ocean expects results files to be placed in aresultsdirectory at the root of the file system.) You can also update the entry point of your capsule by updating thecode/runexecutable file.
If your capsule requires a runtime different than the default Python one, you can change the environment in Code Ocean after completing the steps above.
-
Open your capsule in the Code Ocean IDE.
-
In the Files pane on the left side of the IDE, select "environment" (located under "Core Files").
-
In the main editor, under the "Environment" section, click the "Change" button:
-
Select your desired runtime environment. Note that this will update
environment/Dockerfile, which you should commit and push back to the GitHub repository.



