-
Notifications
You must be signed in to change notification settings - Fork 0
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
Scaffolding of a FLASK app for WhatsApp analytics #5
Conversation
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-json | ||
- id: check-yaml | ||
- id: check-merge-conflict | ||
- id: check-added-large-files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few more hooks which can be helpful for our usecase
- flake8 - Purpose: Runs the Flake8 code linter to check for PEP 8 violations and other style issues.
- black - Purpose: Applies the Black code formatter to format Python code according to PEP 8 standards.
- isort - Purpose: Sorts import statements in Python files according to PEP 8 guidelines.
- mypy - Purpose: Runs the MyPy static type checker to find type errors in Python code.
- docformatter - Purpose: Formats docstrings in Python files to adhere to PEP 257 guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few more hooks in the pre-commit config
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it helpful so far? @Sachinbisht27
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, @Satendra-SR. For the code formatting and increasing readability of the code.
.github/workflows/pre-commit.yml
Outdated
on: | ||
pull_request: | ||
push: | ||
branches: [main] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add develop branch as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
3. Activate the virtual environment | ||
```sh | ||
source ./venv/bin/activate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's include Windows command as well. I believe we have different commands to active in MacOS vs Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added command for win-os
README.md
Outdated
4. Install the dependencies: | ||
```sh | ||
pip install -r requirements-dev.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge requirements-dev.txt and requirements.txt and use requirements.txt instead as there are only one additional package we are using in requirements-dev.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-json | ||
- id: check-yaml | ||
- id: check-merge-conflict | ||
- id: check-added-large-files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it helpful so far? @Sachinbisht27
config.py
Outdated
from dotenv import load_dotenv | ||
|
||
load_dotenv() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think we need this on cloud function. Can we out it under if condition? If ENV is development, then load this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, @Satendra-SR Moved the load_dotenv()
to the environment condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some changes in the last review, got approved mistakenly
# add your model's MetaData object here | ||
# for 'autogenerate' support | ||
|
||
target_metadata = models.Base.metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try this?
target_metadata = db.metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions, else looks good to go
api/utils/loggingutils.py
Outdated
from api import app | ||
|
||
logger = logging.getLogger() | ||
logging.basicConfig(level=logging.DEBUG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get the logging level from ENV?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, updating.
config.py
Outdated
from os import path | ||
|
||
from dotenv import load_dotenv | ||
|
||
basedir = path.abspath(path.dirname(__file__)) | ||
load_dotenv(path.join(basedir, ".env")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from os import path | |
from dotenv import load_dotenv | |
basedir = path.abspath(path.dirname(__file__)) | |
load_dotenv(path.join(basedir, ".env")) | |
from dotenv import load_dotenv | |
load_dotenv() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
#3
Please complete the following steps and check these boxes before filing your PR:
Types of changes
Short description of what this resolves:
Added changes
Checklist: