|
| 1 | +|Travis|_ |PyPi|_ |
| 2 | + |
| 3 | +.. |Travis| image:: https://api.travis-ci.com/kmaehashi/pypict.svg?branch=master |
| 4 | +.. _Travis: https://travis-ci.org/kmaehashi/pypict |
| 5 | + |
| 6 | +.. |PyPi| image:: https://badge.fury.io/py/pypict.svg |
| 7 | +.. _PyPi: https://badge.fury.io/py/pypict |
| 8 | + |
| 9 | + |
| 10 | +PyPICT |
| 11 | +====== |
| 12 | + |
| 13 | +Python binding library for `Microsoft PICT <https://github.com/Microsoft/pict>`__ (Pairwise Independent Combinatorial Tool). |
| 14 | + |
| 15 | +Requirements |
| 16 | +------------ |
| 17 | + |
| 18 | +* Microsoft PICT |
| 19 | +* Python 2.7, 3.4, 3.5 or 3.6 |
| 20 | + |
| 21 | +Installation |
| 22 | +------------ |
| 23 | + |
| 24 | +Wheels (binary distribution) are available for Linux. |
| 25 | +PICT shared library and command are included in wheels. |
| 26 | + |
| 27 | +:: |
| 28 | + |
| 29 | + $ pip install pypict |
| 30 | + |
| 31 | +On other platforms, you need to build from source. |
| 32 | +PICT source tree is registered as a submodule of this repository. |
| 33 | +``python setup.py build_pict`` will run ``make`` command to build PICT shared library inside the tree. |
| 34 | +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.) |
| 35 | + |
| 36 | +:: |
| 37 | + |
| 38 | + $ git clone https://github.com/kmaehashi/pypict.git |
| 39 | + $ cd pypict |
| 40 | + $ git submodule init |
| 41 | + $ git submodule update |
| 42 | + $ python setup.py build_pict |
| 43 | + $ pip install -U . |
| 44 | + $ export PATH=${PWD}/pict:${PATH} |
| 45 | + $ export LD_LIBRARY_PATH=${PWD}/pict:${LD_LIBRARY_PATH} |
| 46 | + |
| 47 | +APIs |
| 48 | +---- |
| 49 | + |
| 50 | +There are four different APIs provided in this library. |
| 51 | +Generally, you only need to use Tools API (``pypict.tools``). |
| 52 | + |
| 53 | +* Low-level API (``pypict.capi``) provides Python functions that map to each `PICT C API function <https://github.com/Microsoft/pict/blob/master/api/pictapi.h>`__. |
| 54 | +* High-level API (``pypict.api``) wraps the low-level API to provide automatic memory management. |
| 55 | +* Tools API (``pypict.tools``) wraps the high-level API to provide convenient features. |
| 56 | +* Command API (``pypict.cmd``) is a thin wrapper for ``pict`` command. |
| 57 | + This API uses PICT command directly instead of PICT shared library. |
| 58 | + |
| 59 | +Example |
| 60 | +------- |
| 61 | + |
| 62 | +Here is an example usage of Tools API to generate pair-wise patterns from parameter set. |
| 63 | + |
| 64 | +.. code-block:: python |
| 65 | +
|
| 66 | + import pypict.tools |
| 67 | +
|
| 68 | + params = { |
| 69 | + "Type": ["Single", "Span", "Stripe", "Mirror", "RAID-5"], |
| 70 | + "Size": ["10", "100", "500", "1000", "5000", "10000", "40000"], |
| 71 | + "Format method": ["Quick", "Slow"], |
| 72 | + "File system": ["FAT", "FAT32", "NTFS"], |
| 73 | + "Cluster size": ["512", "1024", "2048", "4096", "8192", "16384", "32768", "65536"], |
| 74 | + "Compression": ["On", "Off"], |
| 75 | + } |
| 76 | +
|
| 77 | + for case in pypict.tools.from_dict(params): |
| 78 | + print(case) |
0 commit comments