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

Feat: How to contribute devcontainer.json to repo #42

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
127 changes: 127 additions & 0 deletions articles/20240821_How_to_contribute_devcontainer.json_to_the_repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
title: "How to Contribute devcontainer.json to the repo"
description: "Learn how to create a devcontainer.json file for the groq-api-cookbook repository, set up a consistent development environment, and contribute your work back to the community. This step-by-step guide covers everything from forking the repository to submitting a pull request, ensuring a smooth experience for open-source contributors."
date: 2024-08-21
author: "Dheeraj Singh"
tags: ["Dev Container", "Groq API Cookbook", "Daytona Workspace", "Software Development","Open Source Contribution"]
---


# How to Set Up and Contribute a `devcontainer.json` to the `groq-api-cookbook` Repository

## Introduction

If you've ever contributed to an open-source project, you know how tricky it can be to ensure that everyone is working with the same environment. This guide will show you how to create a development container using `devcontainer.json` and contribute it to the `groq-api-cookbook` repository. The process is straightforward, and by the end of this tutorial, you'll have set up a fully functional development environment and learned how to contribute it back to the community.

## Why Use a Dev Container?

A development container ensures that your project runs the same way, regardless of where it's being developed. Whether you're on Windows, macOS, or Linux, a `devcontainer.json` file helps maintain consistency by specifying the tools, dependencies, and settings required for the project.

## Prerequisites

Before diving in, make sure you have the following tools installed:

