Skip to main content

Build Status benchmarked by asv

Shed Skin

Shed Skin is a transpiler, that can translate pure, but implicitly statically typed Python 3 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) or any other external library. 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 over 80 non-trivial programs (at over 25,000 lines in total (sloccount)), measurements show a typical speedup of 1-100 times over CPython 3.14 (average 20 times, median 12 times).

Use Shed Skin when:

  • You have a few hundred lines of code (up to a few thousand), that you want to run at the highest possible speed
  • This code is, or can be made, independent of external libraries
  • You don't want to switch to a faster language (for reasons), or add type annotations (e.g. use Cython)
  • You would prefer to stick with CPython as your (main) interpreter (e.g. no PyPy)
  • You don't mind refactoring your code (potentially a lot!) to make it compatible with Shed Skin

Usage

Compile and run the 'hello, world!' (test.py) example under Linux/OSX:

shedskin build test
build/test

Under Windows:

shedskin build test
build\test.exe

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. You may have to work a lot, or even start from scratch, to make your code compatible. See the documentation for an overview of the limitations.

Installation

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

Comparison

Some timings for the Shed Skin '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
numba 0.56.4:       2.5
shedskin 0.9.9:     1.9  (--int32)
shedskin 0.9.9:     1.8  (--int32 --nowrap --nobounds)

Note that Numba defaults to int64 as integer type, or it would be just as fast; Shed Skin now also defaults to int64 (use --int32 for the narrower, previously-default type).

The following shows a comparison of speedups versus CPython for Shed Skin and PyPy, for most of the Shed Skin examples.

The average speedup versus CPython 3.14.4 for these examples is 34.2x (median 19.5x). The average speedup versus PyPy 7.3.20 is 5.0x (median 2.7x). As can be seen, we allowed PyPy to stabilize before measuring.

Screenshots

Some screenshots of the example programs in action:

(pylot)

(c64)

(pycsg)

(othello2)

(another_world)

(doom)

This video shows the dramatic difference in performance for the DOOM example before and after compilation

Contributors

The following people have contributed to Shed Skin development:

  • Shakeeb Alireza
  • Hakan Ardo
  • Brian Blais
  • Paul Boddie
  • Francois Boutines
  • Wyatt S. Carpenter
  • Djamel Cherif
  • James Coughlan
  • Mark Dewing
  • Mark Dufour
  • Artem Egorkine
  • Michael Elkins
  • Moataz Elmasry
  • Enzo Erbano
  • Ernesto Ferro
  • Salvatore Ferro
  • FFAO
  • Victor Garcia
  • Davide Gessa
  • Luis M. Gonzales
  • Fahrzin Hemmati
  • Folkert van Heusden
  • Karel Heyse
  • Humhue
  • 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
  • Jeremie Roquet
  • Tomek Rozen
  • Mike Schrick
  • SirNotAppearingInThisTutorial
  • Paul Sokolevsky
  • Thomas Spura
  • Joerg Stippa
  • Dan Stromberg
  • Dave Tweed
  • Jaroslaw Tworek
  • Tony Veijalainen
  • Yuri Victorovich
  • Pavel Vinogradov
  • Jason Ye
  • Liu Zhenhai
  • Joris van Zwieten

TurboPython is a similar restricted-Python to C++ language/transpiler, but adds RUST-like memory management.

Metadata

Release files for shed-skin 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shed-skin 1.0
File Size Uploaded Provenance Actions
shed_skin-1.0.tar.gz 6.4 MB Without provenance Details for shed_skin-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shed-skin 1.0
File Interpreter ABI Platform Actions
shed_skin-1.0-py3-none-any.whl Python 3 none any Details for shed_skin-1.0-py3-none-any.whl

Total release size: 8.6 MB

Release files / shed_skin-1.0.tar.gz

Download URL shed_skin-1.0.tar.gz
Size 6.4 MB
Tags Source
SHA-256 checksum
How to use checksums
fdc5e1a5b2954cf6207428dd1ed3fd20dc0bffefc7f510a95fea96530d18e746
BLAKE2b-256 checksum
How to use checksums
488e34de87f0e6af2a0ad94161c42616ed9ebb604f339eab2a1ec8b36d51849c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / shed_skin-1.0-py3-none-any.whl

Download URL shed_skin-1.0-py3-none-any.whl
Size 2.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
24ea7dc0ff233470bfda931f414f2bdf6bbfd729f5bf7d949426dabf9061b26d
BLAKE2b-256 checksum
How to use checksums
8e3fba3c2cbb4e96e22ceaacdc814ffdeaa2900b3e41004d35b29301dcf46b32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for shed-skin 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

0.9.4

0.9.1

0.9

0.8

0.7.1

0.7

0.6

0.5

0.4

0.3

0.2

0.1.1

0.1

0.0.30

0.0.29

0.0.28

0.0.27

0.0.26

0.0.25

0.0.23

0.0.22

0.0.21

0.0.20

0.0.19

0.0.18

0.0.17

0.0.16

0.0.15

0.0.14

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page