Code Ocean User Guide
v2.15.0
Search
K

How to create a capsule in 5 minutes

Creating a new capsule

To create a new capsule:
  1. 1.
    Click Add capsule
  2. 2.
    Click Create New Instructions to Copy from public git and Clone from git are provided here.
  3. 3.
    A user without access to any Capsules can click Duplicate from Code Ocean Apps to get started by browsing pre-made Capsules which can be duplicated.

Building a compute capsule

There are three main components of a Code Ocean capsule:
  • File tree
    • Code, Data, Results, etc..
  • Environment
    • setting starter environment
    • adding packages
  • Timeline
    • manage changes via Git
    • the activity of the capsule

Configuring the environment

Select your preferred environment from the list of options, in this example, Python is chosen.
To customize the environment, install packages using the appropriate package manager. In this example pip is used to install matplotlib. A version number can be specified. by default the latest version is used.

Adding code and data to complete a first run

To add sample code using the existing template, go to the left panel below results.
Click Start with Sample Files. Files will appear in the folders above.
Click Reproducible Run, to see the results generated from sample files. A Reproducible Run executes the preconfigured run bash script. A more detailed description of the Reproducible Run is provided here.
After a successful Reproducible Run, it is good practice to commit changes to ensure a fully functional version of the capsule is documented in the Timeline.

Viewing Results

The results from each Reproducible Run can be accessed from the capsule timeline. The results directory contains the output from the most recent Reproducible Run.

Launching a Cloud Workstation

The Cloud Workstation is integrated into the right panel to easily launch a development session that enables you to interactively run a compute capsule. It works best for exploring data of testing ideas. Code Ocean offers seven built-in development environment tool options for use with the Cloud Workstation.

Conclusion

From the capsule dashboard you can navigate to the gallery page which contains a subset of publicly available capsules. These capsules are a good starting point to explore what’s possible in Code Ocean. They can be duplicated if you’d like to use them in your own project.