All Projects â†’ haarcuba â†’ warp2

haarcuba / warp2

Licence: MIT License
access legacy Python 2 code from within Python 3

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to warp2

Obsolete Webpack Plugin
🌈 A Webpack plugin generates a browser-side standalone script that detects browser compatibility based on `Browserslist` and prompts website users to upgrade it.
Stars: ✭ 148 (+1038.46%)
Mutual labels:  compatibility
PHPUnit-Polyfills
Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests
Stars: ✭ 147 (+1030.77%)
Mutual labels:  compatibility
mpx-es-check
Checks the version of ES in JavaScript files with simple shell commands
Stars: ✭ 15 (+15.38%)
Mutual labels:  compatibility
Shims
Seamless interop layer between cats and scalaz
Stars: ✭ 174 (+1238.46%)
Mutual labels:  compatibility
BedrockBackwards
Connects older clients to newer servers
Stars: ✭ 24 (+84.62%)
Mutual labels:  compatibility
license-compatibility
Šī¸ Check compatibility between different SPDX licenses
Stars: ✭ 31 (+138.46%)
Mutual labels:  compatibility
Caniuse.email
HTML and CSS Compatibility tables for emails
Stars: ✭ 133 (+923.08%)
Mutual labels:  compatibility
dirname-filename-esm
__dirname and __filename for ES Modules environment
Stars: ✭ 57 (+338.46%)
Mutual labels:  compatibility
emulatetab
A jQuery plugin to emulate tabbing between elements on a page.
Stars: ✭ 15 (+15.38%)
Mutual labels:  compatibility
node-compat-require
Easily allow your Node program to run in a target node version range to maximize compatibility.
Stars: ✭ 22 (+69.23%)
Mutual labels:  compatibility
Doesitarm
đŸĻž A list of reported app support for Apple Silicon and the new Apple M1 Macs
Stars: ✭ 3,200 (+24515.38%)
Mutual labels:  compatibility
php-compatinfo
Library that find out the minimum version and the extensions required for a piece of code to run
Stars: ✭ 361 (+2676.92%)
Mutual labels:  compatibility
oconfigure
configuration script for BSD.lv projects
Stars: ✭ 36 (+176.92%)
Mutual labels:  compatibility
Lua Compat 5.3
Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1
Stars: ✭ 153 (+1076.92%)
Mutual labels:  compatibility
graphene
Graphene / Graphene-SGX - a library OS for Linux multi-process applications, with Intel SGX support
Stars: ✭ 741 (+5600%)
Mutual labels:  compatibility
Stylecow
Modern CSS to all browsers
Stars: ✭ 147 (+1030.77%)
Mutual labels:  compatibility
compat-db
A browser API compatibility database
Stars: ✭ 61 (+369.23%)
Mutual labels:  compatibility
CompatibilityManager
Windows app for bulk editing compatibility settings.
Stars: ✭ 115 (+784.62%)
Mutual labels:  compatibility
trivial-with-current-source-form
Helps macro writers produce better errors for macro users
Stars: ✭ 22 (+69.23%)
Mutual labels:  compatibility
pg global temp tables
Oracle-style global temporary tables for PostgreSQL
Stars: ✭ 16 (+23.08%)
Mutual labels:  compatibility

Warp 2

Warp 2 wraps Python 2 code and allows access to it by running in in a subprocess.

It communicates with the subprocess using pickle, so there are limitation to using it - if you need to send unpicklable data, that's a problem.

Installation

$ pip install warp2

Example

here's a Python 2 class of a greeter that tracks a word count:

# this is in Python 2
import collections

class Greeter( object ):
    def __init__( self ):
        self._counts = collections.defaultdict( lambda: 0 )

    def say( self, what ):
        print what
        self._counts[ what ] += 1
        return 'said: {}'.format( what )

    def counts( self ):
        return dict( self._counts )

here's how to use it from Python 3, note that you must provide a thing object for the Warp 2 library to use:

# this is in Python 3
import warp2.warper
import random

greeter = warp2.warper.Warper( 'import greeter ; thing=greeter.Greeter()' )

for _ in range( 10 ):
    greeting = random.choice( [ 'hi', 'hello', "what's up", 'how are you' ] )
    greeter.say( greeting )

print( "summary: " )
print( greeter.counts() )

Here's how to run this example from the root of this project (once warp2 is installed of course)

$ PYTHONPATH=examples/ python examples/three.py 
what's up
hello
how are you
what's up
how are you
hello
hi
how are you
hi
what's up
summary: 
{'how are you': 3, 'hi': 2, 'hello': 2, "what's up": 3}
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].