- [Docker](https://www.docker.com/get-started)
- [Visual Studio Code](https://code.visualstudio.com/)
- [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
- A GitHub account

If you're new to any of these tools, don't worry—there are plenty of resources online to get you started.

## Step 1: Fork and Clone the Repository

First things first, you'll need to fork the `groq-api-cookbook` repository. This gives you your own copy of the project where you can make changes without affecting the original codebase.

1. Head over to the [groq-api-cookbook repository](https://github.com/groq/groq-api-cookbook) and click the **Fork** button in the top right corner.
2. Once forked, clone the repository to your local machine:

```bash
git clone https://github.com/<your-username>/groq-api-cookbook.git
cd groq-api-cookbook
```

## Step 2: Set Up Your Dev Container

Now that you have the repository on your local machine, it's time to set up the dev container.

### 2.1 Create a `.devcontainer` Directory

Inside the cloned repository, create a new directory named `.devcontainer`:

```bash
mkdir .devcontainer
cd .devcontainer
```
### 2.2 Create the devcontainer.json File
In the .devcontainer directory, create a file named devcontainer.json and add the following configuration:

```json
{
"name": "Groq API Cookbook Development Container",
"image": "mcr.microsoft.com/vscode/devcontainers/python:3.9",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
"postCreateCommand": "pip install -r requirements.txt",
"customizations": {
"vscode": {
"settings": {
"python.pythonPath": "/usr/local/bin/python3"
},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
}
}
```

### Explanation
- **name**: This is just a label for your container.
- **image**: Specifies the Docker image to use. In this case, we're using Python 3.9.
- **features**: Here, we're adding Docker support inside the container, which might come in handy.
- **postCreateCommand**: This command runs after the container is created. We're using it to install the necessary Python packages.
- **customizations**: These are specific to VS Code, like Python path settings and useful extensions.

## Step 3: Test the Dev Container
1. It's time to see if everything works as expected.

2. Open the repository in Visual Studio Code.

3. When prompted, select Reopen in Container. This will start your development environment inside the container you just set up.

4. To verify that everything is running smoothly, try running one of the cookbook examples:
```bash
python examples/your_example.py
```

If the example runs without issues, congratulations! Your dev container is set up correctly.

## Step 4: Commit Your Changes
After testing and confirming that your devcontainer.json works, it’s time to commit your changes.

```bash
git add .devcontainer/devcontainer.json
git commit -m "Add devcontainer configuration for Groq API Cookbook"
git push origin main
```
## Step 5: Submit a Pull Request
Now that your changes are committed, you can contribute them back to the original project.

1. Go back to the groq-api-cookbook repository on GitHub.
2. Click on the Compare & pull request button that appears after you push your changes.
3. Fill out the pull request form, making sure to follow the [contribution guidelines](https://github.com/groq/groq-api-cookbook/blob/main/CONTRIBUTING.md).

Be sure to explain what your dev container does and why it’s useful for the project.

## Step 6: Using Daytona Workspace
Daytona is a cloud-based environment that can integrate with your devcontainer.json setup. Here's how you can get started:

1. Open Daytona and connect it to your GitHub account.
2. Import your forked `groq-api-cookbook` repository.
3. Start a development session in Daytona, and it will automatically detect and use the `devcontainer.json` configuration.
4. Just like before, run one of the cookbook examples to make sure everything is working smoothly.

## Conclusion
By following this guide, you've not only set up a consistent development environment but also contributed to an open-source project. This is a great way to help others in the community and ensure that future contributors have an easier time getting started. Remember, contributions like these are what make open-source projects thrive.
155 changes: 155 additions & 0 deletions articles/20240821_Omni_and_Claude_Engineers_inside_Dayton.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Running Omni Engineer in Daytona: A Step-by-Step Guide for AI Engineers

In this guide, we'll demonstrate how to run Omni Engineer inside Daytona and effectively use it. We'll also walk through creating a `devcontainer.json` file, contributing it to existing repositories, and making a pull request to the Groq repository. By the end, you'll know how to set up a development environment that streamlines your AI engineering workflows.

## Prerequisites

- Basic understanding of Docker and VS Code.
- Familiarity with Git and GitHub.
- Access to the Omni Engineer and Claude Engineer repositories.

## Step 1: Setting Up Your Development Environment

### 1.1. Install VS Code and Docker

Ensure you have [Visual Studio Code (VS Code)](https://code.visualstudio.com/) and [Docker](https://www.docker.com/products/docker-desktop) installed on your machine. These tools are essential for creating and managing development containers.

### 1.2. Install the Remote - Containers Extension

Install the "Remote - Containers" extension for VS Code from the Extensions Marketplace. This will allow you to open and work inside Docker containers.

## Step 2: Creating the `devcontainer.json` File

### 2.1. Create a New Directory for Your Dev Container Configuration

Open a terminal and navigate to the root directory of your local clone of the Omni Engineer repository:

```bash
git clone https://github.com/Doriandarko/omni-engineer.git
cd omni-engineer
```

Create a .devcontainer directory and navigate into it:

```bash
mkdir .devcontainer
cd .devcontainer
```
### 2.2. Create the devcontainer.json File
Inside the .devcontainer directory, create a file named devcontainer.json with the following content:

```json
{
"name": "Omni Engineer Dev Container",
"dockerFile": "Dockerfile",
"extensions": [
"ms-python.python",
"ms-vscode.cpptools",
"esbenp.prettier-vscode",
"github.copilot"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python"
},
"runArgs": [
"--gpus",
"all"
],
"postCreateCommand": "pip install -r requirements.txt",
"remoteUser": "vscode"
}
```
### 2.3. Create a Dockerfile
In the same .devcontainer directory, create a file named Dockerfile with the following content:

```bash
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set the working directory
WORKDIR /workspace

# Install dependencies
COPY requirements.txt /workspace/
RUN pip install --no-cache-dir -r requirements.txt

# Install additional system packages
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*

# Copy the rest of the application code
COPY . /workspace/
```

## Step 3: Contributing devcontainer.json to the Repositories

### 3.1. Fork and Clone the Repositories
If you haven't already, fork the [Omni Engineer repository](https://github.com/Doriandarko/omni-engineer) and [Claude Engineer repository](https://github.com/Doriandarko/claude-engineer) to your GitHub account. Clone the repositories to your local machine:

```bash
git clone https://github.com/YOUR_USERNAME/omni-engineer.git
cd omni-engineer
```

### 3.2. Add the .devcontainer Directory
Copy the .devcontainer directory created earlier into the root of both repositories.

### 3.3. Commit and Push Changes
Add the changes to the staging area, commit them, and push them to your forked repository:

```bash
git add .devcontainer
git commit -m "Add devcontainer configuration"
git push origin main
```

### 3.4. Create a Pull Request
Go to your forked repository on GitHub and create a pull request (PR) from your fork's main branch to the original repository's main branch. Describe the changes and submit the PR.

## Step 4: Creating a Pull Request for the Groq Repository


### 4.1. Fork and Clone the Groq Repository
Fork the Groq repository and clone it to your local machine:
```bash
git clone https://github.com/YOUR_USERNAME/groq.git
cd groq
```

### 4.2. Add the .devcontainer Directory
Copy the .devcontainer directory from your Omni Engineer setup into this repository.

### 4.3. Commit and Push Changes

Add, commit, and push the changes:
```bash
git add .devcontainer
git commit -m "Add devcontainer configuration"
git push origin main

```
### 4.4. Create a Pull Request
Go to your forked Groq repository on GitHub and create a PR to merge the changes into the original repository.

## Step 5: Using Omni Engineer Inside Daytona
### 5.1. Open the Dev Container
In VS Code, open the Omni Engineer repository. Click on the green "><" icon in the bottom-left corner of the window and select "Reopen in Container."

### 5.2. Access and Use Omni Engineer
Once inside the dev container, you can access and use Omni Engineer. For example, if you're working on an AI model, you might want to run the following command to start the Omni Engineer service:

```bash
omni-engineer --start
```

You can now develop and test your AI models within this environment.

## Conclusion
You've successfully set up a development container for Omni Engineer, contributed it to the repositories, and created a pull request for the Groq repository. With these steps, you can streamline your AI engineering workflows and ensure a consistent development environment.