Skip to content

Conversation

@willianpaixao
Copy link
Contributor

Summary

This PR adds a command-line interface to the python-mnemonic library, making it easy to generate, validate, and derive seeds from BIP-39 mnemonic phrases directly from the terminal.

New Commands

  • mnemonic create - Generate a new mnemonic phrase and its derived seed

    • -l, --language - Wordlist language (default: english)
    • -s, --strength - Entropy bits: 128, 160, 192, 224, or 256 (default: 128)
    • -p, --passphrase - Optional passphrase for seed derivation
  • mnemonic check - Validate a mnemonic phrase's checksum

    • -l, --language - Wordlist language (auto-detected if not specified)
    • Accepts words as arguments or via stdin
    • Exit code 0 for valid, 1 for invalid
  • mnemonic to-seed - Derive a 64-byte seed from a mnemonic phrase

    • -p, --passphrase - Optional passphrase for seed derivation
    • Accepts words as arguments or via stdin
    • Outputs seed in hexadecimal format

Usage Examples

# Generate a new mnemonic
mnemonic create
mnemonic create -s 256 -l english -p "my passphrase"

# Validate a mnemonic
mnemonic check word1 word2 word3 ...
echo "word1 word2 ..." | mnemonic check

# Derive seed
mnemonic to-seed word1 word2 word3 ...
echo "word1 word2 ..." | mnemonic to-seed -p "passphrase"

Test Plan

  • mnemonic create generates valid mnemonic and seed
  • mnemonic check returns exit 0 for valid mnemonic
  • mnemonic check returns exit 1 for invalid mnemonic
  • mnemonic to-seed outputs correct seed in hex format
  • Stdin input works for check and to-seed
  • Language auto-detection works in check
  • All existing tests pass
  • Style checks pass (black, flake8, pyright)

…ands

- Add CLI entry point using Click
- Add Click as runtime dependency

Signed-off-by: Willian Paixao <willian@ufpa.br>
Copilot AI review requested due to automatic review settings January 2, 2026 12:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a command-line interface to the python-mnemonic library, enabling users to generate, validate, and derive seeds from BIP-39 mnemonic phrases directly from the terminal.

Key changes:

  • Implements three CLI commands using Click framework: create (generate mnemonics), check (validate mnemonics), and to-seed (derive seeds)
  • Adds Click as a runtime dependency with flexible version constraint (^8.0)
  • Updates documentation with CLI usage examples and command descriptions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/mnemonic/cli.py New file implementing the CLI with three commands for mnemonic generation, validation, and seed derivation
pyproject.toml Adds Click dependency and configures the mnemonic script entry point
README.rst Adds CLI usage documentation with examples and fixes spelling error ("mnenomic" → "mnemonic")
CHANGELOG.rst Documents the new CLI feature in version 0.22
.github/workflows/python-package.yml Enhances CI workflow to build distribution packages and validate package metadata

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 12 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Willian Paixao <willian@ufpa.br>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willianpaixao willianpaixao requested a review from matejcik January 6, 2026 20:51
@willianpaixao
Copy link
Contributor Author

Copilot gave me a lot more feedback than I expected. I thought it would be simpler/easier PR.

@matejcik this is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants