Skip to content

Commit f0156c1

Browse files
Update CLI docstring and remove unused references
1 parent 0827141 commit f0156c1

File tree

6 files changed

+22
-45
lines changed

6 files changed

+22
-45
lines changed

brian2wasm/__main__.py

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,33 @@
44

55
def main():
66
"""
7-
Command-line interface for **Brian2Wasm**.
8-
9-
Usage
10-
-----
11-
``python -m brian2wasm <script.py> [--no-server]``
7+
Run a Brian2Wasm simulation from the command line.
128
139
Parameters
1410
----------
1511
script : str
16-
Path to the user’s Python model. The file **must** end with
17-
``.py`` and must not call ``set_device`` itself – the CLI inserts
18-
the appropriate ``set_device('wasm_standalone', …)`` line
19-
automatically.
20-
--no-server : flag, optional
21-
Generate the WASM/HTML output without starting the local preview
22-
web-server (sets the ``BRIAN2WASM_NO_SERVER`` environment
23-
variable for the subprocess).
12+
Path to the Python model file. Must end with ``.py`` and must not call
13+
``set_device`` directly, as the CLI automatically inserts the required
14+
``set_device('wasm_standalone', …)`` line.
15+
no_server : bool, optional
16+
If True, generate the WASM/HTML output without starting the local
17+
preview server (sets the ``BRIAN2WASM_NO_SERVER`` environment variable).
2418
25-
Behaviour
26-
---------
27-
1. Validates that *script* exists and is a ``.py`` file.
28-
2. Looks for an ``<scriptname>.html`` file in the same directory.
29-
* If found, passes the HTML file to ``set_device`` so the custom
30-
template is used.
31-
* Otherwise falls back to the default template.
32-
3. Prepends the required ``set_device('wasm_standalone', …)`` call to
33-
the script source in-memory.
34-
4. Executes the modified script with its own directory as working
35-
directory, so any relative paths inside the model behave as
36-
expected.
19+
Raises
20+
------
21+
FileNotFoundError
22+
If the given script does not exist.
23+
ValueError
24+
If the provided file is not a ``.py`` script.
25+
RuntimeError
26+
If execution of the model fails for any reason.
3727
38-
Exit status
39-
-----------
40-
* ``0`` – build finished successfully (and server started unless
41-
*--no-server* was given).
42-
* ``1`` – any error (missing file, not a ``.py`` file, exception
43-
during model execution, etc.).
44-
"""
28+
Notes
29+
-----
30+
This command is typically invoked as::
31+
32+
python -m brian2wasm <script.py> [--no-server]
33+
"""
4534

4635
parser = argparse.ArgumentParser(
4736
description="Brian2WASM CLI"

brian2wasm/device.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from brian2.devices.cpp_standalone.device import CPPStandaloneDevice, CPPWriter
2222
from brian2.utils.filetools import ensure_directory
2323

24-
__all__ = []
2524

2625
logger = get_logger(__name__)
2726

docs/reference/brian2wasm.__main__.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ brian2wasm.__main__ module
44
.. automodule:: brian2wasm.__main__
55
:members:
66
:undoc-members:
7-
:show-inheritance:
7+
:show-inheritance:

docs/reference/brian2wasm.device.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ brian2wasm.device module
55
:members:
66
:show-inheritance:
77
:undoc-members:
8-

docs/reference/brian2wasm.functions.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/reference/brian2wasm.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Submodules
88
:maxdepth: 4
99

1010
brian2wasm.device
11-
brian2wasm.functions
1211
brian2wasm.__main__
1312

1413
Module contents

0 commit comments

Comments
 (0)