Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python example fail, python code format failures and much too long #198

Open
dasTholo opened this issue Oct 14, 2024 · 0 comments
Open

python example fail, python code format failures and much too long #198

dasTholo opened this issue Oct 14, 2024 · 0 comments

Comments

@dasTholo
Copy link

dasTholo commented Oct 14, 2024

First off, I wanna say I'm super excited about this project! I get that you're just starting out. But I'd like to explain the hurdles for a non-Rust Python programmer. I can imagine that the SDKs for non-Rust languages might be less maintained than the main Rust project. That's totally clear to me! I just want to say this as constructive criticism. It's great that you already support installation via PyPi. But I was really confused when I realized it's just one file, "iroh_ffi.py". When I opened and read it, I was totally shocked.

Point 1:

  • Over 20k lines, that's not good! My IDE totally crashed (is that how you say it in English?) and couldn't handle it. 98% CPU usage.
    This means the applications need to be split up to improve performance and readability.
    Point 2:

  • The examples have errors

main.py Traceback

/home/tholo/Scripts/t_iroh/.venv/bin/python /home/tholo/Scripts/t_iroh/src/t_iroh/main.py
In example mode
(To run the sync demo, please provide a ticket to join a document)

Traceback (most recent call last):
File "/home/tholo/Scripts/t_iroh/src/t_iroh/main.py", line 71, in
asyncio.run(main())

File "/home/tholo/.rye/py/[email protected]/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)

File "/home/tholo/.rye/py/[email protected]/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)

File "/home/tholo/.rye/py/[email protected]/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()

File "/home/tholo/Scripts/t_iroh/src/t_iroh/main.py", line 28, in main
node_id = await node.node().node_id()

AttributeError: 'Node' object has no attribute 'node_id'

Process finished with exit code 1
Fix:

#node = await iroh.Iroh.memory()
#node_id = await node.node().node_id()
options = iroh.NodeOptions()
options.enable_docs = True
node = await iroh.Iroh.memory_with_options(options)

/home/tholo/Scripts/t_iroh/.venv/bin/python /home/tholo/Scripts/t_iroh/src/t_iroh/main.py
In example mode
(To run the sync demo, please provide a ticket to join a document)

Created doc: mp4chqhxybuuepskihamopytqakxxl5poboeezoktmaael7mq5ga

Created doc: egvzyk2lhxt4kwls4jcqqknjh3kgws3karl5r5i5pfibkjqjgirq

List all 2 docs:

NamespaceAndCapability(namespace=egvzyk2lhxt4kwls4jcqqknjh3kgws3karl5r5i5pfibkjqjgirq, capability=CapabilityKind.WRITE)
NamespaceAndCapability(namespace=mp4chqhxybuuepskihamopytqakxxl5poboeezoktmaael7mq5ga, capability=CapabilityKind.WRITE)

Process finished with exit code 0

Point 3:

  • Formatting errors, too many or too few blank lines, text too long, indentation errors
    Unused imports
    Integrate and use ruff (which is written in Rust for Python ;) ) or even pre-commit in the Github Actions, so these errors don't get committed.

I have started a PR #197

I look forward to exchanging ideas with you

@ramfox ramfox moved this to 📋 Backlog in iroh Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant