Metadata-Version: 2.4
Name: trezor
Version: 0.20.0
Summary: Python library for communicating with Trezor Hardware Wallet
Project-URL: Homepage, https://github.com/trezor/trezor-firmware/tree/main/python
Project-URL: Repository, https://github.com/trezor/trezor-firmware
Project-URL: Documentation, https://github.com/trezor/trezor-firmware/tree/main/python
Author-email: Trezor <info@trezor.io>
Maintainer-email: matejcik <jan.matejek@satoshilabs.com>
License-Expression: LGPL-3.0-only
License-File: COPYING
Keywords: bitcoin,cryptocurrency,ethereum,hardware,trezor,wallet
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Requires-Dist: click<9,>=8
Requires-Dist: construct!=2.10.55,>=2.9
Requires-Dist: construct-classes>=0.1.2
Requires-Dist: cryptography>=41
Requires-Dist: keyring>=25.7.0
Requires-Dist: libusb1>=1.6.4
Requires-Dist: mnemonic>=0.20
Requires-Dist: noiseprotocol<0.4.0,>=0.3.1
Requires-Dist: platformdirs>=4.4.0
Requires-Dist: requests>=2.4.0
Requires-Dist: shamir-mnemonic>=0.3.0
Requires-Dist: slip10>=1.0.1
Requires-Dist: typing-extensions>=4.7.1
Provides-Extra: ble
Requires-Dist: bleak>=1.1.0; extra == 'ble'
Provides-Extra: ethereum
Requires-Dist: web3>=5; extra == 'ethereum'
Provides-Extra: extra
Requires-Dist: pillow>=10; extra == 'extra'
Provides-Extra: full
Requires-Dist: bleak>=1.1.0; extra == 'full'
Requires-Dist: hidapi>=0.7.99.post20; extra == 'full'
Requires-Dist: pillow>=10; extra == 'full'
Requires-Dist: pyqt5; extra == 'full'
Requires-Dist: stellar-sdk>=6; extra == 'full'
Requires-Dist: web3>=5; extra == 'full'
Provides-Extra: hidapi
Requires-Dist: hidapi>=0.7.99.post20; extra == 'hidapi'
Provides-Extra: qt-widgets
Requires-Dist: pyqt5; extra == 'qt-widgets'
Provides-Extra: stellar
Requires-Dist: stellar-sdk>=6; extra == 'stellar'
Description-Content-Type: text/markdown

# trezorlib

[![repology](https://repology.org/badge/tiny-repos/python:trezor.svg)](https://repology.org/metapackage/python:trezor) [![image](https://badges.gitter.im/trezor/community.svg)](https://gitter.im/trezor/community)

Python library and command-line client for communicating with Trezor
Hardware Wallet.

See <https://trezor.io> for more information.

## Install

Python Trezor tools require Python 3.9 or higher, and libusb 1.0. The easiest
way to install it is with `pip`. The rest of this guide assumes you have
a working `pip`; if not, you can refer to [this
guide](https://packaging.python.org/tutorials/installing-packages/).

On a typical system, you already have all you need. Install `trezor` with:

```sh
pip3 install trezor
```

On Windows, you also need to either install [Trezor Bridge](https://suite.trezor.io/web/bridge/), or
[libusb](https://github.com/libusb/libusb/wiki/Windows) and the appropriate
[drivers](https://zadig.akeo.ie/).

### Firmware version requirements

Current trezorlib version supports Trezor One version 1.8.0 and up, Trezor T version
2.1.0 and up, and all versions of the Trezor Safe family.

For firmware versions below 1.8.0 and 2.1.0 respectively, the only supported operation
is "upgrade firmware".

Trezor One with firmware _older than 1.7.0_ and bootloader _older than 1.6.0_
(including pre-2021 fresh-out-of-the-box units) will not be recognized, unless
you install HIDAPI support (see below).

### Installation options

* **Bluetooth**: To support connecting to T3W1 or later models via Bluetooth,
  additional dependencies are needed. Install with:

  ```sh
  pip3 install trezor[ble]
  ```

* **Ethereum**: To support Ethereum signing from command line, additional packages are
  needed. Install with:

  ```sh
  pip3 install trezor[ethereum]
  ```

* **Stellar**: To support Stellar signing from command line, additional packages are
  needed. Install with:

  ```sh
  pip3 install trezor[stellar]
  ```

* **Firmware-less Trezor One**: If you are setting up a brand new Trezor One
  manufactured before 2021 (with pre-installed bootloader older than 1.6.0), you will
  need HIDAPI support. On Linux, you will need the following packages (or their
  equivalents) as prerequisites: `python3-dev`, `cython3`, `libusb-1.0-0-dev`,
  `libudev-dev`.

  Install with:

  ```sh
  pip3 install trezor[hidapi]
  ```

To install all four, use `pip3 install trezor[ble,hidapi,ethereum,stellar]`.

### Distro packages

Check out [Repology](https://repology.org/metapackage/python:trezor) to see if your
operating system has an up-to-date python-trezor package.

### Running from source

Install the [uv](https://docs.astral.sh/uv/) tool, checkout `trezor-firmware` from git,
and activate the uv environment:

```sh
git clone https://github.com/trezor/trezor-firmware
cd trezor-firmware
git submodule update --init --recursive
uv sync
source .venv/bin/activate
```

In this environment, trezorlib and the `trezorctl` tool is running from the live
sources, so your changes are immediately effective.

## Command line client (trezorctl)

The included `trezorctl` python script can perform various tasks such as
changing setting in the Trezor, signing transactions, retrieving account
info and addresses. See the
[python/docs/](https://github.com/trezor/trezor-firmware/tree/main/python/docs)
sub folder for detailed examples and options.

NOTE: An older version of the `trezorctl` command is [available for
Debian Stretch](https://packages.debian.org/en/stretch/python-trezor)
(and comes pre-installed on [Tails OS](https://tails.boum.org/)).

## Python Library

You can use this python library to interact with a Trezor and use its capabilities in
your application. See examples here in the
[tools/](https://github.com/trezor/trezor-firmware/tree/main/python/tools)
sub folder.

## Changelog

Visit [CHANGELOG.md] for the latest changes.

[CHANGELOG.md]: https://github.com/trezor/trezor-firmware/blob/main/python/CHANGELOG.md

## Contributing

If you want to change protobuf definitions, you will need to regenerate definitions in
the `python/` subdirectory.

First, make sure your submodules are up-to-date with:

```sh
git submodule update --init --recursive
```

Then, rebuild the protobuf messages by running, from the `trezor-firmware` top-level
directory:

```sh
make gen
```
