diff --git a/.gitignore b/.gitignore index 181bcd4..bf8175e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ __pycache__ *.swp *.py[co] +poetry.lock diff --git a/Makefile b/Makefile index fe4f383..a0a8456 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,12 @@ PYTHON=python3 -SETUP=$(PYTHON) setup.py +POETRY=poetry build: - $(SETUP) build + $(POETRY) build install: - $(SETUP) install - -dist: clean - $(SETUP) sdist - $(SETUP) bdist_wheel + $(POETRY) install clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts @@ -42,7 +38,7 @@ style_check: style: black shamir_mnemonic/ *.py - isort -y --recursive shamir_mnemonic/ *.py + isort shamir_mnemonic/ *.py -.PHONY: dist clean clean-build clean-pyc clean-test test style_check style +.PHONY: clean clean-build clean-pyc clean-test test style_check style diff --git a/README.rst b/README.rst index 90720be..58aafce 100644 --- a/README.rst +++ b/README.rst @@ -43,9 +43,16 @@ With pip from GitHub: From local checkout for development: +Install the [Poetry](https://python-poetry.org/) tool, checkout +`python-shamir-mnemonic` from git, and enter the poetry shell: + .. code-block:: console - $ python3 setup.py develop + $ pip3 install poetry + $ git clone https://github.com/trezor/python-shamir-mnemonic + $ cd python-shamir-mnemonic + $ poetry install + $ poetry shell CLI usage --------- diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d0de57b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[tool.poetry] +name = "shamir-mnemonic" +version = "0.2.3" +description = "SLIP-39 Shamir Mnemonics" +authors = ["Trezor "] +license = "MIT" +readme = [ + "README.rst", + "CHANGELOG.rst", +] + +[tool.poetry.dependencies] +python = ">=3.8.1" +click = ">=7,<9" + +[tool.poetry.group.dev.dependencies] +bip32utils = "^0.3.post4" +pytest = "^6.1.0" +black = ">=24.2" +flake8 = "*" +isort = "^5" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/setup.py b/setup.py deleted file mode 100644 index ff39d82..0000000 --- a/setup.py +++ /dev/null @@ -1,53 +0,0 @@ -from pathlib import Path - -from setuptools import setup - -# fmt: off -REQUIREMENTS = [ - "attrs", - "click>=7,<9", - "colorama", -] -EXTRA_REQUIREMENTS = { - "dev": [ - "black", - "flake8", - "isort" - ], - "tests": [ - "pytest" - ] -} -# fmt: on - -CWD = Path(__file__).resolve().parent - - -setup( - name="shamir-mnemonic", - version="0.2.2", - description="SLIP-39 Shamir Mnemonics", - long_description="\n".join( - ( - (CWD / "README.rst").read_text(), - (CWD / "CHANGELOG.rst").read_text(), - ) - ), - url="https://github.com/trezor/python-shamir-mnemonic", - author="Satoshi Labs", - author_email="info@satoshilabs.com", - packages=["shamir_mnemonic"], - python_requires=">=3.6", - install_requires=REQUIREMENTS, - extras_require=EXTRA_REQUIREMENTS, - package_data={"shamir_mnemonic": ["wordlist.txt"]}, - entry_points={"console_scripts": ["shamir=shamir_mnemonic.cli:cli"]}, - classifiers=[ - "License :: OSI Approved :: MIT License", - "Operating System :: POSIX :: Linux", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS :: MacOS X", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3 :: Only", - ], -) diff --git a/shamir_mnemonic/constants.py b/shamir_mnemonic/constants.py index 7f4da44..7600844 100644 --- a/shamir_mnemonic/constants.py +++ b/shamir_mnemonic/constants.py @@ -3,7 +3,7 @@ RADIX_BITS = 10 """The length of the radix in bits.""" -RADIX = 2 ** RADIX_BITS +RADIX = 2**RADIX_BITS """The number of words in the wordlist.""" ID_LENGTH_BITS = 15