Help Topics for debug

Sample CLI

gway awg find-cable

References

Signature

(*, meters: Union[int, str, NoneType] = None, amps: Union[int, str] = '40', volts: Union[int, str] =
'220', material: Literal['cu', 'al', '?'] = 'cu', max_lines: Union[int, str] = '1', phases:
Literal['1', '3', 1, 3] = '2', conduit: Union[str, bool, NoneType] = None, ground: Union[int, str] =
'1')

Docstring

Calculate the type of cable needed for an electrical system. Args: meters: Cable length (one line) in meters. Required keyword. amps: Load in Amperes. Default: 40 A. volts: System voltage. Default: 220 V. material: 'cu' (copper) or 'al' (aluminum). Default: cu. max_lines: Maximum number of line conductors allowed. Default: 1 phases: Number of phases for AC (1, 2 or 3). Default: 2 conduit: Conduit type or None. ground: Number of ground wires. Returns: dict with cable selection and voltage drop info, or {'awg': 'n/a'} if not possible.

clip · copy

Sample CLI

gway clip copy

References

Signature

(value=None, *, notify=True, when=None)

Docstring

Extracts or updates the clipboard contents. Args: value (str, optional): The value to copy to clipboard. If None, only reads the clipboard. notify (bool, optional): Whether to send a GUI notification. Default is True. when (str | Pattern, optional): If provided, must match clipboard contents. Acts as a gatekeeper: if there's no match, returns None and skips updating. Returns: str | None: The previous clipboard content, or None if `when` did not match.

Sample CLI

gway clip track-history

References

Signature

(interval: int = 5, *, stop_after=None, notify=True)

Docstring

Tracks clipboard history by polling at regular intervals. Args: interval (int): Seconds to wait between checks. Default is 5 seconds. stop_after (int | None): Optional maximum duration (in seconds) before stopping. notify (bool): Whether to show GUI notifications for new entries. Writes: Appends new clipboard entries to 'work/clip/history.txt', separated by ' ... '.

mail · send

Sample CLI

gway mail send

References

Signature

(subject, body=None, to=None, threaded=None, **kwargs)

Docstring

Send an email with the specified subject and body, using defaults from env if available. Parameters: - subject: the email subject (string) - body: the plain-text body (string). Must be provided. - to: recipient address (string). Defaults to ADMIN_EMAIL from the environment. - threaded: if True, send the email asynchronously; if False, block and send; if None, auto-detect. - **kwargs: reserved for future use. Returns: str ("Email sent successfully to ...") or error message, unless threaded is True (returns immediately).

Sample CLI

gway odoo execute-kw

References

Signature

(*args, model: str, method: str, **kwargs) -> dict

Docstring

A generic function to directly interface with Odoo's execute_kw method. Parameters: model (str): The Odoo model to interact with (e.g., 'sale.order'). method (str): The method to call on the model (e.g., 'read', 'write'). args (list): Positional arguments to pass to the method. kwargs (dict): Keyword arguments to pass to the method. Returns: dict: The result of the execute_kw call.

Sample CLI

gway sql load-csv

References

Signature

(*, connection=None, folder='data', force=False)

Docstring

Recursively loads CSVs from a folder into SQLite tables. Table names are derived from folder/file paths.

Sample CLI

gway sql open-connection

References

Signature

(datafile=None, *, sql_engine='sqlite', autoload=False, force=False, row_factory=False, **dbopts)

Docstring

Initialize or reuse a database connection. Caches connections by sql_engine, file path, and thread ID (if required). Starts writer thread for SQLite.


Sample CLI

gway ocpp.sink setup-sink-app

References

Signature

(*, app=None)

Docstring

Basic OCPP passive sink for messages, acting as a dummy CSMS server. This won't pass compliance or provide authentication. It just accepts and logs all. Note: This version of the app was tested at the EVCS with real EVs.



Sample CLI

gway web.app setup

References

Signature

(*, app=None, project='web.site', path=None, home: str = None, views: str = 'view', apis: str =
'api', static='static', shared='shared', css='global', js='global', auth_required=False,
engine='bottle')

Docstring

Setup Bottle web application with symmetrical static/shared public folders. Only one project per app. CSS/JS params are used as the only static includes.

Sample CLI

gway web.app template

Signature

(*args, **kwargs)

Docstring

Get a rendered template as a string iterator. You can use a name, a filename or a template string as first parameter. Template rendering arguments can be passed as dictionaries or directly (as keyword arguments).


Sample CLI

gway web.error unauthorized

Signature

(message='Unauthorized: You do not have access to this resource.', *, err=None, default=None)

Docstring

If in debug mode: show detailed error. If not in debug: return a 401 Unauthorized and a WWW-Authenticate header to trigger the browser auth dialog.

Sample CLI

gway web.error view-debug-error

References

Signature

(*, title='GWAY Debug Error', message='An error occurred.', err=None, status=500, default=None)

Docstring

Render a debug error view with detailed traceback and request info.


Sample CLI

gway web.server start-app

References

Signature

(*, host='[WEBSITE_HOST|127.0.0.1]', port='[WEBSITE_PORT|8888]', ws_port='[WEBSOCKET_PORT|9000]',
debug=False, proxy=None, app=None, daemon=True, threaded=True, is_worker=False, workers=None)

Docstring

Start an HTTP (WSGI) or ASGI server to host the given application. - If `app` is a FastAPI instance, runs with Uvicorn (optionally on ws_port if set). - If `app` is a WSGI app, uses Paste+ws4py or Bottle. - If `app` is a zero-arg factory, it will be invoked (supporting sync or async factories). - If `app` is a list of apps, each will be run in its own thread (each on an incremented port; FastAPI uses ws_port if set).

Sample CLI

gway run-recipe

References

Signature

(*script: str, **context)

Docstring

Run commands parsed from a .gwr file, falling back to the 'recipes/' resource bundle. Recipes are gway scripts composed of one command per line with optional comments.

Sample CLI

gway test

References

Signature

(*, root: str = 'tests', filter=None, project=None)

Docstring

Execute all automatically detected test suites, logging to logs/test.log.

TODOs

# TODO: Implement a 'project' mode. Instead of performing the hard-coded GWAY test # suite, run an abstract test battery against the project or collection of projects