Skip to content

api resolve#2

Merged
quentinformatique merged 4 commits intomainfrom
fix/api-resolve
May 19, 2025
Merged

api resolve#2
quentinformatique merged 4 commits intomainfrom
fix/api-resolve

Conversation

@quentinformatique
Copy link
Member

This pull request introduces several updates to enhance the project's Docker setup, API functionality, and testing. Key changes include improvements to the Dockerfile for better caching and dependency management, the addition of a health check endpoint, and a new manual test script for API validation.

Docker and Dependency Management:

  • Added a .dockerignore file to exclude unnecessary files and directories from the Docker build context, improving build efficiency.
  • Updated the Dockerfile to install system dependencies required for OpenCV, optimize the Docker cache by copying requirements.txt first, and clean up unused files after installation.

API Enhancements:

  • Added a health check endpoint (/) to the app/routes.py file, which returns a simple JSON response to indicate the API is running.
  • Updated run.py to bind the Flask app to 0.0.0.0, making it accessible from outside the container.

Testing:

  • Added a new manual test script (tests/manual/test_api.py) to validate the API's functionality by sending images to the /cubeFacesToCubeString endpoint and printing the results.

@quentinformatique quentinformatique requested a review from Copilot May 19, 2025 11:42
@quentinformatique quentinformatique self-assigned this May 19, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances Docker builds, API accessibility, and adds a manual API test:

  • Optimizes Docker build with a .dockerignore and improved Dockerfile layering.
  • Exposes a root health-check endpoint and binds the app to 0.0.0.0.
  • Introduces a manual test script for the /cubeFacesToCubeString endpoint.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Dockerfile Install OpenCV deps, copy requirements.txt first for better caching.
.dockerignore Exclude unnecessary files/dirs to speed up Docker builds.
run.py Bind Flask app to 0.0.0.0 for container access.
app/routes.py Add GET / health check returning JSON status.
app/cube_recognition.py Remove unused FACE_ORDER constant—verify no downstream breakage.
tests/manual/test_api.py New manual script to POST images and print the cube string.
Comments suppressed due to low confidence (3)

tests/manual/test_api.py:18

  • [nitpick] Error messages are in French; consider using English for consistency with the rest of the codebase.
print(f"Erreur: Le fichier {img_file} n'existe pas")

tests/manual/test_api.py:31

  • This script prints the cube string but does not assert on its value; consider adding assertions to automatically validate the API response.
print(f"Cube string: {result.get('cube_string')}")

app/cube_recognition.py:4

  • Removing FACE_ORDER may break generate_cube_string if it relies on this constant; ensure face order is handled elsewhere or restore the constant.
FACE_ORDER = ['U', 'R', 'F', 'D', 'L', 'B']

@quentinformatique quentinformatique merged commit f66e110 into main May 19, 2025
2 checks passed
@quentinformatique quentinformatique deleted the fix/api-resolve branch May 19, 2025 12:15
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.

2 participants