Skip to main content

Primer is a lightweight toolbox for debugging and benchmarking Python code.

Project description


Primer is a lightweight toolkit for debugging and benchmarking Python code.

With only one line inserted, primer improves your coding experience.

from primer import debug, profile, performance



  • Python >= 3.5
pip install primer-kit


Exception hook helps you debug your code whenever exception is raise.


Call decorator monitors every call to the function and its arguments.
def my_function(args):


Time and memory profilers measure the duration and memory allocation for some code.

with profile.time(), profile.memory():

They can also be used as decorators over functions. A log frequency of 10 outputs results once per 10 calls.

def my_function(args):


Slot decorator converts all member variables to static slots, which saves memory and runs faster.

class MyClass(object):

Shared ndarray can be passed across processes without copy, which saves memory by several times and runs faster.

import numpy as np
import multiprocessing as mp

arrays = [performance.SharedNDArray(np.random.rand(100000)) for _ in range(4)]
results = mp.Pool(4).map(np.sum, arrays)

Project details

Download files

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

Files for primer-kit, version 0.1.1a0
Filename, size File type Python version Upload date Hashes
Filename, size primer_kit-0.1.1a0-py3-none-any.whl (6.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size primer-kit-0.1.1a0.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page