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

MES #20240829 #208

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE/MEP_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ version:

- [ ] version number
- [ ] CI/CD tests pass
- [ ] Add message on data review slack channel
- [ ] Add message on data review slack channel
- [ ] ⚠️ I will click on **Merge Pull Request** and **NOT** *on Squash and merge*
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE/MES_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ version:

- [ ] version number
- [ ] CI/CD tests pass
- [ ] Add message on data review slack channel
- [ ] Add message on data review slack channel
- [ ] ⚠️ I will click on **Merge Pull Request** and **NOT** *on Squash and merge*
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Select PR template in preview mode:
* [Ticket](?expand=1&template=Generic_template.md)
* [Hotfix](?expand=1&template=Hotfix_template.md)
* [MES](?expand=1&template=MES_template.md)
* [MEP](?expand=1&template=MEP_template.md)
* [Other](?expand=1&template=Generic_template.md)



Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
stages: [commit]
- id: lint-check
name: Linting (ruff)
entry: ruff check
entry: ruff check --fix
language: system
types: [python]
stages: [commit]
26 changes: 17 additions & 9 deletions apps/fraud/compliance/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
FROM python:3.9-slim
FROM python:3.10-slim
COPY --from=ghcr.io/astral-sh/uv:0.3.4 /uv /bin/uv

ENV PYTHONUNBUFFERED True

ENV APP_HOME /app
ENV PYTHONUNBUFFERED=True
ENV APP_HOME=/app
WORKDIR $APP_HOME

# Install libraries
COPY ./requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY ./src/main.py .
RUN uv pip install -r requirements.txt --system
COPY ./src .
# Copy local code to the container
COPY ./src/pcpapillon ./pcpapillon

CMD exec gunicorn -k uvicorn.workers.UvicornWorker --bind :$PORT --workers 1 --threads 10 --preload --timeout 0 main:app
# Conditionally copy the Google Cloud credentials file based on the argument
ARG LOCAL=false
ARG GOOGLE_CLOUD_PROJECT
ENV GOOGLE_CLOUD_PROJECT=${GOOGLE_CLOUD_PROJECT}
RUN if [ "$LOCAL" = "true" ]; then \
mkdir -p /root/.config/gcloud && \
cp ./application_default_credentials.json /root/.config/gcloud/application_default_credentials.json; \
fi

# Run the container
CMD exec gunicorn -k uvicorn.workers.UvicornWorker --bind :$PORT --workers 1 --threads 10 --preload --timeout 0 main:app
2 changes: 1 addition & 1 deletion apps/fraud/compliance/api/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
init:
pyenv install 3.9 -s
pyenv install 3.10 -s
@eval "$$(pyenv init -)" && pyenv virtualenv 3.9 api-data-fraud-compliance && pyenv local api-data-fraud-compliance

install_with_uv:
Expand Down
9 changes: 7 additions & 2 deletions apps/fraud/compliance/api/deploy_local.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
docker build -t pcpapillon --progress=plain .
docker run -it -p 8080:8080 pcpapillon
if [ ! -f ~/.config/gcloud/application_default_credentials.json ]; then
gcloud auth application-default login
fi
cp ~/.config/gcloud/application_default_credentials.json src/application_default_credentials.json
docker build -t pcpapillon --build-arg LOCAL=true --build-arg GOOGLE_CLOUD_PROJECT=passculture-data-ehp .
rm src/application_default_credentials.json
docker run -p 8080:8080 -e "PORT=8080" pcpapillon
17 changes: 12 additions & 5 deletions apps/fraud/compliance/api/requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
catboost==1.2
apscheduler==3.10.4
catboost==1.2.5
cloudpickle==3.0.0
dataclass-wizard==0.22.2
fastapi-cloud-logging==1.1.0
fastapi-versioning==0.10.0
Expand All @@ -8,14 +10,19 @@ google-cloud-logging==3.5.0
google-cloud-secret-manager==2.2.0
google-cloud-storage==2.9.0
gunicorn==20.0.4
ipython==8.24.0
loguru==0.7.0
mlflow==2.3.1
numpy==1.22
matplotlib==3.9.2
mlflow==2.10.2
numpy==1.26.4
oauth2client==4.1.3
pandas==2.0.1
pandas==2.2.0
psutil==5.9.8
python-jose==3.3.0
python-multipart==0.0.6
ruff==0.4.7
scikit-learn==1.5.0
scipy==1.13.1
sentence-transformers==2.2.2
shap==0.41.0
shap==0.46.0
uvicorn==0.22.0
Loading
Loading