Skip to content

Commit

Permalink
build: make dependency on Click optional
Browse files Browse the repository at this point in the history
  • Loading branch information
matejcik committed May 15, 2024
1 parent 4091710 commit fe18019
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Added
- Added BIP32 master extended private key to test vectors.
- Added support for extendable backup flag.

Changed
~~~~~~~
- Dependency on `click` is now optional. In order to use the CLI tool, install the `cli`
extra. For example, `pip install shamir-mnemonic[cli]`.

Removed
~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ not be used for handling sensitive secrets**.
Installation
------------

With pip from GitHub:
With pip from PyPI:

.. code-block:: console
$ pip3 install shamir-mnemonic
$ pip3 install shamir-mnemonic[cli] # for CLI tool
From local checkout for development:

Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ readme = [

[tool.poetry.dependencies]
python = ">=3.6,<4.0"
click = ">=7,<9"
dataclasses = { version = "*", python = "<=3.6" }
click = { version = ">=7,<9", optional = true }

[tool.poetry.group.dev.dependencies]
bip32utils = "^0.3.post4"
pytest = "*"
black = ">=20"
isort = "^5"

[tool.poetry.extras]
cli = ["click"]

[tool.poetry.scripts]
shamir = "shamir_mnemonic.cli:cli"

Expand Down
10 changes: 8 additions & 2 deletions shamir_mnemonic/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
import sys
from typing import Sequence, Tuple

import click
from click import style
try:
import click
from click import style

except ImportError:
print("Required dependencies are missing. Install them with:")
print(" pip install shamir_mnemonic[cli]")
sys.exit(1)

from .recovery import RecoveryState
from .shamir import generate_mnemonics
Expand Down

0 comments on commit fe18019

Please sign in to comment.