Skip to content

Commit 4129072

Browse files
Updated README for new devs. Added --no-browser flag
1 parent bdcc175 commit 4129072

2 files changed

Lines changed: 52 additions & 87 deletions

File tree

DashAI/__main__.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,45 @@ def open_browser() -> None:
2424

2525
def main(
2626
local_path: Annotated[
27-
pathlib.Path, typer.Option(help="Path where DashAI files will be stored.")
27+
pathlib.Path,
28+
typer.Option(
29+
"--local-path",
30+
"-lp",
31+
help="Path where DashAI files will be stored.",
32+
),
2833
] = "~/.DashAI", # type: ignore
2934
logging_level: Annotated[
3035
LoggingLevel,
3136
typer.Option(
37+
"--logging-level",
38+
"-ll",
3239
help=(
3340
"DashAI App Logging level. "
3441
"Only in DEBUG mode, SQLAlchemy logging is enabled."
35-
)
42+
),
3643
),
3744
] = LoggingLevel.INFO,
45+
no_browser: Annotated[
46+
bool,
47+
typer.Option(
48+
"--no-browser",
49+
"-nb",
50+
help="Run without automatically opening the browser.",
51+
is_flag=True,
52+
),
53+
] = False,
3854
) -> None:
39-
"""Main function for DashAI package.
40-
41-
This function is executed when the package is called from the command line.
42-
It starts a timer to open the browser and runs the Dash application using Uvicorn.
43-
44-
45-
Parameters
46-
----------
47-
local_path : pathlib.Path,
48-
Path where DashAI local files will be stored, by default "~/.DashAI".
49-
logging_level : LoggingLevel
50-
Logging level. Defaults to LoggingLevel.INFO.
51-
52-
"""
55+
"""Main function for DashAI package."""
5356
logging.getLogger(name=__package__).setLevel(level=logging_level.value)
54-
5557
logger = logging.getLogger(__name__)
5658

5759
logger.info("Starting DashAI application.")
58-
logger.info("Opening browser.")
59-
timer = threading.Timer(interval=1, function=open_browser)
60-
timer.start()
60+
if not no_browser:
61+
logger.info("Opening browser.")
62+
timer = threading.Timer(interval=1, function=open_browser)
63+
timer.start()
64+
else:
65+
logger.info("Browser auto-open disabled (--no-browser/-nb).")
6166

6267
logger.info("Starting Uvicorn server application.")
6368
uvicorn.run(

README.rst

Lines changed: 27 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Quick installation (Pypi)
2020
=========================
2121

2222

23-
DashAI needs Python 3.8 or greater to be installed. Once that requirement is satisfied, you can install DashAI via pip:
23+
DashAI needs Python 3.10 or greater to be installed. Once that requirement is satisfied, you can install DashAI via pip:
2424

2525
.. code:: bash
2626
@@ -99,42 +99,6 @@ Then, launch the front-end development server by running the following command:
9999
100100
$ yarn start
101101
102-
If you want to launch the front-end test server (without launching the backend) with dummy data, run:
103-
104-
.. code:: bash
105-
106-
$ yarn json-server
107-
108-
Linting and formatting
109-
~~~~~~~~~~~~~~~~~~~~~~
110-
111-
The project uses as default linter `eslint <https://eslint.org/>`_ with
112-
the `react/recommended`, `standard-with-typescript`` and `prettier`` styles.
113-
114-
To manually run the linter, move to `DashAI/front` and run:
115-
116-
.. code:: bash
117-
118-
$ yarn eslint src
119-
120-
121-
The project uses `prettier <https://prettier.io/>`_ as default formatter.
122-
123-
To format the code manually, move to `DashAI/front` and execute:
124-
125-
.. code:: bash
126-
127-
$ yarn prettier --write src
128-
129-
130-
Build the frontend
131-
~~~~~~~~~~~~~~~~~~
132-
133-
Execute from `DashAI/front`:
134-
135-
.. code:: bash
136-
137-
$ yarn build
138102
139103
Backend
140104
-------
@@ -143,7 +107,7 @@ Backend
143107
Prepare the environment
144108
~~~~~~~~~~~~~~~~~~~~~~~
145109

146-
First, set the python enviroment using
110+
First, set the python enviroment, for that you can use
147111
`conda <https://docs.conda.io/en/latest/miniconda.html>`_:
148112

149113
.. code: bash
@@ -162,9 +126,9 @@ Later, install the requirements:
162126

163127
.. code:: bash
164128
165-
$ pip install pip-tools
166-
$ pip-sync requirements.txt requirements-dev.txt
167-
129+
$ pip install -r requirements.txt
130+
$ pip install -r requirements-dev.txt
131+
$ pre-commit install
168132
169133
Running the Backend
170134
~~~~~~~~~~~~~~~~~~~
@@ -181,14 +145,16 @@ There are three ways to run DashAI:
181145

182146
.. code:: bash
183147
184-
$ pip install .
148+
$ pip install . -e
185149
$ dashai
186150
187-
If you chose the second way, remember to install it each time you make changes.
151+
152+
Optional Flags
153+
==============
188154

189155
**Setting the local execution path**
190156

191-
With the `--local-path` option you can determine where DashAI will save its local
157+
With the `--local-path` (alias `-lp`) option you can determine where DashAI will save its local
192158
files, such as datasets, experiments, runs and others.
193159
The following example shows how to set the folder in the local `.DashAI` directory:
194160

@@ -199,7 +165,7 @@ The following example shows how to set the folder in the local `.DashAI` directo
199165
200166
**Setting the logging level**
201167

202-
Through the --logging_level parameter, you can set which logging level the DashAI
168+
Through the `--logging-level` (alias `-ll`) parameter, you can set which logging level the DashAI
203169
backend server will have.
204170

205171
.. code:: bash
@@ -208,11 +174,22 @@ backend server will have.
208174
209175
The possible levels available are: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`.
210176

211-
Note that the --logging-level not only affects the DashAI loggers, but also
177+
Note that the `--logging-level` not only affects the DashAI loggers, but also
212178
the datasets (which is set to the same level as DashAI) and the
213179
SQLAlchemy (which is only activated when logging level is DEBUG).
214180

215181

182+
**Disabling automatic browser opening**
183+
184+
By default, DashAI will open a browser window pointing to the application
185+
after starting. If you prefer to disable this behavior, you can use the
186+
`--no-browser` (alias `-nb`) flag:
187+
188+
.. code:: bash
189+
190+
$ python -m DashAI --no-browser
191+
192+
216193
**Checking Available Options**
217194

218195
You can check all available options through the command:
@@ -221,6 +198,10 @@ You can check all available options through the command:
221198
222199
$ python -m DashAI --help
223200
201+
202+
Testing
203+
=======
204+
224205
Execute tests
225206
~~~~~~~~~~~~~
226207

@@ -247,27 +228,6 @@ To execute the backend tests
247228
without making changes to the main database.
248229

249230

250-
Linting and formatting
251-
~~~~~~~~~~~~~~~~~~~~~~
252-
253-
The project uses as default backend linter
254-
`ruff <https://github.com/charliermarsh/ruff>`_:
255-
256-
To manually run the linter, move to `DashAI/back` and execute:
257-
258-
.. code:: bash
259-
260-
$ ruff .
261-
262-
263-
The project uses `black <https://black.readthedocs.io/en/stable/>`_ as default formatter.
264-
265-
To manually format the code, move to `DashAI/back` and execute:
266-
267-
.. code:: bash
268-
269-
$ black .
270-
271231

272232
Acknowledgments
273233
===============

0 commit comments

Comments
 (0)