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

Develop #23

Merged
merged 29 commits into from
Dec 24, 2023
Merged

Develop #23

merged 29 commits into from
Dec 24, 2023

Conversation

OriginalByteMe
Copy link
Owner

@OriginalByteMe OriginalByteMe commented Dec 24, 2023

Cleanup + improvements

Summary by CodeRabbit

  • New Features

    • Implemented continuous integration and deployment for the develop branch.
    • Introduced code formatting checks for Python files using black and isort.
  • Documentation

    • Updated .pylintrc with new message control settings.
  • Refactor

    • Enhanced image and package dependency management in app/common.
    • Initialized cutout handling functionality in app/cutout_handler.
    • Improved app/cutout_handler classes for better image processing and S3 interaction.
    • Established a FastAPI server in app/cutout_handler/server.py for image cutout creation and management.
  • Bug Fixes

    • Fixed import order and exception handling in various modules.
    • Corrected URL path formatting in app/s3_handler/app.py.
  • Style

    • Reformatted class docstrings and method parameters for improved readability.

OriginalByteMe and others added 29 commits November 18, 2023 12:57
Co-authored-by: CodiumAI-Agent <[email protected]>
Signed-off-by: Noah Rijkaard <[email protected]>
Update cutout creation and annotation process
…into-seperate-file

19 move cutout class back into seperate file
…re-for-deploying-modal

Update deployment configuration
@OriginalByteMe OriginalByteMe self-assigned this Dec 24, 2023
Copy link

coderabbitai bot commented Dec 24, 2023

Walkthrough

The project has undergone a CI/CD enhancement for the develop branch, integration of code formatting and linting tools, and updates to image handling and S3 interaction functionalities. The changes streamline development processes, improve code quality, and refine image processing and storage operations.

Changes

File(s) Change Summary
.github/workflows/ci-cd.yml Added develop branch triggers, set environment variables, and updated deployment commands.
.pre-commit-config.yaml, .pylintrc Included hooks for code formatting (black, isort) and customized Pylint message control.
app/common/__init__.py, app/cutout_handler/__init__.py Implemented image and package dependency management and initialized various stubs and handlers.
app/cutout_handler/dino.py, .../grounded_cutouts.py, .../s3_handler.py, .../segment.py, .../server.py Updated imports, added functionality for image cutouts, S3 uploads, and server initialization.
app/s3_handler/app.py, .../s3_handler.py Reformatted imports, exception handling, and improved URL consistency and readability.
legacy_code/cutouts.py Reordered imports and improved the readability of the __init__ method.

Poem

🐇✨
In the burrow of code, where the bytes align,
A hop and a skip, now everything's fine.
From branch to deploy, with a commit we bind,
Our code now as sleek as the stars that shine. 🌟
🐇✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file
    • @coderabbitai modularize this function
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions. Examples:
    • @coderabbitai gather interesting statistics about this repository and render them in a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai generate unit tests for the src/utils.ts file.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 35e9560 and cb1e222.
