Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

pypict: Python binding for Microsoft PICT

Project description

Travis PyPi


Python binding library for Microsoft PICT (Pairwise Independent Combinatorial Tool).


  • Microsoft PICT 3.7.1
  • Python 3.5 / 3.6 / 3.7 / 3.8 / 3.9


Wheels (binary distribution) are available for Linux (x86_64). The PICT shared library is included in wheels.

$ pip install pypict

On other platforms, you need to build from source. PICT source tree is registered as a submodule of this repository. python build_pict will run make command to build PICT shared library inside the tree. You need to manually install the shared library and command, or set path of the tree to the appropriate environment variables (PATH, LD_LIBRARY_PATH, etc.)

$ git clone --recursive pypict
$ cd pypict
$ python build_pict
$ pip install -U .
$ export PATH=${PWD}/pict:${PATH}


There are different layers of API provided in this library.

Low-level API (pypict.capi)

Low-level API provides Python functions that map to each PICT C API function.

>>> import pypict.capi
>>> task = pypict.capi.createTask()
>>> print(task)
>>> pypict.capi.deleteTask(task)

CLIDLL API (pypict.capi.execute), which accepts a PICT command line arguments and returns the output, is also available.

>>> import pypict.capi
>>> output = pypict.capi.execute(['example/example.model', '/o:2'])
>>> print(output)
Type    Size    Format method   File system     Cluster size    Compression
Mirror  100     Quick           FAT             2048            Off

Note that CLIDLL API directly writes to the stderr when warnings are generated.

You can use pypict module as a command that behaves like PICT command line tool (e.g., python -m pypict example/example.model /o:2).

High-level API (pypict.api)

High-level API wraps the low-level API to provide automatic memory management with RAII API.

>>> import pypict.api
>>> task = pypict.api.Task()
>>> task.model.add_parameter(2)
>>> task.model.add_parameter(3)
>>> list(task.generate())
[[1, 0], [0, 1], [1, 1], [0, 2], [1, 2], [0, 0]]

Command API (pypict.cmd)

Command API wraps the CLIDLL API.

>>> import pypict.cmd
>>> pypict.cmd.from_model('''
... X: 1, 2
... Y: 3, 4
... ''')
(['X', 'Y'], [['2', '4'], ['2', '3'], ['1', '4'], ['1', '3']])

Tools API ( - deprecated

Tools API wraps the high-level API to provide convenient features.

This API is deprecated since v0.2.0 as it does not scale with the model size. Use Command API instead.


params = {
    "Type":          ["Single", "Span", "Stripe", "Mirror", "RAID-5"],
    "Size":          ["10", "100", "500", "1000", "5000", "10000", "40000"],
    "Format method": ["Quick", "Slow"],
    "File system":   ["FAT", "FAT32", "NTFS"],
    "Cluster size":  ["512", "1024", "2048", "4096", "8192", "16384", "32768", "65536"],
    "Compression":   ["On", "Off"],

for case in

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 pypict, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pypict-0.2.0-cp35-cp35m-manylinux1_x86_64.whl (812.3 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pypict-0.2.0-cp36-cp36m-manylinux1_x86_64.whl (815.3 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pypict-0.2.0-cp37-cp37m-manylinux1_x86_64.whl (815.0 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pypict-0.2.0-cp38-cp38-manylinux1_x86_64.whl (815.7 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pypict-0.2.0-cp39-cp39-manylinux1_x86_64.whl (806.2 kB) File type Wheel Python version cp39 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