File tree Expand file tree Collapse file tree 6 files changed +252
-264
lines changed Expand file tree Collapse file tree 6 files changed +252
-264
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ explicit = true
7777
7878[dependency-groups ]
7979dev = [
80- " bpython>=0.25 " ,
80+ " ipython>=8.37.0 " ,
8181 " mypy>=1.17.1" ,
8282 " pdoc>=15.0.4" ,
8383 " pre-commit>=4.3.0" ,
Original file line number Diff line number Diff line change 11"""anchor.py: creates and starts an anchor node for testing."""
2+ import sys
3+
4+ import IPython
5+
6+ from chordnet import Node as ChordNode
7+
8+
9+ def main () -> None :
10+ """Creates a new ring with this computer as the only node."""
11+ if len (sys .argv ) != 3 :
12+ print ("usage: [uv run] python anchor.py ip_addr port_no" )
13+ exit (1 )
14+
15+ ip = sys .argv [1 ]
16+ port = int (sys .argv [2 ])
17+
18+ node = ChordNode (ip , port , debug = True )
19+ # create (start) the ring
20+ node .create ()
21+ print (f"Node created as \" node\" : { node .address } " , file = sys .stderr )
22+ repl_locals = {
23+ 'node' : node ,
24+ }
25+ print ("starting repl. access `node`" )
26+ IPython .embed (user_ns = repl_locals )
27+ node .stop ()
28+
29+
30+ if __name__ == '__main__' :
31+ main ()
Original file line number Diff line number Diff line change 11"""joiner.py: creates a joining node for debugging."""
2+ import sys
3+
4+ import IPython
5+
6+ from chordnet import Node as ChordNode
7+
8+
9+ def main () -> None :
10+ """Creates a new ring with this computer as the only node."""
11+ if len (sys .argv ) != 5 :
12+ print ("usage: [uv run] python " \
13+ "joiner.py this_ip this_port target_ip target_port" )
14+ exit (1 )
15+
16+ # Get IP and port from command line arguments
17+ ip = sys .argv [1 ]
18+ port = int (sys .argv [2 ])
19+ target_ip = sys .argv [3 ]
20+ target_port = int (sys .argv [4 ])
21+
22+ # Create and join node
23+ node = ChordNode (ip , port , debug = True )
24+ node .join (target_ip , target_port )
25+ repl_locals = {
26+ 'node' : node ,
27+ }
28+ print ("starting repl. access `node`, advance with `step(node)`" )
29+ IPython .embed (user_ns = repl_locals )
30+ node .stop ()
31+
32+
33+ if __name__ == '__main__' :
34+ main ()
Original file line number Diff line number Diff line change 11"""anchor.py: creates and starts an anchor node for testing."""
22import sys
33
4- import bpython
4+ import IPython
55from step import step #type: ignore
66
77from chordnet import Node as ChordNode
@@ -25,7 +25,7 @@ def main() -> None:
2525 'step' : step ,
2626 }
2727 print ("starting repl. access `node`, advance with `step(node)`" )
28- bpython .embed (locals_ = repl_locals )
28+ IPython .embed (user_ns = repl_locals )
2929 node .stop ()
3030
3131
Original file line number Diff line number Diff line change 11"""joiner.py: creates a joining node for debugging."""
22import sys
33
4- import bpython
4+ import IPython
55from step import step #type: ignore
66
77from chordnet import Node as ChordNode
@@ -28,7 +28,7 @@ def main() -> None:
2828 'step' : step ,
2929 }
3030 print ("starting repl. access `node`, advance with `step(node)`" )
31- bpython .embed (locals_ = repl_locals )
31+ IPython .embed (user_ns = repl_locals )
3232 node .stop ()
3333
3434
You can’t perform that action at this time.
0 commit comments