smol-ai / developer

the first library to let you embed a developer agent in your own app!
https://twitter.com/SmolModels
MIT License
11.81k stars 1.03k forks source link

Added .devcontainer for simplified development setup #30

Closed cuio closed 1 year ago

cuio commented 1 year ago

In this merge request, I have added a .devcontainer directory with a devcontainer.json file and a Dockerfile. These files together allow for easier setup of the development environment, especially for developers using Visual Studio Code's Dev Container feature or GitHub's Codespaces.

The devcontainer.json file configures the dev container specifically for Python development in alignment with our project's needs. It sets the terminal shell, Python interpreter path, enables Python linting, specifies the required VS Code extensions, sets up port forwarding, and also defines the post creation command to install our project's Python dependencies. When a developer opens the project in a Dev Container, these settings are automatically applied.

The Dockerfile contains instructions to create a Docker image suitable for our project. It uses the Python 3.9 slim-buster image as its base, sets the working directory to /app, and copies over the project files.

swyxio commented 1 year ago

thanks for your PR! what is the benefit of running it in a devcontainer? what tooling are you optimizing for? codespaces?

cuio commented 1 year ago

thanks for your PR! what is the benefit of running it in a devcontainer? what tooling are you optimizing for? codespaces? Here's a version of your text formatted as a GitHub comment:


Thank you for reviewing the Pull Request!

The addition of the devcontainer.json and Dockerfile is indeed intended to optimize the development environment for use with Codespaces, but it's equally beneficial for those using Visual Studio Code's Remote - Containers extension.

Here's why running the project in a devcontainer provides several benefits:

Consistent Environment: Each person working on the project uses the exact same development environment. This uniformity eliminates the infamous "it works on my machine" problems and streamlines the process for new contributors to get started.

Sandboxing: The development environment is isolated from the local machine, which can be particularly advantageous when working on multiple projects with different dependencies.

Version Control for Environments: Much like version-controlling source code, the development environment can also be version-controlled. In case a dependency upgrade leads to any issues, it's easy to revert to a previous state.

Easier CI/CD Integration: If the CI/CD pipeline uses Docker, the test environment will match the local development environment, ensuring consistency across development and production setups.

Portability: The setup is extremely portable. Any computer with Docker and the appropriate IDE installed can be used for development. All one needs to do is clone the repository and start the container.


swyxio commented 1 year ago

this shows my ignorance... i actually have never really run a devcontainer before.

do you mind adding a nice ### subsection in the usage section in the readme to tell people what you told me here? and then will merge

cuio commented 1 year ago

Hi @swyxio,

Absolutely, have updated the readme.md file.

Migacz85 commented 1 year ago

If you want to use docker. I would only use it as an option no default route to install it. I personally prefer to interact with simple project like that in virtual env rather than docker. For me this I unneeded complexity. However as an option it's ok.

swyxio commented 1 year ago

lol @cuio pretty sure that benefits section was ai written so i hid it in a details/summary tab haha