ezdvm


Nameezdvm JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA simple python Data Vending Machine (DVM) implementation on nostr
upload_time2024-08-26 15:23:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ezdvm
Easily run any python code behind a DVM on Nostr. Just pick a kind (for basic text-to-text use 5050) and put the code you want to run in the do_work() function. Then run the DVM. 

## Install

```commandline
cd ezdvm/
python3.12 -m venv venv
source venv/bin/activate
pip install ezdvm
```

## Create your own DVM

Steps:
1. Choose the job request kind in the init function
2. Run any python code inside the do_work() function. The `event` arg is the original job request from the user, in the form of `nostr-sdk event`, for python examples see here: https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-sdk-ffi/bindings-python/examples

```python
from ezdvm import EZDVM


class HelloWorldDVM(EZDVM):

    def __init__(self):
        # choose the job request kinds you will listen and respond to
        super().__init__(kinds=[5050])

    async def do_work(self, event):
        return "Hello World!"


if __name__ == "__main__":
    hello_world_dvm = HelloWorldDVM()
    hello_world_dvm.add_relay("wss://relay.damus.io")
    hello_world_dvm.add_relay("wss://relay.primal.net")
    hello_world_dvm.add_relay("wss://nos.lol")
    hello_world_dvm.add_relay("wss://nostr-pub.wellorder.net")
    hello_world_dvm.start()
```



## Testing

Once it's running on your machine, if you are using kind 5050 you can test it here: https://dvmdash.live/playground/ 

_Note that currently you have to use a NIP-07 extension to login first_ 




            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ezdvm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Dustin Dannenhauer <dustin@dvmdash.live>",
    "download_url": "https://files.pythonhosted.org/packages/44/f1/090eceb7f0cd5727a4b629baedc532d7ec3c683c18430392c25ac3d66d57/ezdvm-0.1.1.tar.gz",
    "platform": null,
    "description": "# ezdvm\nEasily run any python code behind a DVM on Nostr. Just pick a kind (for basic text-to-text use 5050) and put the code you want to run in the do_work() function. Then run the DVM. \n\n## Install\n\n```commandline\ncd ezdvm/\npython3.12 -m venv venv\nsource venv/bin/activate\npip install ezdvm\n```\n\n## Create your own DVM\n\nSteps:\n1. Choose the job request kind in the init function\n2. Run any python code inside the do_work() function. The `event` arg is the original job request from the user, in the form of `nostr-sdk event`, for python examples see here: https://github.com/rust-nostr/nostr/tree/master/bindings/nostr-sdk-ffi/bindings-python/examples\n\n```python\nfrom ezdvm import EZDVM\n\n\nclass HelloWorldDVM(EZDVM):\n\n    def __init__(self):\n        # choose the job request kinds you will listen and respond to\n        super().__init__(kinds=[5050])\n\n    async def do_work(self, event):\n        return \"Hello World!\"\n\n\nif __name__ == \"__main__\":\n    hello_world_dvm = HelloWorldDVM()\n    hello_world_dvm.add_relay(\"wss://relay.damus.io\")\n    hello_world_dvm.add_relay(\"wss://relay.primal.net\")\n    hello_world_dvm.add_relay(\"wss://nos.lol\")\n    hello_world_dvm.add_relay(\"wss://nostr-pub.wellorder.net\")\n    hello_world_dvm.start()\n```\n\n\n\n## Testing\n\nOnce it's running on your machine, if you are using kind 5050 you can test it here: https://dvmdash.live/playground/ \n\n_Note that currently you have to use a NIP-07 extension to login first_ \n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple python Data Vending Machine (DVM) implementation on nostr",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/dtdannen/ezdvm/issues",
        "Homepage": "https://github.com/dtdannen/ezdvm"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9231348894e327466a30e36ea4c77ae7022736cc2f15c1ad9ccd7b6d8eb2eec",
                "md5": "3b131a47b7e2d3c1091d3cf5f4dce24d",
                "sha256": "c1d9057990ac8ec14db37b0a0af5b58a303cf0e39d1bb23a61f75cfaae3c2b5e"
            },
            "downloads": -1,
            "filename": "ezdvm-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b131a47b7e2d3c1091d3cf5f4dce24d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 6469,
            "upload_time": "2024-08-26T15:23:36",
            "upload_time_iso_8601": "2024-08-26T15:23:36.585652Z",
            "url": "https://files.pythonhosted.org/packages/b9/23/1348894e327466a30e36ea4c77ae7022736cc2f15c1ad9ccd7b6d8eb2eec/ezdvm-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "44f1090eceb7f0cd5727a4b629baedc532d7ec3c683c18430392c25ac3d66d57",
                "md5": "aaf2e99a73e83d04bc0df0d5095d2490",
                "sha256": "a02c6b983be1a3577b1ceb94981431dea6d81d2fc46d231cfc39c55489e9dbec"
            },
            "downloads": -1,
            "filename": "ezdvm-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "aaf2e99a73e83d04bc0df0d5095d2490",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 6211,
            "upload_time": "2024-08-26T15:23:38",
            "upload_time_iso_8601": "2024-08-26T15:23:38.187771Z",
            "url": "https://files.pythonhosted.org/packages/44/f1/090eceb7f0cd5727a4b629baedc532d7ec3c683c18430392c25ac3d66d57/ezdvm-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-26 15:23:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dtdannen",
    "github_project": "ezdvm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ezdvm"
}
        
Elapsed time: 0.97435s