Skip to content

Docker Template for the Project #267

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 15 commits into
base: main
Choose a base branch
from
Open

Conversation

Tatianah3
Copy link
Collaborator

@Tatianah3 Tatianah3 commented May 27, 2025

Feature Pull Request

Branch Naming Convention

Current branch: feature/docker-template

Related Issue

Closes #159

Feature Description

This PR adds a development container (devcontainer) setup for the project.
It introduces a Dockerfile inside the .devcontainer folder and a .dockerignore file to optimize Docker builds.
Also, it updates the pyproject.toml to align with the new docker-based CLI template build workflow.

Implementation Details

  1. Created .devcontainer/Dockerfile based on the existing docker_cli_template for consistent development environments.
  2. Added .dockerignore to exclude unnecessary files during Docker build.
  3. Updated pyproject.toml to reflect changes necessary for the new Docker build and CLI entry point.

Changes Made

  • Added .devcontainer/Dockerfile
  • Added .dockerignore
  • Modified pyproject.toml

Testing Performed

  1. Built Docker image successfully with docker build command.
  2. Ran the container and verified CLI help output to ensure correct setup.
  3. Local testing of Docker-based CLI command verified functional.

Testing Instructions

  1. Ensure Docker is installed on your machine.

  2. Run the container setup command:
    just container-setup

This command will:

  • Build the Docker image from .devcontainer/Dockerfile
  • Print a success message when complete.
  • Container is now ready for use.
  1. Test the Docker integration:
    just container-test

This command will:

  • Run the CLI help command in the container
  • Run the CLI version command in the container
  • Verify Docker integration is working

Documentation Updates

  • Add docker.md file for Docker user guide.
  • Add a docker section in theREADME.md file.

Breaking Changes

Checklist

  • Branch name follows convention (feature/description or feature/issue-number-description)
  • Testing added to pre-commit hook (pre-commit run --all-files passes)
  • Testing added to CI/CD pipeline in GitHub Actions
  • Documentation added/updated in Sphinx
  • Appropriate unit test coverage added (run pytest --cov to verify)
  • New commands added to CLI (if applicable)
  • Code follows project style guidelines (flake8 or equivalent passes)
  • All tests pass locally and in CI
  • Self-review of code performed
  • No debug print statements or commented-out code left in the codebase

Reviewer Notes


Important

Add Docker development environment setup with new Dockerfile, .dockerignore, and updated pyproject.toml for CLI entry point.

  • Docker Setup:
    • Added .devcontainer/Dockerfile for consistent development environments.
    • Added .dockerignore to exclude unnecessary files during Docker build.
  • Configuration:
    • Updated pyproject.toml to add py-launch script entry point for Docker-based CLI.
  • Testing:
    • Docker image built successfully and CLI help output verified.
    • Local testing of Docker-based CLI command confirmed functional.
  • Justfile:
    • Added _container_setup command to build and run Docker container.

This description was created by Ellipsis for f357c99. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added a development container setup for streamlined development using Docker.
    • Introduced a new command-line script entry point, py-launch, for easier project access.
  • Chores
    • Added a .dockerignore file to optimize Docker builds by excluding unnecessary files.

@Tatianah3 Tatianah3 requested a review from smorin May 27, 2025 01:37
Copy link
Contributor

coderabbitai bot commented May 27, 2025

Walkthrough

A Docker template was added to the project, including a new Dockerfile and a .dockerignore file for efficient container builds. The pyproject.toml was updated to introduce a new CLI entry point, py-launch, which is used as the default command within the Docker container. A devcontainer configuration and a just recipe were also added to facilitate container setup and usage.

Changes

File(s) Change Summary
.devcontainer/Dockerfile, .devcontainer/devcontainer.json, Justfile Added Dockerfile, devcontainer config, and just recipe to build and run the Docker container.
.dockerignore Added to exclude unnecessary files and directories from the Docker build context.
pyproject.toml Added a new script entry point py-launch for Docker use.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Just as just CLI
    participant DockerContainer
    participant CLI_Main as py_launch_blueprint.projects:main

    User->>Just: Run `_container_setup` recipe
    Just->>DockerContainer: Build image and run container with shell
    User->>DockerContainer: Interact with container shell
    DockerContainer->>CLI_Main: Run `py-launch` CLI command (default entrypoint)
    CLI_Main-->>DockerContainer: CLI completes
    DockerContainer-->>User: Output results
