a python library which provides you a interface like input/print.
- python >= 3.10
pip install git+https://github.com/hmasdev/SockeSole
or
git clone https://github.com/hmasdev/SockeSole
cd SockeSole
pip install .
Server-side | Client-side |
>>> from sockesole import SocketConsoleServer
>>> server = SocketConsoleServer(host='localhost', port=10111)
>>> server.run()
-
>>> server.get_keys()
[('127.0.0.1', 58167)]
>>> server.get_console(server.get_keys()[0]).echo('hello from server')
-
-
>>> server.get_console(server.get_keys()[0]).prompt('say something', wait=0.01)
-
-
'reponse'
-
-
-
-
>>> server.get_keys()
[] |
>>> from sockesole import SocketConsoleClient
-
-
>>> client = SocketConsoleClient.connect('localhost', port=10111)
-
-
-
>>> client.read()
'hello from server'
-
>>> client.read()
'say something'
>>> client.write('reponse')
-
>>> client.close()
>>> client.alive()
False
-
- |
uv
-
Fork the repository: https://github.com/hmasdev/SockeSole
-
Clone the repository
git clone https://github.com/{YOURE_NAME}/SockeSole cd SockeSole
-
Create a virtual environment and install the required packages
uv sync --dev
-
Checkout your working branch
git checkout -b your-working-branch
-
Make your changes
-
Test your changes
uv run pytest uv run flake8 sockesole tests uv run mypy sockesole tests
Note that the above commands run only unit tests. It is recommended to run integration tests with
uv run pytest -m integration
. -
Commit your changes
git add . git commit -m "Your commit message"
-
Push your changes
git push origin your-working-branch
-
Create a pull request: https://github.com/hmasdev/SockeSole/compare