conda_tui package#

Subpackages#

Submodules#

conda_tui.app module#

class conda_tui.app.CondaTUI(driver_class=None, css_path=None, watch_css=False)[source]#

Bases: App

A hacked-together Conda Text User Interface (TUI).

BINDINGS: ClassVar[list[BindingType]] = [('h', "switch_screen('home')", 'Home'), ('e', "switch_screen('environments')", 'Environments'), ('i', "run_command(['conda', 'info'])", 'Info'), ('q', 'quit', 'Quit'), ('?', "run_command(['conda', '-h'])", 'Help')]#
CSS_PATH: ClassVar[CSSPathType | None] = PosixPath('styles.css')#

File paths to load CSS from.

SCREENS: ClassVar[dict[str, Screen | Callable[[], Screen]]] = {'environments': EnvironmentScreen(), 'home': HomeScreen(), 'package_list': PackageListScreen()}#

Screens associated with the app for the lifetime of the app.

TITLE: str | None = 'conda-tui'#

A class variable to set the default title for the application.

To update the title while the app is running, you can set the [title][textual.app.App.title] attribute

action_run_command(command)[source]#
Return type:

None

on_mount()[source]#

When we start up, push the home screen.

This allows us to use switch_screen to switch between the various views without having an infinitely-growing screen stack.

Return type:

None

conda_tui.app.conda_subcommands()[source]#
conda_tui.app.run(argv=None)[source]#

Run the application.

Return type:

None

conda_tui.environment module#

class conda_tui.environment.Environment(prefix)[source]#

Bases: object

property name: str#

The name of the conda environment, if it is named. Otherwise, an empty string.

prefix: Path#
property relative_path: Path#
conda_tui.environment.list_environments(sort=True)[source]#

Get a list of conda environments installed on local machine.

Parameters:

sort (bool) – If True, the list will be sorted alphabetically, with named environments appearing first, followed by path-based environments.

Return type:

list[Environment]

conda_tui.package module#

class conda_tui.package.Package(record)[source]#

Bases: object

Wrap a conda PrefixRecord, and supplement with custom attributes.

property description: str#

Attempt to load the package description.

property status: Text#
property update_available: bool | None#

True if update is available. If None, update status is unknown.

conda_tui.package.list_packages_for_environment(env)[source]#
Return type:

list[Package]

conda_tui.screens module#

class conda_tui.screens.EnvironmentScreen(name=None, id=None, classes=None)[source]#

Bases: Screen

A screen displaying a list of all conda environments on the system.

can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Return type:

Iterable[Widget]

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

environments: list[Environment]#
on_data_table_row_selected(event)[source]#

When we select a specific item on the list view, open the package list screen and set the environment reactive variable on that view.

Return type:

None

on_mount()[source]#
Return type:

None

class conda_tui.screens.HomeScreen(name=None, id=None, classes=None)[source]#

Bases: Screen

The home screen, displaying some helpful welcome text and the conda logo.

can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Return type:

Iterable[Widget]

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

class conda_tui.screens.PackageDetailScreen(*args, package, **kwargs)[source]#

Bases: Screen

A screen to display the details of a package.

BINDINGS: ClassVar[list[BindingType]] = [('escape', 'go_back', 'Back')]#
action_go_back()[source]#
can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Return type:

Iterable[Widget]

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

class conda_tui.screens.PackageListScreen(name=None, id=None, classes=None)[source]#

Bases: Screen

A screen to display the packages installed into a specific environment.

BINDINGS: ClassVar[list[BindingType]] = [('escape', 'go_back', 'Back'), ('u', 'update_package', 'Update'), ('s', 'show_available_updates', 'Show Available Updates')]#
action_go_back()[source]#
Return type:

None

action_show_available_updates()[source]#
Return type:

None

action_update_package()[source]#

Launch a new screen to display package update progress.

can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Return type:

Iterable[Widget]

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

environment#

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

on_data_table_row_selected(event)[source]#

Push a new package detail screen when a package is selected.

Return type:

None

on_screen_resume()[source]#
Return type:

None

packages: list[Package]#
async refresh_package_statuses()[source]#

Call conda in the background to get update results, and update the statuses in the table.

class conda_tui.screens.PackageUpdateScreen(*args, package, **kwargs)[source]#

Bases: Screen

BINDINGS: ClassVar[list[BindingType]] = [('escape', 'go_back', 'Back')]#
action_go_back()[source]#
can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Return type:

Iterable[Widget]

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

class conda_tui.screens.Screen(name=None, id=None, classes=None)[source]#

Bases: Screen

A base screen class, used for wrapping a subclass with a header and footer.

can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Return type:

Iterable[Widget]

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

header_text: str#

Create a reactive attribute.

Parameters:
  • default – A default value or callable that returns a default.

  • layout – Perform a layout on change.

  • repaint – Perform a repaint on change.

  • init – Call watchers on initialize (post mount).

  • always_update – Call watchers even when the new value equals the old value.

on_mount()[source]#
watch_header_text(value)[source]#
Return type:

None

class conda_tui.screens.ShellCommandScreen(command, **kwargs)[source]#

Bases: Screen

BINDINGS: ClassVar[list[BindingType]] = [('escape', 'go_back', 'Back')]#
action_go_back()[source]#
can_focus: bool = False#

Widget may receive focus.

can_focus_children: bool = True#

Widget’s children may receive focus.

compose()[source]#

Called by Textual to create child widgets.

Extend this to build a UI.

Return type:

Iterable[Widget]

Example

```python def compose(self) -> ComposeResult:

yield Header() yield Container(

Tree(), Viewer()

) yield Footer()

```

on_screen_resume()[source]#
Return type:

None

Module contents#