Commit Graph

38 Commits

Author SHA1 Message Date
4e9fa87477 Updated examples to automatically use random port (#661)
* updated examples to automatically use random port

* Refactor examples to use shared utils for port selection (#1)

---------

Co-authored-by: acul71 <34693171+acul71@users.noreply.github.com>
2025-06-09 12:59:11 -06:00
d497a2225b fix: broken import in the examples after net_stream_interface rename 2025-02-25 06:37:09 -07:00
e7a9ee78a8 rename typing.py to custom_types.py for clarity 2025-02-02 07:18:52 -07:00
a72dbaa58d set demos as console scripts, update chat instructions 2025-01-01 17:36:41 -07:00
7de6cbaab0 display example code and usage instructions in docs 2024-05-19 13:34:13 -06:00
94483714a3 run lint and fix errors, except mypy 2024-02-19 16:05:58 -07:00
e57d01f360 PR feedback
- Use f-string
- Fix wrongly indented comments
- Add dep `trio-typing`
2020-01-28 15:48:41 +08:00
6e01a7da31 PR feedback: async with host.run() 2020-01-26 16:44:42 +08:00
3372c32432 Fix examples and modify new_node
- Fix examples `chat.py` and `echo.py`
    - Use trio directly, instead of `trio-asyncio`
    - Remove redundant code
- Change entry API `new_node` to `new_host_trio`
2019-12-24 18:03:18 +08:00
a397ccdc04 makes test_mplex_stream.py::test_mplex_stream_read_write work 2019-11-26 15:27:06 +08:00
d4d345c3c7 progressing 2019-11-26 15:27:05 +08:00
f5c725788e need manual stop 2019-11-26 15:27:05 +08:00
ed17bfd663 hack chat example 2019-11-26 15:27:04 +08:00
649a230776 Fix MplexStream.read 2019-09-06 17:26:40 +08:00
3debd2c808 Run black and isort w/ the new config 2019-08-13 14:36:42 -07:00
28f6de37ee Fix the rest of the typing hints (#232)
* ignore kad

* fix swarm, and minor

* fix init and swarm

* ignore pb

* enable mypy

* fix basic host

* fix tcp

* fix mplex

* add typing for pb

* skip format pyi

* [mypy] no need to ignore pb now

* add typing to chat
2019-08-11 16:47:54 +08:00
7477b29508 run black w/ extended line length 2019-08-04 12:37:41 +08:00
cb301fcc51 Opt-out of linting on the special cases we have, given new ignore rules 2019-08-04 12:37:27 +08:00
cf3904a56a Merge pull request #207 from ralexstokes/update-chat-example
Update chat example
2019-08-03 09:49:51 -07:00
c8005c8113 Run isort in repo 2019-08-03 17:50:14 +08:00
c8d175b373 Add a localhost option and fix the printed example to run another peer 2019-08-02 10:22:15 -07:00
430b4e2f89 Bail as soon as we know there is a port error 2019-08-02 10:21:41 -07:00
0ae9840928 Run black over repo 2019-07-31 15:00:12 -07:00
d64c7d6d56 Add the missing type for port 2019-07-24 21:28:14 +08:00
381f5ddc3a Replace click with argparse 2019-07-24 18:43:49 +08:00
04b7df9fcf Lint examples in tox 2019-07-24 18:00:57 +08:00
5d4b4cf525 fixing chat (#151) 2019-04-18 15:56:02 -04:00
e34603c364 fixing chat to use public IP (#122) 2019-02-10 20:52:05 -05:00
bfb2c73810 Fixed some issues with the chat example (#120)
* Fixed some issues with the chat example

* Bump version to Python 3.7 (#121)

* bump version

* enable 3.7 in travis

* Minor refactor
2019-02-10 13:07:42 -05:00
82d08a3b14 chat.py very little code refactor. (#112)
That was an useless duplicate
2019-01-30 23:54:55 -05:00
d629a0c85e Fix examples/chat/chat.py. Extract test requirements to .travis.yaml file. 2019-01-09 22:01:46 +03:00
97e554e265 make the chat example a runnable test
fixes #71
2018-12-21 09:03:20 +01:00
611de28aca Add basic support for multiaddr addresses and improvement around peer id (#75)
* Improved peer ID construction and usage

* peer id object is directly passed to the network

no need to cast from a string to an ID

* don't base64 encode the peer id when loading from public key

* use proper multiaddr address

- keep multiaddr object into peerstore instead of string
- update network code to use new multiaddr lib
- update tests and example

* don't instanciate peerstore object in constructor

This has side effect where the same peerstore
is used for different instance of Libp2p

* add connect method to basic_host

* use zaibon's fork of sbuss/py-multiaddr

* lint
2018-11-29 10:06:40 -05:00
7fa674dee2 Protocol muxing (#82)
* Implement protocol muxing

* Integrate protocol muxing into new stream and listen's conn handler

* Fix bugs in protocol muxing

* Remove blank line

* Add comments and fix linting issues

* Fix order of parameters to select_one_of to match interface

* Use array of protocol ids in new stream instead of protocol id

* Add basic protocol muxer tests

* Add todo

* Modify new stream to take in protocol ids

* Add check to all tests to ensure protocol id is saved to net stream properly

* Lint tests

* Fix lint issues

* Add todo

* Modify port numbers in tests

* Fix linting issues

* Add more documentation to functions

* Add docs describing classes and fix indent error
2018-11-28 13:51:50 -05:00
c950e065f3 Add more info for chat example 2018-11-26 16:34:38 +08:00
22010447b5 fix run error 2018-11-26 15:56:43 +08:00
ff6fdccea4 refactor libp2p 2018-11-25 01:45:13 -05:00
b80df48d37 move chat.py into examples directory 2018-11-19 17:29:48 +01:00