Files selected for processing (13)
  • .github/workflows/ci-cd.yml (2 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • .pylintrc (1 hunks)
  • app/common/init.py (1 hunks)
  • app/cutout_handler/init.py (1 hunks)
  • app/cutout_handler/dino.py (2 hunks)
  • app/cutout_handler/grounded_cutouts.py (1 hunks)
  • app/cutout_handler/s3_handler.py (2 hunks)
  • app/cutout_handler/segment.py (1 hunks)
  • app/cutout_handler/server.py (1 hunks)
  • app/s3_handler/app.py (8 hunks)
  • app/s3_handler/s3_handler.py (2 hunks)
  • legacy_code/cutouts.py (2 hunks)
Files skipped from review due to trivial changes (3)
  • .pylintrc
  • app/s3_handler/app.py
  • app/s3_handler/s3_handler.py
Additional comments: 15
app/cutout_handler/__init__.py (1)
  • 1-3: Verify that the imported cutout_handler_stub, s3_handler_stub, and cutout_app are used within this module or elsewhere if this module is imported. Unused imports should be removed to keep the code clean.
.pre-commit-config.yaml (1)
  • 1-10: The configuration for black and isort is commented out. If these tools are intended to be used for code formatting, the configuration should be uncommented and active.
.github/workflows/ci-cd.yml (2)
  • 4-7: The addition of the develop branch to the workflow triggers is a good practice for continuous integration, ensuring that the CI/CD process runs on updates to this branch as well.

  • 31-38: The new step to set environment variables dynamically based on the branch is a good practice for differentiating between deployment environments. Ensure that the downstream deployment scripts or commands are compatible with these new environment variables.

app/common/__init__.py (2)
  • 1-36: The Docker image setup and the creation of stubs for cutout_handler and s3_handler are well-structured, promoting modularity and reusability of the image configurations and service stubs.

  • 10-25: The use of run_commands to install dependencies and download weights is a clear and maintainable approach. However, ensure that the URLs for downloading weights are still valid and that the downloaded files are verified for integrity.

app/cutout_handler/dino.py (2)
  • 3-7: The addition of cutout_handler_stub and cutout_generator_image imports should be verified for their usage within the module. If the Model import from groundingdino.util.inference was removed, ensure that it is no longer needed and that no code is left broken by its removal.

  • 13-13: The reformatted docstring for the Dino class improves readability and clarity.

app/cutout_handler/s3_handler.py (1)
  • 5-7: The restructuring of import statements to include boto3 and exceptions from botocore within the s3_handler_image.imports() context is appropriate if it's meant to ensure these imports are only available when the Docker image is being used.
legacy_code/cutouts.py (2)
  • 1-11: The reordering and importing of modules should be verified to ensure that all imports are used within the module. Unused imports should be removed to maintain clean code.

  • 26-31: The reformatting of the CutoutCreator class's __init__ method improves readability and clarity.

app/cutout_handler/grounded_cutouts.py (1)
  • 1-16: The addition of imports should be verified to ensure that all imports are used within the module. Unused imports should be removed to maintain clean code.
app/cutout_handler/server.py (3)
  • 1-26: The addition of imports and constants should be verified to ensure that they are used within the module. Unused imports should be removed, and constants should be validated for correctness.

  • 32-41: The logging setup is a good practice for capturing and managing log output. Ensure that the logging configuration is consistent with the rest of the application.

  • 56-62: The CORS middleware setup is important for controlling cross-origin requests. Verify that the specified origins align with the application's front-end deployment and security requirements.



class Segmenter:
import numpy as np
Copy link

Choose a reason for hiding this comment

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

The import statement for numpy should be at the module level, not within the class definition, to follow Python's convention and improve readability.

-    import numpy as np
+import numpy as np

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.

Suggested change
import numpy as np
import numpy as np

Comment on lines +27 to +29
print(f"Successfully downloaded {image_name} to {file_path}")
print("Directory contents:")
print(os.listdir(save_path))
Copy link

Choose a reason for hiding this comment

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

The addition of print statements for debugging is useful for development, but consider using logging instead of print statements for better control over the output and its format.

-            print(f"Successfully downloaded {image_name} to {file_path}")
-            print("Directory contents:")
-            print(os.listdir(save_path))
+            logger.info(f"Successfully downloaded {image_name} to {file_path}")
+            logger.debug("Directory contents: %s", os.listdir(save_path))

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.

Suggested change
print(f"Successfully downloaded {image_name} to {file_path}")
print("Directory contents:")
print(os.listdir(save_path))
logger.info(f"Successfully downloaded {image_name} to {file_path}")
logger.debug("Directory contents: %s", os.listdir(save_path))

@OriginalByteMe OriginalByteMe merged commit cb1e222 into main Dec 24, 2023
1 check failed
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