Sample CLI
gway awg view-cable-finder
Signature
(*, meters=None, amps='40', volts='220', material='cu', max_lines='3', phases='1', conduit=None,
neutral='0', **kwargs)
Docstring
Page builder for AWG cable finder with HTML form and result.
TODOs
# TODO: Add a image with the sponsor logo on the right side of the result page
Sample CLI
gway cdv credit
Signature
(table_path: str, entry: str, *, field: str = 'balance', **kwargs) -> bool
Docstring
Add 1 (or amount from kwargs) to the given field for a record.
Signature
(table_path: str, entry: str, *, field: str = 'balance', **kwargs) -> bool
Docstring
Subtract 1 (or amount from kwargs) from the given field for a record.
Sample CLI
gway cdv load-all
Signature
(pathlike: str) -> dict[str, dict[str, str]]
Docstring
Load CDV table with ID followed by colon-separated key=value fields.
Sample CLI
gway cdv validate
Signature
(table_path: str, entry: str, *, validator=None) -> bool
Docstring
Validate a CDV entry by ID directly from file.
Always reloads the file from disk to avoid stale data.
Sample CLI
gway clip track-history
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 '
...
'.
Sample CLI
gway clock to-download
Docstring
Prompt: Create a python function that takes a file size such as 100 MB or 1.76 GB
(pick a wide array of units) and then calculates the possible time to download
it within 4 ranges. You choose the ranges logarithmically. Then, perform a quick
check against google to let the user know what their current range is.
Sample CLI
gway conway load-board
Docstring
Load the board from disk, or create one if missing.
Sample CLI
gway conway view-game-of-life
Signature
(*args, action=None, board=None, toggle_x=None, toggle_y=None, **kwargs)
Sample CLI
gway etron extract-records
Signature
(location, *, add_days=0, after=None, before=None, batch=None)
Docstring
Load data from EV IOCHARGER .json files to CSV format.
> gway etron extract_records san-pedro
> gway etron extract_records calzada-del-valle
> gway etron extract_records porsche-centre
This assumes the files are at work/etron/records/<location>.
Sample CLI
gway mail search
Signature
(subject_fragment, body_fragment=None)
Docstring
Search emails by subject and optionally body. Use "*" to match any subject.
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 mtg search
Signature
(query, *, show=True, limit=5, **kwargs)
Docstring
Search for Magic: The Gathering cards using Scryfall API.
Parameters:
query (str): The search query (name, text, type, etc.)
show (bool): If True, print the card(s) info; else, return the results.
**kwargs: Extra parameters for the Scryfall search API.
Returns:
list of dict: List of matching card data dicts if show=False.
None: If show=True (prints results directly).
Sample CLI
gway odoo create-quote
Signature
(*, customer, template_id, validity=None, notes=None)
Docstring
Create a new quotation using a specified template and customer name.
Parameters:
customer (str): The name (or partial name) of the customer to link to the quote.
template_id (int): The ID of the quotation template to use.
validity (str, optional): The expiration date for the quote in 'YYYY-MM-DD' format.
notes (str, optional): Internal notes or message to include in the quote.
Returns:
dict: The created quotation details.
Sample CLI
gway odoo execute-kw
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 odoo fetch-customers
Signature
(*, name=None, email=None, phone=None, country=None, latest_quotes=None, **kwargs)
Docstring
Fetch customers from Odoo with optional filters.
Parameters:
name (str, optional): Filter customers by their name or part of it.
email (str, optional): Filter customers by their email address or part of it.
phone (str, optional): Filter customers by their phone number or part of it.
country (str, optional): Filter customers by their country name or part of it.
**kwargs: Additional filters to be applied, passed as key-value pairs.
Returns:
dict: The fetched customers.
TODOs
# TODO: If latest_quotes is a number, also fetch the many latest quotes for this customer.
Sample CLI
gway odoo fetch-quotes
Signature
(*, state='draft', older_than=None, salesperson=None, customer=None, **kwargs)
Docstring
Fetch quotes/quotations from Odoo with optional filters.
Parameters:
state (str): Filter quotations by their state. Default is 'draft'.
older_than (int, optional): Filter quotations older than a specific number of days.
salesperson (str, optional): Filter quotations by the salesperson's name or part of it.
customer (str, optional): Filter quotations by the customer's name or part of it.
kwargs (list, optional): Additional domain filters for the query.
Returns:
dict: The fetched quotations.
Sample CLI
gway odoo fetch-templates
Signature
(*, name=None, active=True, **kwargs)
Docstring
Fetch available quotation templates from Odoo with optional filters.
Parameters:
name (str, optional): Filter templates by name or part of it.
active (bool): Whether to include only active templates. Defaults to True.
**kwargs: Additional filters as key-value pairs.
Returns:
dict: The fetched quotation templates.
Sample CLI
gway odoo find-quotes
Signature
(*, product, quantity: int = 1, state: str = 'draft', **kwargs)
Docstring
Find all sale quotes that contain a given product (by id or name substring) with at least the given quantity.
Parameters:
product (str or int): Product ID or partial name.
quantity (int): Minimum quantity of the product in the quote. Default is 1.
state (str): Odoo sale order state (default: 'draft' for quotations).
**kwargs: Additional domain filters for sale.order.
Returns:
list: List of matching sale orders (quotes) with product line details.
Sample CLI
gway odoo setup-chatbot-app
Signature
(*, path='/chatbot', username='[ODOO_USERNAME]', alias='Operator', apps=None)
Docstring
Create a FastAPI app (or append to existing ones) serving a chatbot UI and logic.
Sample CLI
gway qr scan-img
Docstring
Scan the given image (file‑path or PIL.Image) for QR codes and return
a list of decoded string values. Returns [] if nothing’s found.
Sample CLI
gway release build
Signature
(*, bump: bool = False, dist: bool = False, twine: bool = False, help_db: bool = True, projects:
bool = False, git: bool = False, all: bool = False, force: bool = False) -> None
Docstring
Build the project and optionally upload to PyPI.
Args:
bump (bool): Increment patch version if True.
dist (bool): Build distribution package if True.
twine (bool): Upload to PyPI if True.
force (bool): Skip version-exists check on PyPI if True.
git (bool): Require a clean git repo and commit/push after release if True.
vscode (bool): Build the vscode extension.
Sample CLI
gway release build-help-db
Sample CLI
gway release changes
Signature
(*, files=None, staged=False, context=3, max_bytes=200000, clip=False)
Docstring
Returns a unified diff of all recent textual changes in the git repo.
- Shows added/removed lines (ignores binary files).
- Includes unstaged (working directory) by default. Use staged=True to see only staged.
- 'files': Optionally filter by path(s) or file glob(s).
- 'context': Number of context lines in the diff (default 3).
- 'max_bytes': Truncate diff if too large (default 200,000).
Sample CLI
gway release loc
Docstring
Counts Python lines of code in the given directories, ignoring hidden files and directories.
Defaults to everything in the current GWAY release.
Sample CLI
gway screen lookup-font
Docstring
Look up fonts installed on a Windows system by partial name (prefix).
>> gway font lookup Ari
Sample CLI
gway screen notify
Signature
(message, *, title='GWAY Notice', timeout: int = 10)
Docstring
Show a user interface notification with the specified title and message.
Falls back to a visible console printout if GUI notification fails.
Sample CLI
gway screen reminder
Signature
(message, *, interval: float = 20.0, daemon=False, lines: int = 2)
Docstring
Starts a thread that periodically takes screenshots.
If the screen hasn't changed between intervals, overlays a reminder
message and waits for user interaction before resuming.
Sample CLI
gway screen shot
Signature
(*, name: str = None, mode: str = 'full') -> str
Docstring
Take a screenshot in the specified mode and save it under:
gw.resource("work", "screenshots")
The filename will be:
<active_window_name>_<YYYYMMDD_HHMMSS>.png
Returns:
The full path to the saved screenshot file.
Modes:
- "full": entire screen
- "active"/"window": active window only (Windows only; falls back to full)
Sample CLI
gway sql close-connection
Signature
(datafile=None, *, sql_engine='sqlite', all=False)
Docstring
Explicitly close one or all cached database connections.
Shuts down writer thread if all connections closed.
Sample CLI
gway sql load-csv
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 shutdown-writer
Docstring
Signal writer thread to exit and wait for it to finish.
Sample CLI
gway vbox open-remote
Signature
(server_url: str = '[SERVER_URL]', *, path: str = 'vbox', email: str = '[ADMIN_EMAIL]')
Docstring
Create a vbox on a remote system, retrieve the upload link from email, and store it locally.
- server_url: Base URL of the remote server (e.g., 'https://example.com')
- path: Path on remote server where vbox upload is handled (default 'vbox')
- email: Email address to receive the upload link (should be accessible by local mail.search)
Returns: dict of stored record fields, or None if unsuccessful.
Sample CLI
gway vbox poll-remote
Signature
(server_url: str = '[SERVER_URL]', *, target='work/vbox/remote', interval=3600)
Docstring
Poll the remote vbox for files and download new/updated ones to the local target directory.
- server_url: Remote GWAY instance base URL
- target: Local directory to save downloaded files
- interval: Seconds between polls (runs forever unless interval=None)
Skips files already downloaded by using the modified_since parameter.
Sample CLI
gway vbox purge
Docstring
Manually purge expired vbox entries and remove their folders.
Args:
all (bool): If True, delete all folders, even non-empty ones and those not in _open_boxes.
Sample CLI
gway vbox view-downloads
Signature
(*hashes: tuple[str], vbid: str = None, modified_since=None, **kwargs)
Docstring
GET: Show list of files in the box (with hash), allow selection/downloads.
If a single hash is provided, return that file. Multiple hashes are not supported yet.
- Allows access via full vbid (short.long) or short-only (just the folder name).
- If full vbid is used, shows link to upload more files.
- If modified_since is passed (as iso or epoch seconds), only send file if newer, else 304.
TODOs
# TODO: Support multiple hashes by checking them one by one. If the first doesn't exist,
# try the next and so forth. Give up when every hash fails to match. First matches is chosen first.
Sample CLI
gway vbox view-uploads
References
build_url,
error,
exception,
info,
mail,
mail.send,
resource,
warning,
web,
web.app,
web.app.build_url,
web.server,
web.server.is_local Signature
(*, vbid: str = None, timeout: int = 60, files: int = 4, email: str = None, **kwargs)
Docstring
GET: Display upload interface or create a new upload box.
POST: Handle uploaded files to a specific vbid.
Sample CLI
gway ocpp.csms authorize-balance
Docstring
Default OCPP RFID secondary validator: Only authorize if balance >= 1.
The RFID needs to exist already for this to be called in the first place.
Sample CLI
gway ocpp.csms extract-meter
Docstring
Return the latest Energy.Active.Import.Register (kWh) from MeterValues or meterStop.
Sample CLI
gway ocpp.csms power-consumed
Docstring
Calculate power consumed in kWh from transaction's meter values (Energy.Active.Import.Register).
Sample CLI
gway ocpp.csms setup-app
References
cdv,
cdv.validate,
debug,
error,
exception,
info,
mail,
mail.send,
resolve,
resource,
unwrap_one,
warn Signature
(*, app=None, allowlist=None, denylist=None, location=None, authorize=<function authorize_balance at
0x00000256F2C3F1A0>, email=None)
Sample CLI
gway ocpp.csms view-charger-status
Signature
(*, action=None, charger_id=None, **_)
Docstring
Card-based OCPP dashboard: summary of all charger connections.
Sample CLI
gway ocpp.evcs parse-repeat
Docstring
Handle repeat=True/'forever'/n logic.
Sample CLI
gway ocpp.evcs simulate
Signature
(*, host: str = '[WEBSITE_HOST|127.0.0.1]', ws_port: int = '[WEBSOCKET_PORT|9000]', rfid: str =
'FFFFFFFF', cp_path: str = 'CPX', duration: int = 60, repeat=False, threads: int = None, daemon:
bool = True)
Docstring
Flexible OCPP charger simulator.
- daemon=False: blocking, always returns after all runs.
- daemon=True: returns a coroutine for orchestration, user is responsible for awaiting/cancelling.
- threads: None/1 for one session; >1 to simulate multiple charge points.
Sample CLI
gway ocpp.evcs simulate-cp
Signature
(cp_idx, host, ws_port, rfid, cp_path, duration, session_count)
Docstring
Simulate a single CP session (possibly many times if session_count>1).
Sample CLI
gway ocpp.sink setup-sink-app
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 render-template
Signature
(*, title='GWAY', content='', css_files=None, js_files=None)
Sample CLI
gway web.app setup
References
abort,
context,
debug,
info,
resource,
to_html,
to_json,
unwrap_one,
verbose,
version,
web,
web.auth,
web.auth.is_authorized,
web.error,
web.error.redirect,
web.error.unauthorized 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 urlencode
Signature
(query, doseq=False, safe='', encoding=None, errors=None, quote_via=<function quote_plus at
0x00000256EF81D940>)
Docstring
Encode a dict or sequence of two-element tuples into a URL query string.
If any values in the query arg are sequences and doseq is true, each
sequence element is converted to a separate parameter.
If the query arg is a sequence of two-element tuples, the order of the
parameters in the output will match the order of parameters in the
input.
The components of a query arg may each be either a string or a bytes type.
The safe, encoding, and errors parameters are passed down to the function
specified by quote_via (encoding and errors only if a component is a str).
Sample CLI
gway web.cookies view-cookie-jar
Sample CLI
gway web.cookies view-my-mask
Signature
(*, claim=None, set_mask=None)
Docstring
View and manage mask linking for cookies.
- GET: Shows current mask and allows claim or update.
- POST (claim/set_mask): Claim a mask and save/load cookies to/from masks.cdv.
If user claims an existing mask AND already has a mask cookie,
ALL existing cookies (except cookies_accepted) are wiped before restoring the claimed mask.
No wipe is performed when creating a new mask.
Sample CLI
gway web.error view-debug-error
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.nav render
Docstring
Renders the sidebar navigation including search, home links, visited links, and a QR compass.
Sample CLI
gway web.nav view-style-switcher
Signature
(*, css=None, project=None)
Docstring
Shows available styles (global + project), lets user choose, preview, and see raw CSS.
If cookies are accepted, sets the style via cookie when changed in dropdown.
If cookies are not accepted, only uses the css param for preview.
Sample CLI
gway web.server is-local
Signature
(request=None, host=None)
Docstring
Returns True if the active HTTP request originates from the same machine
that the server is running on (i.e., local request). Supports both
Bottle and FastAPI (ASGI/WSGI).
Args:
request: Optionally, the request object (Bottle, Starlette, or FastAPI Request).
host: Optionally, the bound host (for override or testing).
Returns:
bool: True if request is from localhost, else False.
Sample CLI
gway web.server iterable
Docstring
Check whether or not an object can be iterated over.
Parameters
----------
y : object
Input object.
Returns
-------
b : bool
Return ``True`` if the object has an iterator method or is a
sequence and ``False`` otherwise.
Examples
--------
>>> import numpy as np
>>> np.iterable([1, 2, 3])
True
>>> np.iterable(2)
False
Notes
-----
In most cases, the results of ``np.iterable(obj)`` are consistent with
``isinstance(obj, collections.abc.Iterable)``. One notable exception is
the treatment of 0-dimensional arrays::
>>> from collections.abc import Iterable
>>> a = np.array(1.0) # 0-dimensional numpy array
>>> isinstance(a, Iterable)
True
>>> np.iterable(a)
False
Sample CLI
gway web.server start-app
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).
Signature
(*args, **kwargs)
Docstring
Build a fully-qualified context-aware URL given a path sequence and query params.
Sample CLI
gway build-ws-url
Signature
(*args, **kwargs)
Docstring
Build a fully-qualified context-aware URL given a path sequence and query params.
Sample CLI
gway infer-type
Signature
(value, default=None, **types)
Docstring
Try casting `value` to each provided type. If a cast succeeds,
returns the corresponding key (name). If none succeed, returns default.
Example:
gw.infer_type("42", INTEGER=int, REAL=float) # => "INTEGER"
gw.infer_type("hello", INTEGER=int, default="TEXT") # => "TEXT"
Signature
(*parts, touch=False, check=False, text=False, dir=False)
Docstring
Locate or create a resource by searching in:
1. Current working directory
2. GWAY_ROOT environment variable
3. User home directory
If not found, returns the path in the CWD (which may not exist) unless check=True, in which case aborts.
Arguments:
- touch: if True, create the file (and parents) if it does not exist.
- dir: if True, create the final path as a directory, not a file.
- text: if True, return file contents as text, not a Path.
- check: if True, abort if resource does not exist.
TODOs
# TODO: Consider if we should also be compatible with BASE_PATH and GWAY_PATH
# 2. GWAY_ROOT env
Sample CLI
gway run-recipe
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.
Docstring
Launch an interactive Python shell with 'from gway import gw' preloaded.