Skip to main content

Shed Skin is a restricted-Python-to-C++ compiler.

Project description

https://img.shields.io/travis/shedskin/shedskin.svg http://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=flat

Shed Skin

Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python (3.8+) programs into optimized C++. It can generate stand-alone programs or extension modules that can be imported and used in larger Python programs.

Besides the typing restriction, programs cannot freely use the Python standard library (although about 25 common modules, such as random and re, are currently supported). Also, not all Python features, such as nested functions and variable numbers of arguments, are supported (see the documentation for details).

For a set of 75 non-trivial programs (at over 25,000 lines in total (sloccount)), measurements show a typical speedup of 2-200 times over CPython.

Usage

::

shedskin test.py make ./test

Restrictions

Shed Skin only supports a restricted subset of Python, so one should not expect a given program to compile without any changes, if possible at all. See the documentation for an overview of the limitations.

Installation

Shed Skin depends on some others projects, such as the Boehm garbage collector. Please see the documentation on how to install these.

Comparison

Some timings for the shedskin ‘sieve’ example (n=100000000) and several Python implementations/optimizers:

cpython 3.10.6:   13.4 seconds
cpython 3.11.0:   11.4
nuitka 0.6.16:   11.4
pypy 3.9.12:     5.8
shedskin 0.9.6:  1.9

Screenhots

Some screenshots of the example programs in action:

https://raw.githubusercontent.com/shedskin/shedskin/master/examples/screenshots/harm3.png https://raw.githubusercontent.com/shedskin/shedskin/master/examples/screenshots/harm4.png https://raw.githubusercontent.com/shedskin/shedskin/master/examples/screenshots/harm2.png https://raw.githubusercontent.com/shedskin/shedskin/master/examples/screenshots/harm1.png

Contributors

The following people have contributed to Shed Skin development:

Shakeeb Alireza
Hakan Ardo
Brian Blais
Paul Boddie
François Boutines
Djamel Cherif
James Coughlan
Mark Dewing
Mark Dufour
Artem Egorkine
Michael Elkins
Moataz Elmasry
Enzo Erbano
Ernesto Ferro
Salvatore Ferro
FFAO
Victor Garcia
Luis M. Gonzales
Fahrzin Hemmati
Folkert van Heusden
Karel Heyse
Johan Kristensen
Kousuke
Denis de Leeuw Duarte
Van Lindberg
David Marek
Douglas McNeil
Andy Miller
Jeff Miller
Danny Milosavljevic
Joaquin Abian Monux
John Nagle
Harri Pasanen
Brent Pedersen
Joris van Rantwijk
Retsyo
Pierre-Marie de Rodat
Jérémie Roquet
Mike Schrick
SirNotAppearingInThisTutorial
Paul Sokolevsky
Thomas Spura
Joerg Stippa
Dan Stromberg
Dave Tweed
Jaroslaw Tworek
Tony Veijalainen
Pavel Vinogradov
Jason Ye
Liu Zhenhai
Joris van Zwieten

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shed-skin-0.9.6.tar.gz (278.5 kB view details)

Uploaded Source

Built Distribution

shed_skin-0.9.6-py3-none-any.whl (328.7 kB view details)

Uploaded Python 3

File details

Details for the file shed-skin-0.9.6.tar.gz.

File metadata

  • Download URL: shed-skin-0.9.6.tar.gz
  • Upload date:
  • Size: 278.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.6 Linux/5.15.0-56-generic

File hashes

Hashes for shed-skin-0.9.6.tar.gz
Algorithm Hash digest
SHA256 6e2bbe961d4f907691c5bd20092314bb44e2add4ea42550a058e11972297d284
MD5 a1382ea2521ef02241f50ea17b3ceb0d
BLAKE2b-256 3e5bd53bec3159a22048f1fd8097fd68245150aa3010d3e9569093ea4a9e5d41

See more details on using hashes here.

File details

Details for the file shed_skin-0.9.6-py3-none-any.whl.

File metadata

  • Download URL: shed_skin-0.9.6-py3-none-any.whl
  • Upload date:
  • Size: 328.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.6 Linux/5.15.0-56-generic

File hashes

Hashes for shed_skin-0.9.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e43dd9d82b9fd16217f1743b54d9c852da523c1998309db67e52eb2c4263b577
MD5 72ada67a0d9021b24f60f8bb0a164a7d
BLAKE2b-256 dcb30cbfd5ccc1e378d8cbfb344f46c146437c95903c4298ad851b1cb53add85

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page