Skip to main content

Python Library for nostr.

Project description

pynostr

Python library for for Nostr.

This library is using coincurve instead of secp256k1, so pynostr can be used on windows.

Installation

pip install pynostr

Usage

Generate a key

from pynostr.key import PrivateKey

private_key = PrivateKey()
public_key = private_key.public_key
print(f"Private key: {private_key.bech32()}")
print(f"Public key: {public_key.bech32()}")

Test Suite

Set up the test environment

Install the test-runner dependencies:

pip3 install -r test-requirements.txt

Then make the pynostr python module visible/importable to the tests by installing the local dev dir as an editable module:

# from the repo root
pip3 install -e .

Running the test suite

Run the whole test suite:

# from the repo root
pytest

Run a specific test file:

pytest test/test_this_file.py

Run a specific test:

pytest test/test_this_file.py::test_this_specific_test

Pre-commit-config

Installation

$ pip install pre-commit

Using homebrew:

$ brew install pre-commit
$ pre-commit --version
pre-commit 2.10.0

Install the git hook scripts

$ pre-commit install

Run against all the files

pre-commit run --all-files
pre-commit run --show-diff-on-failure --color=always --all-files

Update package rev in pre-commit yaml

pre-commit autoupdate
pre-commit run --show-diff-on-failure --color=always --all-files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynostr-0.0.4.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

pynostr-0.0.4-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pynostr-0.0.4.tar.gz.

File metadata

  • Download URL: pynostr-0.0.4.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pynostr-0.0.4.tar.gz
Algorithm Hash digest
SHA256 6522b857b2c6bf2c9502c87ba9bf6ca0d589172a425e82e14fb2b7cf2aa49c89
MD5 5446bcd0eb8c0bc6809118eaaa990165
BLAKE2b-256 87bae2e76bc8498958e443b398a161c524fb48aafb31a05dd3b1e20384ff15e6

See more details on using hashes here.

File details

Details for the file pynostr-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pynostr-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pynostr-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 76682cd70b225aece02272071ab8a002e9ba6c84e837ba0128c667662e0176e1
MD5 4ecb882fd2fe60ac3d111731018e5846
BLAKE2b-256 f6e8a8143df6f929aad317175bf57f1ef4fde266a7f4dc1e5b1182ab52039a6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page