{"id":15009954,"url":"https://github.com/haarcuba/warp2","last_synced_at":"2025-08-20T15:39:33.844Z","repository":{"id":62588212,"uuid":"93274630","full_name":"haarcuba/warp2","owner":"haarcuba","description":"access legacy Python 2 code from within Python 3","archived":false,"fork":false,"pushed_at":"2017-06-03T23:23:04.000Z","size":12,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T19:51:32.096Z","etag":null,"topics":["compatibility","embed-python2-in-python3","legacy-python","python","python-2","python-3","python2","python3"],"latest_commit_sha":null,"homepage":"https://haarcuba.github.io/warp2/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haarcuba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-03T21:23:23.000Z","updated_at":"2023-09-17T14:51:02.000Z","dependencies_parsed_at":"2022-11-03T17:49:38.202Z","dependency_job_id":null,"html_url":"https://github.com/haarcuba/warp2","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haarcuba%2Fwarp2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haarcuba%2Fwarp2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haarcuba%2Fwarp2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haarcuba%2Fwarp2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haarcuba","download_url":"https://codeload.github.com/haarcuba/warp2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248083313,"owners_count":21045072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compatibility","embed-python2-in-python3","legacy-python","python","python-2","python-3","python2","python3"],"created_at":"2024-09-24T19:29:16.424Z","updated_at":"2025-04-09T17:52:25.594Z","avatar_url":"https://github.com/haarcuba.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Warp 2\n\nWarp 2 wraps Python 2 code and allows access to it by running in in a subprocess.\n\nIt communicates with the subprocess using [pickle](https://docs.python.org/3.6/library/pickle.html), so there are limitation to using it - if you need to send unpicklable data, that's a problem.\n\n## Installation\n\n    $ pip install warp2\n\n## Example\n\nhere's a Python 2 class of a greeter that tracks a word count:\n\n```python\n# this is in Python 2\nimport collections\n\nclass Greeter( object ):\n    def __init__( self ):\n        self._counts = collections.defaultdict( lambda: 0 )\n\n    def say( self, what ):\n        print what\n        self._counts[ what ] += 1\n        return 'said: {}'.format( what )\n\n    def counts( self ):\n        return dict( self._counts )\n```\n\nhere's how to use it from Python 3, note that you must provide a `thing` object for the Warp 2 library to use:\n\n```python\n# this is in Python 3\nimport warp2.warper\nimport random\n\ngreeter = warp2.warper.Warper( 'import greeter ; thing=greeter.Greeter()' )\n\nfor _ in range( 10 ):\n    greeting = random.choice( [ 'hi', 'hello', \"what's up\", 'how are you' ] )\n    greeter.say( greeting )\n\nprint( \"summary: \" )\nprint( greeter.counts() )\n```\n\nHere's how to run this example from the root of this project (once warp2 is installed of course)\n\n    $ PYTHONPATH=examples/ python examples/three.py \n    what's up\n    hello\n    how are you\n    what's up\n    how are you\n    hello\n    hi\n    how are you\n    hi\n    what's up\n    summary: \n    {'how are you': 3, 'hi': 2, 'hello': 2, \"what's up\": 3}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaarcuba%2Fwarp2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaarcuba%2Fwarp2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaarcuba%2Fwarp2/lists"}