jeffthibault/python-nostr

Python 3.11 and are the examples up to date?

brianoflondon opened this issue · 2 comments

I'd love to use this but I'm already working in Python 3.11. I can't even import the library properly.

BTW I added it to my project with poetry add git+https://github.com/jeffthibault/python-nostr.git instead of PyPi.

First error trying to use the connect to relays example is this:

ValueError: mutable default <class 'nostr.relay.RelayPolicy'> for field policy is not allowed: use default_factory

A quick look at the code and I can't understand how this:

relay_manager.open_connections(
    {"cert_reqs": ssl.CERT_NONE}
)  # NOTE: This disables ssl certificate verification

Will work as I can't see a open_connections method on that class, is the doc out of date?

I would like to provide NIP-57 support to the people all using my non-custodial NIP-05 system but I really don't have the capacity to dig into this library and fix it at this time.

I tried to install for Dev but had a bunch of problems which I can expand on if it helps anyone, suffice to say I can't get a dev environment working properly.

i had some issues too, but i couldn't get it to work so i moved to a fork of this library which is located here

Everything works, sadly no docs yet so you'll need to look through the code for answers.
If you need help, feel free to mention me

Jxck-S commented
ry

Docs are def out of date. open_connnections and close are both deprecated. Connecting is auto-done when adding a relay.

For ValueError: mutable default <class 'nostr.relay.RelayPolicy'> for field policy is not allowed: use default_factory
Same problem mentioned here #82 (comment)

This is the fix
In relay.py add field to the dataclasses import from dataclasses import dataclass, field

Also change line 37 to use the default factory field
policy: RelayPolicy = field(default_factory=RelayPolicy)