Code Monkey home page Code Monkey logo

socketserverrepl's Introduction

socketserverREPL

This project exposes the interactive Python interpreter over a TCP socket. It does so in a manner that allows multiple connections at the same time, each connection runs in a separate thread and has its own scope. It is a pure Python implementation relying on the code and socketserver modules. Tested on Pythonista 3, running Python 3.4.

What is the use case?

I created this to facilitate development for Pythonista, a Python interpreter that runs on iOS. At first I had a script that allowed updating other scripts, but I missed the functionality to quickly test something in an interactive interpreter. Getting the interpreter with code.interact() from a script in Pythonista works but that requires typing on the device itself, obviously not the preffered solution.

This socketserverREPL exposes the interpreter on a TCP socket, this allows connecting to it with netcat and thus typing into the interactive Python interpreter of Pythonista through a normal keyboard. Additionally it allows uploading scripts and executing them while observing the output on a normal screen.

Although developed with this use-case in mind, it works for any scenario where you have access to Python but can't use standard tools to access it. Be careful to which ip address you bind the server to; expose the REPL only on trusted networks.

repl_tool.py

This is a simple helper script to facilitate file upload, download and execution. It also provides a convenience wrapper around the TCP socket to provide command history.

License

MIT License, see LICENSE.

Copyright (c) 2017 Ivor Wanders

socketserverrepl's People

Contributors

iwanders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

blubber hradec

socketserverrepl's Issues

Stop the REPL Server where there are still active connections.

I am running on Windows 7 Python3.6. I found I cannot force the server to stop (quit) when there is still an active connection. I tried Ctrl-C and Ctrl-Z. Is there a way to force the server to stop other than kill the process?

BTW, thanks for the work! It is easy to start and runs nicely so far during my initial testing so far.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.