snap module¶
SnapPackage
¶
Detailed information about one installed snap package, as a SnapPackageInfo.
Commands:
snap info <package> 2>/dev/null || true
Returns:
SnapPackageInfo | None
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/snap/snap_snap_package.py.
SnapPackageInfo
¶
Attributes:
| Name | Type | Description |
|---|---|---|
name |
The snap's name (the |
|
publisher |
The publisher as snap prints it, verification glyph
included ( |
|
snap_id |
The snap's store id (the |
|
channel |
The tracked channel read from the |
|
version |
The installed version read from the |
SnapPackages
¶
The names of the installed snap packages.
Commands:
snap list 2>/dev/null || true
Returns:
list[str]
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/snap/snap_snap_packages.py.
package
async
¶
package(
ctx: OpContext,
packages: str
| list[str]
| tuple[str, ...]
| None = None,
channel: str = "latest/stable",
classic: bool = False,
present: bool = True,
**kwargs: Any,
) -> AsyncGenerator[Command]
Install, remove or re-channel snap packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
OpContext
|
Execution context for the operation. |
required |
packages
|
str | list[str] | tuple[str, ...] | None
|
Snaps
to ensure. Prefer tuples when building requests via |
None
|
channel
|
str
|
The tracking channel to install on or switch
an installed snap to. Defaults to |
'latest/stable'
|
classic
|
bool
|
Whether to install with |
False
|
present
|
bool
|
Whether the snaps should be installed. Defaults to True. |
True
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Yields:
| Name | Type | Description |
|---|---|---|
Command |
AsyncGenerator[Command]
|
Generated snap package commands. |
Raises:
HostConnectionError
Examples:
Examples can be found in examples/modules/snap/snap_package.py.