From 78ac24f08673625335ec70f5b868817e98a80cd0 Mon Sep 17 00:00:00 2001 From: Edvard Rejthar Date: Tue, 29 Oct 2024 18:14:19 +0100 Subject: [PATCH] minimal installation #3 --- docs/index.md | 13 ++++++++++++- mininterface/__main__.py | 2 +- mininterface/textual_interface/__init__.py | 3 +-- pyproject.toml | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/index.md b/docs/index.md index 2dc2981..c4ddc2f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -96,11 +96,22 @@ Install with a single command from [PyPi](https://pypi.org/project/mininterface/ pip install mininterface ``` +## Minimal installation + +Should you need just the CLI part and you are happy with basic text dialogs, use these commands instead: + +```bash +pip install --no-dependencies mininterface +pip install tyro typing_extensions pyyaml +``` + # Docs See the docs overview at [https://cz-nic.github.io/mininterface/](https://cz-nic.github.io/mininterface/Overview/). # Examples +A powerful `.form` dialog method accepts either a dataclass or a dict. Take a look on both. + ## A complex dataclass. ```python3 @@ -143,7 +154,7 @@ print(m.env) m.form() ``` -As there is no default value at `mandatory_str`, you will be prompted automatically to fill up the field: +As the attribute `mandatory_str` requires a value, a prompt appears automatically: ![Complex example missing field](asset/complex_example_missing_field.avif) diff --git a/mininterface/__main__.py b/mininterface/__main__.py index 14af1c2..b05effc 100644 --- a/mininterface/__main__.py +++ b/mininterface/__main__.py @@ -25,7 +25,7 @@ def main(): result = [] # We tested both GuiInterface and TextualInterface are able to pass a variable to i.e. a bash script. # TextInterface fails (`mininterface --ask Test | grep Hello` – pipe causes no visible output). - with run(CliInteface, prog="Mininterface", description=__doc__, interface=TextualInterface) as m: + with run(CliInteface, prog="Mininterface", description=__doc__) as m: for method, label in vars(m.env).items(): if label: result.append(getattr(m, method)(label)) diff --git a/mininterface/textual_interface/__init__.py b/mininterface/textual_interface/__init__.py index b9b3fdb..05aa44e 100644 --- a/mininterface/textual_interface/__init__.py +++ b/mininterface/textual_interface/__init__.py @@ -1,4 +1,4 @@ -from typing import Any, Type +from typing import Type try: from textual.app import App as _ImportCheck @@ -12,7 +12,6 @@ from ..text_interface import TextInterface from .textual_adaptor import TextualAdaptor from .textual_button_app import TextualButtonApp -from .textual_facet import TextualFacet class TextualInterface(Redirectable, TextInterface): diff --git a/pyproject.toml b/pyproject.toml index 18215e2..1dcea43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,8 +15,8 @@ readme = "README.md" python = "^3.10" autocombobox = "1.4.2" tyro = "*" +typing_extensions = "*" pyyaml = "*" -requests = "*" textual = "~0.84" tkinter-tooltip = "*" tkinter_form = "0.1.5.2"