Skip to content

Commit

Permalink
minimal installation #3
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed Oct 29, 2024
2 parents 255aa7a + a4e75c4 commit 994fbc1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
13 changes: 12 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion mininterface/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions mininterface/textual_interface/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Type
from typing import Type

try:
from textual.app import App as _ImportCheck
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 994fbc1

Please sign in to comment.