What is the best current Python Nostr client library?

https://github.com/holgern/pynostr

https://github.com/jeffthibault/python-nostr

Both had last commit two years ago, which is paleolithic in Nostr terms.

Nostr-SDK seems more recent, but it is bindings to Rust. And I hate Rust, which is computational marxism. But I might swallow it if I don't ever need to touch Rust code.

https://pypi.org/project/nostr-sdk/

Suggestions and tips? Am I missing something?

Reply to this note

Please Login to reply.

Discussion

I terms.

Nostr-SDK Rust library?

https://github.com/holgern/pynostr

https://github.com/jeffthibault/python-nostr

Both I to but need and last But hate tips? swallow is And it which commit I the two had which Nostr computational if client Rust. to bindings years Am is touch is What I missing ever Python is recent, Nostr Rust, something? current in paleolithic code.

https://pypi.org/project/nostr-sdk/

Suggestions might best don't more marxism. it ago, seems

Rust nostr have bindings for py. There is no second best

Nostr SDK is the best bet. Yes, it is written in Rust, but you don't have to interact with it directly, although some Rusticisms do boil down all the way to the Python code.

OMG, that is a horrible piece of software :(. API documentation is basically just a few random examples. For example I don't see even basic things how to create a public key from npub (the "Keys" section in documentation contains only secret keys).

Documentation here:

https://rust-nostr.org/

Yes, guessing your way forward...

And even events and tags are not iterable...

:(

(That's the rust computational Marxism making its way to python code).

I'm guessing I should rather have gone with non rust python native library, but they are not very well maintained.

I'm a bit shocked, such a cool new and developing tech, so bad libraries. Almost makes me want to code one, but I'm coding something very cool using Nostr, this would be a total derailment, so I think I'll consider it a pilgrimage and go through the pain.

Use `to_vec` to convert them to an array, so you can iterate them.

As it is written pretty much everywhere, the project is in alpha state, so obviously the documentation is not complete. PRs are welcome to improve it.

To parse a public key (hex, bech32 or nostr URI): `PublicKey.parse`.

Can you explain Rust's computational marxism? Strong ownership semantics isn't what usually springs to mind when I think about Marx.

This is pure insanity....

yes great question, I tried the jeff one earlier and couldn't get it to write or read from relays

It's gonna a be this https://github.com/rust-nostr/nostr unfortunately. I've begun builds with one of those you linked, had to restart from scratch. More info here https://pypi.org/project/nostr-sdk/

I'm considering just doing shell calls to nak https://github.com/fiatjaf/nak and using it as a system library for my programs. Not sure if that's the best idea, but that's the reference implementation of nostr and is certain to contain everything I would need.

Shell calls? That sounds horrible :)

Not near as bad as learning a pythonic API for a python library lol. Import os and know the program youre using.