All Projects → saghul → Python Fibers

saghul / Python Fibers

Licence: other
Lightweight cooperative microthreads for Python

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Python Fibers

Smproxy
Swoole MySQL Proxy 一个基于 MySQL 协议,Swoole 开发的MySQL数据库连接池。 A MySQL database connection pool based on MySQL protocol and Swoole.
Stars: ✭ 1,665 (+1040.41%)
Mutual labels:  coroutines
Topcorn
A minimalistic movie listing app to browse IMDB's top 250 movies, built to demonstrate MVVM with latest hot-trending Android development tools.
Stars: ✭ 131 (-10.27%)
Mutual labels:  coroutines
Foodium
It simply loads Posts data from API and stores it in persistence storage (i.e. SQLite Database). Posts will be always loaded from local database. Remote data (from API) and Local data is always synchronized.
Stars: ✭ 1,940 (+1228.77%)
Mutual labels:  coroutines
Tina
Tina is a teeny tiny, header only, coroutine and job library.
Stars: ✭ 125 (-14.38%)
Mutual labels:  coroutines
Cocktailapp
Cocktails Android App with Clean Architecture, MVVM , Retrofit, Coroutines, Navigation Components , Room, Dagger Hilt, Cache Strategy and Coroutines Flow
Stars: ✭ 128 (-12.33%)
Mutual labels:  coroutines
Kotlinmultiplatform mvvm
Android & iOS App using MVVM pattern and LiveData on the presentation layer + Clean Arch on the common shared code.
Stars: ✭ 135 (-7.53%)
Mutual labels:  coroutines
Paleontologas
Source code of the most popular Paleontological mobile app in the world! Programming sandbox.
Stars: ✭ 122 (-16.44%)
Mutual labels:  coroutines
Coredux
Opinionated Redux store implementation using Kotlin coroutines
Stars: ✭ 144 (-1.37%)
Mutual labels:  coroutines
Compose Server Side
Experiment with server side rendering using compose and ktor
Stars: ✭ 131 (-10.27%)
Mutual labels:  coroutines
Cppcoro
A library of C++ coroutine abstractions for the coroutines TS
Stars: ✭ 2,118 (+1350.68%)
Mutual labels:  coroutines
Mioco
[no longer maintained] Scalable, coroutine-based, fibers/green-threads for Rust. (aka MIO COroutines).
Stars: ✭ 125 (-14.38%)
Mutual labels:  coroutines
Adam
Coroutine-friendly Android Debug Bridge client written in Kotlin
Stars: ✭ 129 (-11.64%)
Mutual labels:  coroutines
Conduit
High Performance Streams Based on Coroutine TS ⚡
Stars: ✭ 135 (-7.53%)
Mutual labels:  coroutines
Searchrestaurant
Apps are built using Google Maps SDK, Geocoding and Foursquare APIs
Stars: ✭ 124 (-15.07%)
Mutual labels:  coroutines
Fiber Ext
stackful-coroutines for PHP
Stars: ✭ 142 (-2.74%)
Mutual labels:  coroutines
Movieapp Clean Architecture
Learning Project (Movie App) For Applying Android Architecture Components And Clean Architecture Using MVVM With Kotlin
Stars: ✭ 123 (-15.75%)
Mutual labels:  coroutines
Splitties
A collection of hand-crafted extensions for your Kotlin projects.
Stars: ✭ 1,945 (+1232.19%)
Mutual labels:  coroutines
Co
Art of C++. Flag, logging, unit-test, json, go-style coroutine and more.
Stars: ✭ 2,264 (+1450.68%)
Mutual labels:  coroutines
Unityfx.async
Asynchronous operations (promises) for Unity3d.
Stars: ✭ 143 (-2.05%)
Mutual labels:  coroutines
Retrofit Kotlin Coroutines Example
An example project to demonstrate how to use Retrofit with Kotlin Coroutines in Android
Stars: ✭ 135 (-7.53%)
Mutual labels:  coroutines

=========================================== fibers: lightweight concurrent multitasking

.. image:: https://badge.fury.io/py/fibers.png :target: http://badge.fury.io/py/fibers

Overview

Fibers are lightweight primitives for cooperative multitasking in Python. They provide means for running pieces of code that can be paused and resumed. Unlike threads, which are preemptively scheduled, fibers are scheduled cooperatively, that is, only one fiber will be running at a given point in time, and no other fiber will run until the user explicitly decides so.

When a fiber is created it will not run automatically. A fiber must be 'switched' into for it to run. Fibers can switch control to other fibers by way of the switch or throw functions, which switch control or raise and exception in the target fiber respectively.

Example:

::

import fibers

def func1():
    print "1"
    f2.switch()
    print "3"
    f2.switch()

def func2():
    print "2"
    f1.switch()
    print "4"

f1 = fibers.Fiber(target=func1)
f2 = fibers.Fiber(target=func2)
f1.switch()

The avove example will print "1 2 3 4", but the result was obtained by the cooperative work of 2 fibers yielding control to each other.

CI status

.. image:: https://secure.travis-ci.org/saghul/python-fibers.png?branch=master :target: http://travis-ci.org/saghul/python-fibers

.. image:: https://ci.appveyor.com/api/projects/status/9f4h0wk797i4vc0k?svg=true :target: https://ci.appveyor.com/project/saghul/python-fibers

Documentation

http://readthedocs.org/docs/python-fibers/

Installing

fibers can be installed via pip as follows:

::

pip install fibers

Building

Get the source:

::

git clone https://github.com/saghul/python-fibers

Linux:

::

./build_inplace

Mac OSX:

::

(XCode needs to be installed)
export ARCHFLAGS="-arch x86_64"
./build_inplace

Microsoft Windows:

::

python setup.py build_ext --inplace

Running the test suite

The test suite can be run using nose:

::

nosetests -v

Author

Saúl Ibarra Corretgé [email protected]

This project would not have been possible without the previous work done in the greenlet <http://greenlet.readthedocs.org>_ and stacklet (part of PyPy <http://pypy.org>_) projects.

License

Unless stated otherwise on-file fibers uses the MIT license, check LICENSE file.

Supported Python versions

Python >= 2.7 and >= 3.3 are supported. Other older Python versions might work, but they are not actively tested. CPython and PyPy are supported.

Supported architectures

x86, x86-64, ARM, MIPS64, PPC64 and s390x are supported.

Contributing

If you'd like to contribute, fork the project, make a patch and send a pull request. Have a look at the surrounding code and please, make yours look alike.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].