nostrfastr


Namenostrfastr JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://github.com/armstrys/nostrfastr
SummaryGetting users into nostr, fastr. A basic nostr `Client` class built in the nbdev (fast) framework to get people started nostr.
upload_time2023-01-22 04:21:26
maintainer
docs_urlNone
authorRyan Armstrong
requires_python>=3.7
licenseMIT License
keywords nostr nbdev jupyter notebook python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            nostrfastr
================

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

### What is this?

- This package attempts to be a well documented and tested instance of a
  very basic client framework and other tools that use the nostr
  protocol. The goal is to help others understand nostr quickly and get
  started sending messages from python in minutes.
- Contained is a collection of tools built on top of this basic
  [`Client`](https://armstrys.github.io/nostrfastr/client.html#client)
  class showing some potential uses of nostr any how quickly we can
  build on it in python.
  - A “sentinel” node that serves as a barebones client to rebroadcast
    user data across additional nostr relays. While this is a relatively
    simple concept I haven’t seen much discussion around the potential
    benefits and implications.
  - `notifyr` - a decorator that will alert on success or failure of any
    decorated function via nostr DM
  - a vanity address generator decorated with the notifyr function so
    you can leave it running and get notified when it finishes

### Why nbdev?

This library uses the [nbdev](https://nbdev.fast.ai/) framework to
aggregate some useful tools from
[python-nostr](https://github.com/jeffthibault/python-nostr) into a more
structured `client` class that could serve as the basis for other python
tools. `nbdev` is great because it allows for relatively easy
development of code in-line with readable and explanatory documentation.
This webpage is a rendering of the same notebooks that are exported to
form the package code. If you clone the Github repository you can view
and run the code you see in the documentation. It will almost certainly
not be the most perfomant way to implement much of what I am doing here,
but I hope it can make the
[nostr](https://github.com/nostr-protocol/nostr) protocol more
accessible to a wider audience.

### Suggestions

If you have suggestions for topics or concepts related to nostr that
this package could help document or explain in python, please feel free
to [submit an issue with a suggestion
here](https://github.com/armstrys/nostrfastr/issues)

### Known issues

- [`notifyr`](https://armstrys.github.io/nostrfastr/notifyr.html#notifyr) -
  see the
  [`notifyr`](https://armstrys.github.io/nostrfastr/notifyr.html#notifyr)
  page for more detail on these issues
  - `keyring` may need uninstalled dependencies on linux builds
  - Current spec of nostr DMs is likely not adequate for secure usage of
    this module for sensitive data.

## Install

``` sh
pip install nostrfastr
```

or alternatively, clone the github repositor [and refer to this
guide](https://nbdev.fast.ai/tutorials/tutorial.html) to get started
working in nbdev.

## How to use

Documentation can be found at https://armstrys.github.io/nostrfastr/

``` python
from nostrfastr.client import Client
```

Connect and perform an operation…

``` python
with Client(relay_urls=['wss://relay.damus.io']) as client:
    print('Are we connected?')
    print('\t', client.relay_manager.connection_statuses)
print('Are we connected?')
print('\t', client.relay_manager.connection_statuses)
```

    Are we connected?
         {'wss://relay.damus.io': True}
    Are we connected?
         {'wss://relay.damus.io': False}

And use the client to build something useful with nostr - like a bot
that notifies you of your python processing status on long code runs

``` python
from nostrfastr.notifyr import notifyr
```

``` python
@notifyr
def raise_error():
    raise Exception('Oh no! Process failed!')

@notifyr
def success():
    return 1+1
```

Or generate an vanity address and have it notify you at another nostr
address when it’s done

``` python
from nostrfastr.vanity import vanity_notifyr

private_key = vanity_notifyr(startswith='23', style='npub')
print(private_key.public_key.bech32())
```

    /Users/ryanarmstrong/python/nostrfastr/nostrfastr/client.py:479: UserWarning: the current implementation of messages should be used with caution
                        see https://github.com/nostr-protocol/nips/issues/107
      warnings.warn('''the current implementation of messages should be used with caution

    It might take 0 seconds to find a npub pubkey that starts with npub123. Note that this is a very rough estimate and due to the random nature of finding vanity keys it could take MUCH longer.
    npub1237z2shf8rlgs8xqg0cggz7dhxjtkszy205wesht2xr3nat86m7s30lqw5

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/armstrys/nostrfastr",
    "name": "nostrfastr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "nostr nbdev jupyter notebook python",
    "author": "Ryan Armstrong",
    "author_email": "ryscar13@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/43/890c7932d723758ce497e2c597e956132b87bd2cdf413942cecf3bd8b3ea/nostrfastr-0.0.6.tar.gz",
    "platform": null,
    "description": "nostrfastr\n================\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n### What is this?\n\n- This package attempts to be a well documented and tested instance of a\n  very basic client framework and other tools that use the nostr\n  protocol. The goal is to help others understand nostr quickly and get\n  started sending messages from python in minutes.\n- Contained is a collection of tools built on top of this basic\n  [`Client`](https://armstrys.github.io/nostrfastr/client.html#client)\n  class showing some potential uses of nostr any how quickly we can\n  build on it in python.\n  - A \u201csentinel\u201d node that serves as a barebones client to rebroadcast\n    user data across additional nostr relays. While this is a relatively\n    simple concept I haven\u2019t seen much discussion around the potential\n    benefits and implications.\n  - `notifyr` - a decorator that will alert on success or failure of any\n    decorated function via nostr DM\n  - a vanity address generator decorated with the notifyr function so\n    you can leave it running and get notified when it finishes\n\n### Why nbdev?\n\nThis library uses the [nbdev](https://nbdev.fast.ai/) framework to\naggregate some useful tools from\n[python-nostr](https://github.com/jeffthibault/python-nostr) into a more\nstructured `client` class that could serve as the basis for other python\ntools. `nbdev` is great because it allows for relatively easy\ndevelopment of code in-line with readable and explanatory documentation.\nThis webpage is a rendering of the same notebooks that are exported to\nform the package code. If you clone the Github repository you can view\nand run the code you see in the documentation. It will almost certainly\nnot be the most perfomant way to implement much of what I am doing here,\nbut I hope it can make the\n[nostr](https://github.com/nostr-protocol/nostr) protocol more\naccessible to a wider audience.\n\n### Suggestions\n\nIf you have suggestions for topics or concepts related to nostr that\nthis package could help document or explain in python, please feel free\nto [submit an issue with a suggestion\nhere](https://github.com/armstrys/nostrfastr/issues)\n\n### Known issues\n\n- [`notifyr`](https://armstrys.github.io/nostrfastr/notifyr.html#notifyr) -\n  see the\n  [`notifyr`](https://armstrys.github.io/nostrfastr/notifyr.html#notifyr)\n  page for more detail on these issues\n  - `keyring` may need uninstalled dependencies on linux builds\n  - Current spec of nostr DMs is likely not adequate for secure usage of\n    this module for sensitive data.\n\n## Install\n\n``` sh\npip install nostrfastr\n```\n\nor alternatively, clone the github repositor [and refer to this\nguide](https://nbdev.fast.ai/tutorials/tutorial.html) to get started\nworking in nbdev.\n\n## How to use\n\nDocumentation can be found at https://armstrys.github.io/nostrfastr/\n\n``` python\nfrom nostrfastr.client import Client\n```\n\nConnect and perform an operation\u2026\n\n``` python\nwith Client(relay_urls=['wss://relay.damus.io']) as client:\n    print('Are we connected?')\n    print('\\t', client.relay_manager.connection_statuses)\nprint('Are we connected?')\nprint('\\t', client.relay_manager.connection_statuses)\n```\n\n    Are we connected?\n         {'wss://relay.damus.io': True}\n    Are we connected?\n         {'wss://relay.damus.io': False}\n\nAnd use the client to build something useful with nostr - like a bot\nthat notifies you of your python processing status on long code runs\n\n``` python\nfrom nostrfastr.notifyr import notifyr\n```\n\n``` python\n@notifyr\ndef raise_error():\n    raise Exception('Oh no! Process failed!')\n\n@notifyr\ndef success():\n    return 1+1\n```\n\nOr generate an vanity address and have it notify you at another nostr\naddress when it\u2019s done\n\n``` python\nfrom nostrfastr.vanity import vanity_notifyr\n\nprivate_key = vanity_notifyr(startswith='23', style='npub')\nprint(private_key.public_key.bech32())\n```\n\n    /Users/ryanarmstrong/python/nostrfastr/nostrfastr/client.py:479: UserWarning: the current implementation of messages should be used with caution\n                        see https://github.com/nostr-protocol/nips/issues/107\n      warnings.warn('''the current implementation of messages should be used with caution\n\n    It might take 0 seconds to find a npub pubkey that starts with npub123. Note that this is a very rough estimate and due to the random nature of finding vanity keys it could take MUCH longer.\n    npub1237z2shf8rlgs8xqg0cggz7dhxjtkszy205wesht2xr3nat86m7s30lqw5\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Getting users into nostr, fastr. A basic nostr `Client` class built in the nbdev (fast) framework to get people started nostr.",
    "version": "0.0.6",
    "split_keywords": [
        "nostr",
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f74c1f09d191960bc7dbda25407147155ad9e688e5c8adb50938534ba5cd4c54",
                "md5": "7018925c63717125f2bc5dfce56110e0",
                "sha256": "75f9841d30732da995ab3e8b9830bd587de5bdfa2d71c56f3746ce98f7a1c595"
            },
            "downloads": -1,
            "filename": "nostrfastr-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7018925c63717125f2bc5dfce56110e0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 17285,
            "upload_time": "2023-01-22T04:21:24",
            "upload_time_iso_8601": "2023-01-22T04:21:24.210750Z",
            "url": "https://files.pythonhosted.org/packages/f7/4c/1f09d191960bc7dbda25407147155ad9e688e5c8adb50938534ba5cd4c54/nostrfastr-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb43890c7932d723758ce497e2c597e956132b87bd2cdf413942cecf3bd8b3ea",
                "md5": "bf3c6616fc9de15b12024918227149b6",
                "sha256": "2de4659c8eba3da031e6978cb718e15eabf8b2b37c33b1d4c0a8afafbe33bd75"
            },
            "downloads": -1,
            "filename": "nostrfastr-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "bf3c6616fc9de15b12024918227149b6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 18576,
            "upload_time": "2023-01-22T04:21:26",
            "upload_time_iso_8601": "2023-01-22T04:21:26.369283Z",
            "url": "https://files.pythonhosted.org/packages/fb/43/890c7932d723758ce497e2c597e956132b87bd2cdf413942cecf3bd8b3ea/nostrfastr-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-22 04:21:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "armstrys",
    "github_project": "nostrfastr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nostrfastr"
}
        
Elapsed time: 0.03122s