From 918236212ca00a492177afa08fc8506cff9224aa Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Mon, 21 Apr 2025 13:38:37 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20de=20app=20dans=20src,=20cr?= =?UTF-8?q?=C3=A9ation=20de=20run.py,=20ajout=20de=20prettier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 5 +++++ run.py | 9 +++++++++ src/__init__.py | 0 app.py => src/app.py | 18 +++++++++++++++--- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 run.py create mode 100644 src/__init__.py rename app.py => src/app.py (73%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2763415..bd6e4d4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,8 @@ repos: hooks: - id: black-jupyter args: [ --config=pyproject.toml ] + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.5.1 + hooks: + - id: prettier + files: \.(js|css|html|json|md)$ diff --git a/run.py b/run.py new file mode 100644 index 0000000..115f3b7 --- /dev/null +++ b/run.py @@ -0,0 +1,9 @@ +from os import getenv +from src.app import app + +# To use `gunicorn run:server` (prod) +server = app.server + +# To use `python index.py` (dev) +if __name__ == "__main__": + app.run(debug=True) diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app.py b/src/app.py similarity index 73% rename from app.py rename to src/app.py index 60e80bc..21d54ac 100644 --- a/app.py +++ b/src/app.py @@ -2,9 +2,7 @@ from dash import Dash, html, dcc, callback, Output, Input, dash_table import polars as pl import dash_bootstrap_components as dbc -df = pl.read_parquet( - "https://www.data.gouv.fr/fr/datasets/r/11cea8e8-df3e-4ed1-932b-781e2635e432" -) +df = pl.read_parquet("/home/colin/git/decp-processing/dist/2025-04-21/decp.parquet") app = Dash(external_stylesheets=[dbc.themes.UNITED], title="decp.info") server = app.server @@ -32,6 +30,20 @@ datatable = dash_table.DataTable( app.layout = [ html.H1(children="decp.info", style={"textAlign": "center"}), + html.Details( + children=[ + html.Summary("Utilisation"), + dcc.Markdown( + """ + Vous pouvez appliquer un filtre pour chaque colonne en entrant du texte sous le nom de la colonne, puis en tapant sur `Entrée`. + + - Champs textuels : la recherche est insensible à la casse (majuscules/minuscules). + - Champs numériques : possibilité d'ajouter < ou > devant le chiffre recherché pour chercher des valeurs inférieures ou supérieur. + """ + ), + ], + id="instructions", + ), html.Div( [ "Recherche dans objet : ",