Giter Site home page Giter Site logo

vepiphyte / aioconsole Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vxgmichel/aioconsole

0.0 0.0 0.0 165 KB

Asynchronous console and interfaces for asyncio

Home Page: http://aioconsole.readthedocs.io

License: GNU General Public License v3.0

Shell 0.64% Python 99.36%

aioconsole's Introduction

aioconsole

Asynchronous console and interfaces for asyncio

aioconsole provides:

  • asynchronous equivalents to input, print, exec and code.interact
  • an interactive loop running the asynchronous python console
  • a way to customize and run command line interface using argparse
  • stream support to serve interfaces instead of using standard streams
  • the apython script to access asyncio code at runtime without modifying the sources

Requirements

  • python >= 3.4

Installation

aioconsole is available on PyPI and GitHub. Both of the following commands install the aioconsole package and the apython script.

$ pip3 install aioconsole   # from PyPI
$ python3 setup.py install  # or from the sources
$ apython -h
usage: apython [-h] [--serve [HOST:] PORT] [--no-readline]
               [--banner BANNER] [--locals LOCALS]
               [-m MODULE | FILE] ...

Run the given python file or module with a modified asyncio policy replacing
the default event loop with an interactive loop. If no argument is given, it
simply runs an asynchronous python console.

positional arguments:
  FILE                  python file to run
  ARGS                  extra arguments

optional arguments:
  -h, --help            show this help message and exit
  --serve [HOST:] PORT, -s [HOST:] PORT
                        serve a console on the given interface instead
  --no-readline         force readline disabling
  --banner BANNER       provide a custom banner
  --locals LOCALS       provide custom locals as a dictionary
  -m MODULE             run a python module

Simple usage

The following example demonstrates the use of await inside the console:

$ apython
Python 3.5.0 (default, Sep 7 2015, 14:12:03)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
---
This console is running in an asyncio event loop.
It allows you to wait for coroutines using the 'await' syntax.
Try: await asyncio.sleep(1, result=3, loop=loop)
---
>>> await asyncio.sleep(1, result=3)
# Wait one second...
3
>>>

Documentation

Find more examples in the documentation and the example directory.

Contact

Vincent Michel: [email protected]

aioconsole's People

Contributors

gnachman avatar kelbyers avatar piannucci avatar terrance avatar vxgmichel avatar

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.