Skip to content

Add Flask app skeleton#93

Open
kunal-595 wants to merge 7 commits intoKathiraveluLab:devfrom
kunal-595:feat/flask-skeleton
Open

Add Flask app skeleton#93
kunal-595 wants to merge 7 commits intoKathiraveluLab:devfrom
kunal-595:feat/flask-skeleton

Conversation

@kunal-595
Copy link
Copy Markdown

This adds a minimal Flask app with a /health endpoint that returns JSON, it also includes requirements.txt and a .env.example file so anyone can install the dependencies and run the app .

Copilot AI review requested due to automatic review settings March 7, 2026 12:13
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the initial scaffolding for a new Flask web application. It provides a ready-to-run setup with essential components like dependency management and environment configuration, along with a basic health check endpoint, enabling quick deployment and verification of the application's operational status.

Highlights

  • Flask Application Skeleton: Introduced a minimal Flask application as a foundational structure for future development.
  • Health Endpoint: Implemented a /health endpoint that returns a JSON response, providing a basic status check for the application.
  • Dependency Management: Included requirements.txt to specify necessary Python dependencies and .env.example for environment variable configuration, facilitating easy setup and execution.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .env.example
    • Added a new file to provide example environment variables for application configuration.
  • app.py
    • Added a new file containing the core Flask application logic, including a health endpoint.
  • requirements.txt
    • Added a new file listing the Python dependencies required to run the Flask application.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a minimal Flask application skeleton. A critical security vulnerability has been identified regarding the weak default SECRET_KEY configuration, which could lead to session hijacking if not properly set in a production environment. Additionally, an improvement is suggested for correctly using the python-dotenv dependency to load environment variables, making the application easier to run.

Copy link
Copy Markdown

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

Adds a minimal Flask application scaffold to the BHV repo to enable running a basic web service with a health check endpoint.

Changes:

  • Add app.py Flask app with a /health endpoint and basic env-driven configuration.
  • Add requirements.txt with Flask and python-dotenv.
  • Add .env.example with sample environment variables.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
requirements.txt Introduces Flask + dotenv dependencies for the new app.
app.py Implements the Flask app and /health route; reads config from environment.
.env.example Provides sample environment variable values for local setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

app.py Outdated
Comment on lines +3 to +5

app = Flask(__name__)
app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "change-me")
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

Using a hard-coded default SECRET_KEY ("change-me") is unsafe because it can lead to predictable session/signature keys if the env var is omitted. Prefer failing fast when SECRET_KEY is missing, or generate a random secret for local dev while requiring an explicit value in non-debug/production environments.

Suggested change
app = Flask(__name__)
app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "change-me")
import secrets
app = Flask(__name__)
secret_key = os.environ.get("SECRET_KEY")
if not secret_key:
# In debug mode, generate a random secret key for local development.
if os.environ.get("FLASK_DEBUG", "0") == "1":
secret_key = secrets.token_urlsafe(32)
else:
raise RuntimeError("SECRET_KEY environment variable must be set in production.")
app.config["SECRET_KEY"] = secret_key

Copilot uses AI. Check for mistakes.
app.py Outdated
Comment on lines +14 to +15
debug = os.environ.get("FLASK_DEBUG", "0") == "1"
port = int(os.environ.get("FLASK_PORT", 5000))
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The debug flag parsing only treats the literal string "1" as true; values like "true"/"True"/"yes" will be treated as false. Consider a more permissive boolean parse to reduce configuration surprises.

Copilot uses AI. Check for mistakes.
@kunal-595
Copy link
Copy Markdown
Author

@mdxabu , plz review this pr

@mdxabu mdxabu added the on hold Not merging this PR now. label Mar 7, 2026
@mdxabu
Copy link
Copy Markdown
Member

mdxabu commented Mar 7, 2026

@kunal-595, I added some review, and after that squash those 7 commits to 1 commit!

@kunal-595 kunal-595 force-pushed the feat/flask-skeleton branch from 74df820 to 2e99d15 Compare March 8, 2026 06:43
@kunal-595
Copy link
Copy Markdown
Author

@mdxabu, i have addressed the previous review comments and pushed new commits. Could you please take another look when you have time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on hold Not merging this PR now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants