Skip to content

feat: add devcontainer #19

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

feat: add devcontainer #19

wants to merge 11 commits into from

Conversation

johanneskoester
Copy link
Contributor

@johanneskoester johanneskoester commented Jul 8, 2025

Summary by CodeRabbit

  • Chores
    • Added a development container configuration to provide a ready-to-use workspace for the Snakemake tutorial, including environment setup and helpful documentation.

Copy link

coderabbitai bot commented Jul 8, 2025

📝 Walkthrough

Walkthrough

A new .devcontainer/devcontainer.json file has been added to set up a development container environment for a Snakemake tutorial. The configuration specifies the container build context, Dockerfile location, and a post-creation command that runs a setup script. The setup script removes specific files, creates a README and .gitignore, initializes Conda, and configures automatic environment activation.

Changes

File(s) Change Summary
.devcontainer/devcontainer.json Added configuration for a development container, including container name, build context, Dockerfile, and post-creation command
.devcontainer/setup.bash Added setup script to clean workspace, create README and .gitignore, initialize Conda, and configure environment activation

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant DevContainer
    participant Docker
    participant Shell

    Developer->>DevContainer: Open in container
    DevContainer->>Docker: Build container (using Dockerfile)
    Docker-->>DevContainer: Container created
    DevContainer->>Shell: Run postCreateCommand (setup.bash)
    Shell->>Shell: Remove Dockerfile, .gitpod.yml, .github
    Shell->>Shell: Create README.md and .gitignore
    Shell->>Shell: Initialize Conda and source .bashrc
    Shell->>Shell: Append conda environment activation to .bashrc
    Developer-->>DevContainer: Ready-to-use Snakemake tutorial environment
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b21b024 and dd3d919.

📒 Files selected for processing (1)
  • .devcontainer/devcontainer.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.devcontainer/setup.bash (1)

4-5: conda init may prompt and duplicate work; pin the shell and silence output

conda init without arguments selects the current shell heuristically and may prompt or inject duplicate blocks on successive runs. Pin it and make the script idempotent:

-conda init
+conda init bash >/dev/null
+
+# Apply changes only if they are new to avoid sourcing redundantly
+source ~/.bashrc
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb7fde9 and 3049d69.

