-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add logging and update to ydata_profiling
- Loading branch information
Showing
22 changed files
with
2,954 additions
and
1,844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9 | ||
FROM python:3.10-slim-buster as requirements-stage | ||
|
||
WORKDIR /app | ||
WORKDIR /tmp | ||
RUN pip install poetry | ||
COPY ./pyproject.toml ./poetry.lock* /tmp/ | ||
|
||
ENV POETRY_VERSION=1.2.0 | ||
RUN mkdir -p /tmp/app | ||
COPY ./app /tmp/app | ||
|
||
# Install Poetry | ||
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \ | ||
cd /usr/local/bin && \ | ||
ln -s /opt/poetry/bin/poetry && \ | ||
poetry config experimental.new-installer false && \ | ||
poetry config virtualenvs.create false | ||
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes | ||
|
||
# Copy poetry.lock* in case it doesn't exist in the repo | ||
COPY ./pyproject.toml ./poetry.lock* / | ||
|
||
# Allow installing dev dependencies to run tests | ||
ARG INSTALL_DEV=false | ||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi" | ||
FROM python:3.10-slim-buster | ||
|
||
COPY . . | ||
ENV PYTHONPATH=/app | ||
WORKDIR /code | ||
|
||
COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt | ||
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | ||
|
||
COPY --from=requirements-stage /tmp/app /code/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9 | ||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10 | ||
|
||
WORKDIR /app | ||
|
||
ENV POETRY_VERSION=1.2.0 | ||
|
||
# Install Poetry | ||
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \ | ||
RUN curl -sSL https://install.python-poetry.org/ | POETRY_HOME=/opt/poetry python && \ | ||
cd /usr/local/bin && \ | ||
ln -s /opt/poetry/bin/poetry && \ | ||
poetry config experimental.new-installer false && \ | ||
poetry config virtualenvs.create false | ||
|
||
# Copy poetry.lock* in case it doesn't exist in the repo | ||
COPY ./pyproject.toml ./poetry.lock* / | ||
COPY ./pyproject.toml / | ||
|
||
# Allow installing dev dependencies to run tests | ||
ARG INSTALL_DEV=false | ||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi" | ||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --only main ; fi" | ||
|
||
COPY . . | ||
ENV PYTHONPATH=/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import logging | ||
import logging.config | ||
import os | ||
|
||
from app.core.config import Settings | ||
|
||
settings = Settings() | ||
|
||
# Create the logs directory if it doesn't exist | ||
log_directory = os.path.dirname(settings.LOG_FILE_PATH) | ||
if not os.path.exists(log_directory): | ||
os.makedirs(log_directory) | ||
|
||
# Configuration dictionary for logging | ||
LOGGING_CONFIG = { | ||
"version": 1, | ||
"disable_existing_loggers": False, | ||
"formatters": { | ||
"default": { | ||
"format": "%(asctime)s [%(levelname)s] [%(name)s:%(lineno)d] - %(message)s", # noqa: E501 | ||
"datefmt": "%Y-%m-%d %H:%M:%S", | ||
}, | ||
}, | ||
"handlers": { | ||
"console": { | ||
"class": "rich.logging.RichHandler", | ||
"level": settings.LOG_LEVEL, | ||
}, | ||
}, | ||
"loggers": { | ||
"": { | ||
"level": settings.LOG_LEVEL, | ||
"handlers": ["console"], | ||
"propagate": True, | ||
}, | ||
"celery": { | ||
"level": settings.LOG_LEVEL, | ||
"handlers": ["console"], | ||
"propagate": True, | ||
}, | ||
}, | ||
} | ||
|
||
# Load the logging configuration | ||
logging.config.dictConfig(LOGGING_CONFIG) | ||
|
||
|
||
def get_logger(name: str) -> logging.Logger: | ||
""" | ||
Get a logger with the specified name. | ||
Args: | ||
name (str): The name of the logger. | ||
Returns: | ||
logging.Logger: The logger instance. | ||
""" | ||
return logging.getLogger(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from typing import Union | ||
from typing import Any | ||
|
||
from pydantic import BaseModel, Json | ||
from pydantic import BaseModel | ||
|
||
|
||
class Duplicates(BaseModel): | ||
__root__: Union[Json, str] | ||
__root__: Any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any, Dict | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class Scatter(BaseModel): | ||
pass | ||
data: Dict[str, Any] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.