Skip to main content

pypict: Python binding for Microsoft PICT

Project description

Travis PyPi

PyPICT

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

Requirements

  • Microsoft PICT 3.7.1

  • Python 3.5 / 3.6 / 3.7 / 3.8 / 3.9

Installation

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 setup.py 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 https://github.com/kmaehashi/pypict.git pypict
$ cd pypict
$ python setup.py build_pict
$ pip install -U .
$ export PATH=${PWD}/pict:${PATH}
$ export LD_LIBRARY_PATH=${PWD}/pict:${LD_LIBRARY_PATH}

APIs

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)
14042112
>>> 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)
19976288
>>> task.model.add_parameter(3)
20013488
>>> 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 (pypict.tools) - 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.

import pypict.tools

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 pypict.tools.from_dict(params):
    print(case)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pypict-0.2.0-cp39-cp39-manylinux1_x86_64.whl (806.2 kB view details)

Uploaded CPython 3.9

pypict-0.2.0-cp38-cp38-manylinux1_x86_64.whl (815.7 kB view details)

Uploaded CPython 3.8

pypict-0.2.0-cp37-cp37m-manylinux1_x86_64.whl (815.0 kB view details)

Uploaded CPython 3.7m

pypict-0.2.0-cp36-cp36m-manylinux1_x86_64.whl (815.3 kB view details)

Uploaded CPython 3.6m

pypict-0.2.0-cp35-cp35m-manylinux1_x86_64.whl (812.3 kB view details)

Uploaded CPython 3.5m

File details

Details for the file pypict-0.2.0-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: pypict-0.2.0-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 806.2 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for pypict-0.2.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0a02df976b6c1015403e2629b7022a57f8fb3f45c984cb15b4922ac59421b5db
MD5 9d7037e5f4d318e39870c8a09d61ad85
BLAKE2b-256 486fbf11f75b4c88c65d37965312cdd87c20cc070beec7473b19f0ee56e9ad12

See more details on using hashes here.

File details

Details for the file pypict-0.2.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: pypict-0.2.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 815.7 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for pypict-0.2.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 414eb45484837525a6ea2a4b5c57d8711df498bc51caaa91f50451e3f2469fe5
MD5 139c9c16603e0a9d403c03c179cd977f
BLAKE2b-256 00228cb12f05c7b9e1b5386035828a72cc58060bc945a7e3a53d8e3455860c76

See more details on using hashes here.

File details

Details for the file pypict-0.2.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pypict-0.2.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 815.0 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for pypict-0.2.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0298cce61c331cdb08812e9ab7703d772538612abd4c5c829c832f179b121a2d
MD5 5e788fc6b3810e434b1c053821ec4cbf
BLAKE2b-256 28e27c5aa978a5de5e4f5fe435d89f54429a343b4d53d2a4635ebf4e1c924ab5

See more details on using hashes here.

File details

Details for the file pypict-0.2.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pypict-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 815.3 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for pypict-0.2.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6ed6f41ff3046d49469bc15c62400739ddfdeb932f1b262c152a90ab0c5c345d
MD5 8cf34e2187ae4b39c8c3057614bbd4a6
BLAKE2b-256 d226b79e1713a8c19e55dfb8a316b510ecf40eee57e882feac5f27db051cbbd1

See more details on using hashes here.

File details

Details for the file pypict-0.2.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pypict-0.2.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 812.3 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for pypict-0.2.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3b20ca9a8658f7eab7275e46528d683157ce54177cf6678b1cad693dbd167ceb
MD5 0ad6d1ef0165d3e99324c8da11673984
BLAKE2b-256 86b62b3f4df29bfdc34132a787706c184341c6aa7206d7b2a7f1352c5816e4f3

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