📒 Files selected for processing (2)
  • .devcontainer/devcontainer.json (1 hunks)
  • .devcontainer/setup.bash (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .devcontainer/devcontainer.json
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash

[error] 6-6: Couldn't parse this double quoted string. Fix to allow more checks.

(SC1073)


[error] 6-6: Expected end of double quoted string. Fix any mentioned problems and try again.

(SC1072)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.devcontainer/setup.bash (1)

6-6: Fix stray trailing quote – script is currently syntactically invalid

A double quote is left dangling at the end of the line, breaking parsing (SC1072/SC1073).
The script aborts before running anything after this point.

-echo 'conda activate snakemake-tutorial' >> ~/.bashrc"
+echo 'conda activate snakemake-tutorial' >> ~/.bashrc
🧹 Nitpick comments (1)
.devcontainer/setup.bash (1)

3-3: Unnecessary escape characters

Escaping the quotes adds noise; a single-quoted string is clearer and avoids wildcard expansion just as well.

-echo \"*\" > .gitignore
+echo '*' > .gitignore
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3049d69 and ebcfcb2.

📒 Files selected for processing (1)
  • .devcontainer/setup.bash (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash

[error] 6-6: Couldn't parse this double quoted string. Fix to allow more checks.

(SC1073)


[error] 6-6: Expected end of double quoted string. Fix any mentioned problems and try again.

(SC1072)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.devcontainer/setup.bash (1)

9-9: Remove the trailing double-quote to fix the syntax error

The script still contains the stray " at the end of the line, making the whole file unparsable (SC1072/SC1073).

-echo 'conda activate snakemake-tutorial' >> ~/.bashrc"
+echo 'conda activate snakemake-tutorial' >> ~/.bashrc
🧹 Nitpick comments (2)
.devcontainer/setup.bash (2)

6-6: Write a bare asterisk without wrapping quotes

echo \"*\" ends up writing "*" (including quotes).
If the goal is to ignore everything, emit a raw asterisk while preventing glob expansion:

-echo \"*\" > .gitignore
+echo '*' > .gitignore

7-8: Call conda init non-interactively for reproducibility

Running plain conda init can emit verbose output and may prompt depending on Conda versions.
Explicitly target bash and silence output to make CI/container builds deterministic:

-conda init
-source ~/.bashrc
+conda init bash --quiet
+source ~/.bashrc
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebcfcb2 and 8f1b13e.

📒 Files selected for processing (1)
  • .devcontainer/setup.bash (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash

[error] 9-9: Couldn't parse this double quoted string. Fix to allow more checks.

(SC1073)


[error] 9-9: Expected end of double quoted string. Fix any mentioned problems and try again.

(SC1072)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.devcontainer/setup.bash (1)

5-5: && prevents .github removal on unlikely errors
Because the second rm executes only when the first one exits with 0, an (admittedly rare) permission error on either Dockerfile or .gitpod.yml will skip deletion of .github.
A simple ; is safer here.

-rm -f Dockerfile .gitpod.yml && rm -rf .github
+rm -f Dockerfile .gitpod.yml ; rm -rf .github
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f1b13e and aabac05.

📒 Files selected for processing (1)
  • .devcontainer/setup.bash (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash

[warning] 9-9: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (1)
.devcontainer/setup.bash (1)

1-3: Good: shebang + strict-mode added
Ensures predictable failure behaviour – thanks for incorporating the earlier feedback.

Comment on lines 8 to 10
conda init
source ~/.bashrc
echo 'conda activate snakemake-tutorial' >> ~/.bashrc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

conda activate line may be appended multiple times
If the container is rebuilt, each run appends another identical line to ~/.bashrc, bloating it over time.

-grep -qxF 'conda activate snakemake-tutorial' ~/.bashrc || \
-  echo 'conda activate snakemake-tutorial' >> ~/.bashrc
+if ! grep -qxF 'conda activate snakemake-tutorial' ~/.bashrc; then
+  echo 'conda activate snakemake-tutorial' >> ~/.bashrc
+fi

Also consider replacing source ~/.bashrc with the non-interactive hook to silence SC1090:

eval "$(conda shell.bash hook)"
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 9-9: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

🤖 Prompt for AI Agents
In .devcontainer/setup.bash around lines 8 to 10, prevent appending the 'conda
activate snakemake-tutorial' line multiple times to ~/.bashrc by first checking
if it already exists before appending. Also, replace 'source ~/.bashrc' with
'eval "$(conda shell.bash hook)"' to avoid the SC1090 warning and use the
recommended non-interactive conda initialization method.

Comment on lines +6 to +7
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md
echo "*" > .gitignore
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Overwrites & then hides almost everything
README.md is overwritten unconditionally and the subsequent
echo "*" ignores all new files—including the freshly written README.md—so the user ends up with a repository that only tracks .gitignore itself.

Consider either:

  1. Guarding creation ([ -e README.md ] || …) and using a narrower ignore pattern, or
  2. Adding explicit negations for the few files you do want under version control.

Example:

-echo "*" > .gitignore
+cat > .gitignore <<'EOF'
+*
+!*.md
+!.devcontainer/**
+EOF
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md
echo "*" > .gitignore
echo -e "# Snakemake-Tutorial\n\nYour gitpod workspace for the snakemake-tutorial has been initialized. Now you can start with the [basic tutorial](https://snakemake.readthedocs.io/en/stable/tutorial/basics.html)." > README.md
cat > .gitignore <<'EOF'
*
!*.md
!.devcontainer/**
EOF
🤖 Prompt for AI Agents
In .devcontainer/setup.bash at lines 6-7, the script overwrites README.md
unconditionally and then writes "*" to .gitignore, which causes all files
including README.md to be ignored. To fix this, modify the script to check if
README.md exists before creating it, and update .gitignore to use a narrower
pattern or add explicit negations to ensure README.md and other important files
are not ignored.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
.devcontainer/setup.bash (2)

6-7: README.md immediately ignored – same concern as previous review

The wildcard in .gitignore hides every file you just generated (including README.md).
See earlier comment for a narrower ignore pattern with negations.


8-11: Idempotency / ShellCheck: re-init & duplicate conda activate lines

Running this script twice will:

  1. Make conda init append a second block to ~/.bashrc.
  2. Append yet another conda activate snakemake-tutorial line.

Previous review already suggested guarding the append and using the non-interactive hook to avoid SC1090; it is still unresolved.

Also applies to: 13-13

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf5e6d5 and e9928f6.

📒 Files selected for processing (2)
  • .devcontainer/devcontainer.json (1 hunks)
  • .devcontainer/setup.bash (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .devcontainer/devcontainer.json
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/setup.bash

[warning] 10-10: ShellCheck can't follow non-constant source. Use a directive to specify location.

(SC1090)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

# abort on error, undefined vars, and failed pipelines
set -euo pipefail

rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Don’t rm -rf the directory you are executing from

rm -rf .devcontainer deletes the folder that contains this very script while it is still running.
Although the inode stays open, this is brittle and may break future re-runs or tooling that expects .devcontainer to exist after setup. Remove only the obsolete sub-artifacts instead.

-rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer
+rm -f Dockerfile .gitpod.yml && rm -rf .github
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rm -f Dockerfile .gitpod.yml && rm -rf .github .devcontainer
rm -f Dockerfile .gitpod.yml && rm -rf .github
🤖 Prompt for AI Agents
In .devcontainer/setup.bash at line 5, avoid removing the entire .devcontainer
directory since it contains the running script. Instead of `rm -rf
.devcontainer`, modify the command to only delete obsolete sub-artifacts inside
.devcontainer, preserving the directory itself to prevent breaking future runs
or tooling that relies on its existence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant