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 16, 2024
1 parent 4091710 commit 08bbb74
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,27 @@ The format is based on `Keep a Changelog`_, and this project adheres to
`0.3.0`_ - 2024-05-15
---------------------

Incompatible
~~~~~~~~~~~~

- The `shamir` command no longer works out of the box. It is necessary to install the
`cli` extra while installing the package. See README for instructions.

Added
~~~~~

- Added BIP32 master extended private key to test vectors.
- Added support for extendable backup flag.

Changed
~~~~~~~

- The `shamir_mnemonic` package now has zero extra dependencies on Python 3.7 and up,
making it more suitable as a dependency of other projects.
- The `shamir` CLI still requires `click`. A new extra `cli` was introduced to handle
this dependency. Use the command `pip install shamir-mnemonic[cli]` to install the CLI
dependencies along with the package.

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 08bbb74

Please sign in to comment.