Loading

Assessment against linked issues

Objective Addressed Explanation
Add Dockerfile with appropriate base image, CLI configuration, and integration with project structure (#159)
Add .dockerignore to optimize Docker build context (#159)
Add CLI entry point for Docker usage (#159)
Documentation and usage examples in Docker (#159) No documentation or usage examples added in this PR.

Poem

In a Docker burrow, neat and spry,
A blueprint rabbit hops nearby.
With py-launch now the Docker call,
No cache or clutter, none at all!
Container dreams, so light and fleet—
This rabbit’s work is now complete.
🐇🐳


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.

@Tatianah3 Tatianah3 requested a review from husnain067 May 27, 2025 01:37
@CLAassistant
Copy link

CLAassistant commented May 27, 2025

CLA assistant check
All committers have signed the CLA.

@Tatianah3 Tatianah3 self-assigned this May 27, 2025
Copy link
Contributor

github-actions bot commented May 27, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 6824faa in 1 minute and 23 seconds. Click for details.
  • Reviewed 26 lines of code in 2 files
  • Skipped 1 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .dockerignore:2
  • Draft comment:
    Excluding the entire .devcontainer folder may remove the Dockerfile from the build context. Confirm if this is intended or consider an exception (e.g. by using '!/.devcontainer/Dockerfile') so that necessary files aren’t omitted.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a new .dockerignore file with standard Python patterns. The comment is speculative - it says "may remove" and asks for confirmation. It's asking the author to verify their intention. We don't have evidence that a Dockerfile in .devcontainer is actually needed for the build context. The patterns look like standard boilerplate for Python projects. Maybe there is actually a Dockerfile in .devcontainer that's needed for the build. Maybe this is a valid concern based on the project structure. Without seeing strong evidence that a .devcontainer/Dockerfile exists and is needed, this is purely speculative. The comment asks for confirmation which violates our rules. Delete the comment as it's speculative and asks for confirmation of intention, which violates our review rules.
2. pyproject.toml:45
  • Draft comment:
    The new 'py-launch' script duplicates 'py-projects'. Verify if both are required or if the naming should better reflect Docker-specific usage.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. pyproject.toml:46
  • Draft comment:
    Typo found: Consider adding a space between the '#' and 'This' in the inline comment. E.g., change "#This creates the Docker Template" to "# This creates the Docker Template"
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about Python style conventions (PEP 8 recommends a space after #), this is a very minor style issue in a configuration file, not in actual Python code. The comment is readable and clear as-is. This seems like an overly pedantic suggestion that doesn't materially improve code quality. The spacing convention might be part of the project's style guide. Some teams are very strict about consistent formatting. Looking at other comments in the file (like line 3), they also don't have spaces after #, suggesting this isn't enforced in this codebase. Even if it were, such a minor style issue should be handled by automated formatters, not PR comments. This comment should be deleted as it's too minor and doesn't meaningfully improve code quality. Style issues like this are better handled by automated tools.

Workflow ID: wflow_fkfrJjbDtyv4usm7

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@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

🧹 Nitpick comments (8)
.dockerignore (1)

1-8: Consider adding environment-specific files.
You may want to ignore virtual environment directories (e.g., .venv/) and environment files (e.g., .env) to prevent leaking secrets and reduce context size.

pyproject.toml (2)

45-48: Evaluate duplicate CLI script entries.
Both py-launch and py-projects point to the same function; consider whether both aliases are needed or if one can be removed to reduce confusion.


46-46: Refine inline comment.
The inline comment #This creates the Docker Template may be better suited in PR documentation or the README rather than in pyproject.toml, to keep the file clean.

.devcontainer/Dockerfile (5)

2-2: Pin exact Python base image.
Consider pinning to a specific patch version (e.g., python:3.11.6-slim) to avoid unexpected upstream changes affecting builds.


8-11: Optimize Docker layer usage.
Combine COPY commands to reduce the number of layers and improve cache efficiency:

COPY pyproject.toml README.md ./
COPY py_launch_blueprint/ ./py_launch_blueprint/
COPY tests/ ./tests/

14-14: Clarify version override for setuptools-scm.
Add context explaining why SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0 is required to bypass Git-based version detection during container builds.


17-17: Upgrade pip before installation.
It is recommended to run pip install --upgrade pip before installing the package to ensure compatibility and leverage the latest installer features:

RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir .

20-21: Add a default CMD for usage help.
Providing a default CMD ["--help"] ensures running the container without args prints the CLI usage:

ENTRYPOINT ["py-launch"]
CMD ["--help"]
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dc5c9e9 and 6824faa.

📒 Files selected for processing (3)
  • .devcontainer/Dockerfile (1 hunks)
  • .dockerignore (1 hunks)
  • pyproject.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: continuous-integration (3.11)
  • GitHub Check: continuous-integration (3.10)
🔇 Additional comments (2)
.dockerignore (1)

1-8: Properly ignoring build context files.
Entries exclude common Python build artifacts, editor configs, and the .devcontainer directory to optimize Docker context upload.

.devcontainer/Dockerfile (1)

5-6: Setting working directory.
The WORKDIR /app directive correctly scopes where application code resides.

@Tatianah3 Tatianah3 marked this pull request as draft May 29, 2025 23:48
@Tatianah3 Tatianah3 marked this pull request as ready for review June 4, 2025 21:31
Copy link

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

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

Other comments (2)
  • pyproject.toml (46-47) Inline comments in TOML should be preceded by a space and are best placed on their own line. Consider moving the comment above the entry for better compatibility and readability.
    # This creates the Docker Template
    py-launch = "py_launch_blueprint.projects:main"
    py-projects = "py_launch_blueprint.projects:main"
    
  • Justfile (632-632) Consider adding a group annotation to the `_container_setup` recipe, such as `[group('dev')]` or `[group('utilities')]`, to ensure it appears in grouped listings and is easier to discover.

💡 To request another review, post a new comment with "/windsurf-review".

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to f357c99 in 1 minute and 41 seconds. Click for details.
  • Reviewed 41 lines of code in 3 files
  • Skipped 2 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .dockerignore:2
  • Draft comment:
    Excluding '.devcontainer/' may cause the Dockerfile (located in .devcontainer) to be omitted from the build context. Consider whitelisting the Dockerfile (e.g., add a '!/.devcontainer/Dockerfile' rule) if Docker complains.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment is speculative - it says "may cause" and "if Docker complains". It's asking the author to consider something that might be an issue in the future. We don't have evidence that there actually is a Dockerfile in .devcontainer/ or that it's needed for the build. The comment violates the rule about speculative comments. Maybe excluding .devcontainer/ could cause real build issues if there is actually a Dockerfile there that's needed. Without seeing the actual Dockerfile location or build setup, this is purely speculative. If there were build issues, they would be caught immediately when testing the changes. Delete the comment as it's speculative ("if Docker complains") and we don't have strong evidence that this is actually an issue.
2. Justfile:632
  • Draft comment:
    The _container_setup recipe appropriately builds and runs the container. Verify that using 'PY_TOKEN=dummy' and an interactive bash shell fits your development workflow.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
3. pyproject.toml:45
  • Draft comment:
    The addition of the 'py-launch' CLI entry point aligns with the Docker integration goals. Confirm that having both 'py-launch' and 'py-projects' pointing to the same function is intentional.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
4. pyproject.toml:46
  • Draft comment:
    Typographical suggestion: It’s conventional to include a space after the # in comments. Consider changing #This creates the Docker Template to # This creates the Docker Template.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While consistent comment style is good, this is an extremely minor issue. The comment is about a newly added line, but it's not pointing out a bug or significant code quality issue. The file itself shows mixed usage of comment styles. This kind of nitpick could create unnecessary noise in the PR review. The comment is technically correct about common Python style conventions (PEP 8). Also, consistency in code style can be valuable for maintainability. While style consistency is good, this is too minor to warrant a PR comment. If style enforcement is important, it should be handled by automated tools like ruff (which is already configured in this project) rather than manual comments. Delete this comment as it's too minor and would create unnecessary noise in the PR review process. Style issues like this should be handled by automated tools.

Workflow ID: wflow_yIlw2GAC4xrcxq4l

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@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

🧹 Nitpick comments (2)
Justfile (1)

631-635: Consider improving readability and error handling.

The implementation correctly builds and runs the Docker container, but the long command on line 634 could benefit from better formatting and error handling.

Consider this refactor for better readability and error handling:

# Container Just Command
_container_setup:
-    @MSYS_NO_PATHCONV=1 docker build -t py-launch-dev -f .devcontainer/Dockerfile .
-    @MSYS_NO_PATHCONV=1 docker run --rm -e PY_TOKEN=dummy -it --entrypoint /bin/bash py-launch-dev -c "echo '✅ Container ran successfully! You are now inside the container shell.'; exec bash"
+    @echo "Building Docker image..."
+    @MSYS_NO_PATHCONV=1 docker build -t py-launch-dev -f .devcontainer/Dockerfile . || { echo "{{RED}}Failed to build Docker image{{NC}}"; exit 1; }
+    @echo "Starting container shell..."
+    @MSYS_NO_PATHCONV=1 docker run --rm -e PY_TOKEN=dummy -it \
+        --entrypoint /bin/bash py-launch-dev \
+        -c "echo '✅ Container ran successfully! You are now inside the container shell.'; exec bash"
.devcontainer/Dockerfile (1)

1-8: Consider optimizing Docker layers and pinning versions.

The Dockerfile structure is good, but could benefit from version pinning and layer optimization for better reproducibility and caching.

Consider these improvements:

# Use official Python slim image
-FROM python:3.11-slim
+FROM python:3.11.8-slim

# Install system dependencies, docker CLI, and 'just' into /usr/local/bin usage
-RUN apt-get update && apt-get install -y --no-install-recommends \
-    curl unzip ca-certificates gnupg docker.io \
- && curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin \
- && apt-get clean && rm -rf /var/lib/apt/lists/*
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+    curl=7.* \
+    unzip=6.* \
+    ca-certificates \
+    gnupg=2.* \
+    docker.io=20.* \
+ && rm -rf /var/lib/apt/lists/* \
+ && JUST_VERSION="1.25.2" \
+ && curl -L "https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz" -o just.tar.gz \
+ && tar -xzf just.tar.gz \
+ && mv just /usr/local/bin/ \
+ && rm just.tar.gz
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6824faa and f357c99.

📒 Files selected for processing (3)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • Justfile (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .devcontainer/devcontainer.json
🔇 Additional comments (2)
.devcontainer/Dockerfile (2)

19-20: Good workaround for setuptools-scm git dependency.

The SETUPTOOLS_SCM_PRETEND_VERSION environment variable is a clean solution to bypass git dependency during package installation in the containerized environment.


25-26:

✅ Verification successful

Verify the py-launch entry point exists.

Ensure that the py-launch command specified in the ENTRYPOINT is properly defined in the project's entry points.


🏁 Script executed:

#!/bin/bash
# Description: Verify that py-launch entry point is defined in pyproject.toml
# Expected: Find py-launch script entry point definition

# Search for py-launch script definition
rg -A 5 -B 5 "py-launch" pyproject.toml

Length of output: 405


ENTRYPOINT Validation Completed

The py-launch entry point is correctly defined in pyproject.toml under [project.scripts] as:

py-launch = "py_launch_blueprint.projects:main"

No further action is required.

@husnain067 husnain067 assigned husnain067 and unassigned Tatianah3 Jun 12, 2025
@husnain067 husnain067 marked this pull request as draft June 12, 2025 20:40
@husnain067 husnain067 marked this pull request as ready for review June 13, 2025 11:59
@husnain067 husnain067 marked this pull request as draft June 13, 2025 15:23
@husnain067 husnain067 marked this pull request as ready for review June 13, 2025 19:50
@husnain067 husnain067 requested a review from smorin June 13, 2025 19:50
@husnain067 husnain067 added this to the v1 milestone Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE]: Docker Template for Py Launch Blueprint
4 participants