1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689
|
Metadata-Version: 2.4
Name: zstd
Version: 1.5.7.3
Summary: ZSTD Bindings for Python
Home-page: https://github.com/sergey-dryabzhinsky/python-zstd
Author: Sergey Dryabzhinsky, Anton Stuk
Author-email: sergey.dryabzhinsky@gmail.com
Maintainer: Sergey Dryabzhinsky
Maintainer-email: sergey.dryabzhinsky@gmail.com
License: BSD
Keywords: zstd,zstandard,compression
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: POSIX
Classifier: Programming Language :: C
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: maintainer
Dynamic: maintainer-email
Dynamic: summary
=============
python-zstd
=============
.. |Downloads| image:: https://static.pepy.tech/badge/zstd
:target: (https://pepy.tech/project/zstd)
.. |monthly| image:: https://static.pepy.tech/badge/zstd/month
:target: https://pepy.tech/project/zstd)
.. |weekly| image:: https://static.pepy.tech/badge/zstd/week
:target: https://pepy.tech/project/zstd
.. |releaseW| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/build-wheels.yml/badge.svg?tag=v1.5.7.2
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/build-wheels.yml
.. |masterW| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/build-wheels.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/build-wheels.yml
.. |cpython27x64| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_x86_64.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_x86_64.yml
.. |cpython27x86| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_x86.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_x86.yml
.. |cpython27x86ext| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_x86_ext.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_x86_ext.yml
.. |cpython27armhf| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_armhf.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython27_armhf.yml
.. |cpython34x86| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython34_x86.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython34_x86.yml
.. |cpython34x64| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython34_x86_64.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython34_x86_64.yml
.. |cpython35x86| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython35_x86.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython35_x86.yml
.. |cpython35x64| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython35_x86_64_u20.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython35_x86_64_u20.yml
.. |cpython36x86| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython36_x86.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython36_x86.yml
.. |cpython36x64| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython36_x86_64_u20.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython36_x86_64_u20.yml
.. |cpython37x86| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython37_x86.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython37_x86.yml
.. |cpython37x64| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython37_x86_64_u24.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython37_x86_64_u24.yml
.. |cpython38x86| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython38_x86.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython38_x86.yml
.. |cpython38x64| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython38_x86_64_u24.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython38_x86_64_u24.yml
.. |cpython39x86| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython39_x86.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython39_x86.yml
.. |cpython39x64| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython39_x86_64_u24.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython39_x86_64_u24.yml
.. |cpython310x86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython310_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython310_x86_u16.yml
.. |cpython310x64u20| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython310_x86_64_u24.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython310_x86_64_u24.yml
.. |cpython311x86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython311_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython311_x86_u16.yml
.. |cpython311x64u20| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython311_x86_64_u24.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython311_x86_64_u24.yml
.. |cpython312x86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython312_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython312_x86_u16.yml
.. |cpython312x64u20| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython312_x86_64_u20.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython312_x86_64_u20.yml
.. |cpython313x64u20| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313_x86_64_u24.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313_x86_64_u24.yml
.. |cpython313x86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313_x86_u16.yml
.. |cpython313tx64u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313t_x64_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313t_x64_u16.yml
.. |cpython313tx86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313t_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython313t_x86_u16.yml
.. |cpython314x64u20| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314_x86_64_u24.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314_x86_64_u24.yml
.. |cpython314tx64u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314t_x64_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314t_x64_u16.yml
.. |cpython314tx86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314t_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314t_x86_u16.yml
.. |cpython314x86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython314_x86_u16.yml
.. |cpython315x64u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315_x86_64_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315_x86_64_u16.yml
.. |cpython315x86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315_x86_u16.yml
.. |cpython315tx64u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315t_x64_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315t_x64_u16.yml
.. |cpython315tx86u16| image:: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315t_x86_u16.yml/badge.svg
:target: https://github.com/sergey-dryabzhinsky/python-zstd/actions/workflows/Build_wheels_for_cpython315t_x86_u16.yml
|Downloads| |monthly| |weekly|
+----------------------------+----------------------+
| wheels for: | status |
+============================+======================+
| cpython 2.7 x86 u18 | |cpython27x86| |
+----------------------------+----------------------+
| cpython 2.7 x86 u18 ext | |cpython27x86ext| |
+----------------------------+----------------------+
| cpython 2.7 x64 u18 | |cpython27x64| |
+----------------------------+----------------------+
| cpython 2.7 armhf u18 | |cpython27armhf| |
+----------------------------+----------------------+
| cpython 3.4 x86 u16 | |cpython34x86| |
+----------------------------+----------------------+
| cpython 3.4 x64 u16 | |cpython34x64| |
+----------------------------+----------------------+
| cpython 3.5 x86 u16 | |cpython35x86| |
+----------------------------+----------------------+
| cpython 3.5 x64 u16 | |cpython35x64| |
+----------------------------+----------------------+
| cpython 3.6 x86 u16 | |cpython36x86| |
+----------------------------+----------------------+
| cpython 3.6 x64 u16 | |cpython36x64| |
+----------------------------+----------------------+
| cpython 3.7 x86 u16 | |cpython37x86| |
+----------------------------+----------------------+
| cpython 3.7 x64 u16 | |cpython37x64| |
+----------------------------+----------------------+
| cpython 3.8 x86 u16 | |cpython38x86| |
+----------------------------+----------------------+
| cpython 3.8 x64 u16 | |cpython38x64| |
+----------------------------+----------------------+
| cpython 3.9 x86 u16 | |cpython39x86| |
+----------------------------+----------------------+
| cpython 3.9 x64 u16 | |cpython39x64| |
+----------------------------+----------------------+
| cpython 3.10 x86 u16 | |cpython310x86u16| |
+----------------------------+----------------------+
| cpython 3.10 x64 u16 | |cpython310x64u20| |
+----------------------------+----------------------+
| cpython 3.11 x86 u16 | |cpython311x86u16| |
+----------------------------+----------------------+
| cpython 3.11 x64 u16 | |cpython311x64u20| |
+----------------------------+----------------------+
| cpython 3.12 x86 u16 | |cpython312x86u16| |
+----------------------------+----------------------+
| cpython 3.12 x64 u16 | |cpython312x64u20| |
+----------------------------+----------------------+
| cpython 3.13 x64 u22 | |cpython313x64u20| |
+----------------------------+----------------------+
| cpython 3.13 x86 u22 | |cpython313x86u16| |
+----------------------------+----------------------+
| cpython 3.13 noGIL x64 u22 | |cpython313tx64u16| |
+----------------------------+----------------------+
| cpython 3.13 noGIL x86 u16 | |cpython313tx86u16| |
+----------------------------+----------------------+
| cpython 3.14 x64 u16 | |cpython314x64u20| |
+----------------------------+----------------------+
| cpython 3.14 noGIL x64 u16 | |cpython314tx64u16| |
+----------------------------+----------------------+
| cpython 3.14 noGIL x86 u16 | |cpython314tx86u16| |
+----------------------------+----------------------+
| cpython 3.14 x86 u16 | |cpython314x86u16| |
+----------------------------+----------------------+
| cpython 3.15 x64 u16 | |cpython315x64u16| |
+----------------------------+----------------------+
| cpython 3.15 x86 u16 | |cpython315x86u16| |
+----------------------------+----------------------+
| cpython 3.15 noGIL x64 u16 | |cpython315tx64u16| |
+----------------------------+----------------------+
| cpython 3.15 noGIL x86 u16 | |cpython315tx86u16| |
+----------------------------+----------------------+
| Release | |releaseW| |
| 1.5.7.2 | |
+----------------------------+----------------------+
| Master | |masterW| |
+----------------------------+----------------------+
Simple python bindings to Yann Collet ZSTD compression library.
**Zstd**, short for Zstandard, is a new lossless compression algorithm,
which provides both good compression ratio *and* speed for your standard compression needs.
"Standard" translates into everyday situations which neither look for highest possible ratio
(which LZMA and ZPAQ cover) nor extreme speeds (which LZ4 covers).
It is provided as a BSD-license package, hosted on GitHub_.
.. _GitHub: https://github.com/facebook/zstd
WARNING!!!
----------
If you setup 1.0.0.99.1 version - remove it manualy to able to update.
PIP matching version strings not tuple of numbers.
Result generated by versions prior to 1.0.0.99.1 is not compatible with orignial Zstd
by any means. It generates custom header and can be read only by zstd python module.
As of 1.0.0.99.1 version it uses standard Zstd output, not modified.
To prevent data loss there is two functions now: ```compress_old``` and ```decompress_old```.
They are works just like in old versions prior to 1.0.0.99.1.
As of 1.1.4 version module build without them by default.
As of 1.3.4 version these functions are deprecated and will be removed in future releases.
As of 1.5.0 version these functions are removed.
DISCLAIMER
__________
These python bindings are kept simple and blunt.
Support of dictionaries and streaming is not planned.
LINKS
-----
* Zstandard: https://github.com/facebook/zstd
* More full-featured and compatible with Zstandard python bindings by Gregory Szorc: https://github.com/indygreg/python-zstandard
Build from source
-----------------
You need module setuptools <72 to run tests:
>>> $ pip install -U 'setuptools<72'
>>> $ git clone https://github.com/sergey-dryabzhinsky/python-zstd
>>> $ git submodule update --init
>>> $ apt-get install python-dev python3-dev python-setuptools python3-setuptools
>>> $ python setup.py build_ext clean
>>> $ python3 setup.py build_ext clean
And you need to install `libzstd` developer files at least version *1.4.0*:
>>> $ dnf install -y libzstd-devel
# or
>>> $ apt install -y libzstd-dev
# or
>>> $ apk add zstd-dev
or do manual installation of zstd from source.
And you need C99 support in compiler (gcc >= 4.8), libc >= 2.14.
Note: Zstd legacy format support disabled by default.
To build with Zstd legacy versions support - pass ``--legacy`` option to setup.py script:
>>> $ python setup.py build_ext --legacy clean
When using a PEP 517 builder you can use ``ZSTD_LEGACY`` environment variable instead:
>>> $ ZSTD_LEGACY=1 python -m build -w
Note: Python-Zstd legacy format support removed since 1.5.0.
If you need to convert old data - checkout 1.4.9.1 module version. Support of it disabled by default.
To build with python-zstd legacy format support (pre 1.1.2) - pass ``--pyzstd-legacy`` option to setup.py script:
>>> $ python setup.py build_ext --pyzstd-legacy clean
But beware! Legacy formats support state is unknown in this case.
And if your version not equal with python-zstd - tests may not pass.
If you're scared of threads you may pass option `--libzstd-no-threads`:
>>> $ python setup.py build_ext --libzstd-no-threads clean
When using a PEP 517 builder you can use ``ZSTD_THREADS`` environment variable instead:
>>> $ ZSTD_THREADS=0 python -m build -w
If you're want to enable some speedup (maybe) you may try to enable built-in optimizations and pass option `--libzstd-use-asm`:
>>> $ python setup.py build_ext --libzstd-use-asm clean
Or add more speed with option `--libzstd-use-asm-bmi2` to use instructions for new AMD CPU.
When using a PEP 517 builder you can use ``ZSTD_ASM`` environment variable instead:
And ``ZST_ASM_BMI2=1`` too for bmi2 use.
>>> $ ZSTD_ASM=1 python -m build -w
If you want to build smaller module by size try to use option `--small`, but it will work slower.
>>> $ python setup.py build_ext --small clean
When using a PEP 517 builder you can use ``ZSTD_SMALL`` environment variable instead:
>>> $ ZSTD_SMALL=1 python -m build -w
If you want to build faster module try to use options `--speed3`, `--speed1`, `--speed2`, which corresponds with gcc options `-O3, -O1, -O2`.
>>> $ python setup.py build_ext --speed1 clean
When using a PEP 517 builder you can use ``ZSTD_SPEED3`` (default), `ZSTD_SPEED1`, `ZSTD_SPEED2` environment variables instead:
>>> $ ZSTD_SPEED2=1 python -m build -w
If you want to build even faster module try to use option `--speed-max`, but it will be optimized to your procesor only, similar to gcc options `-O3 -march=native`.
>>> $ python setup.py build_ext --speed-max clean
When using a PEP 517 builder you can use ``ZSTD_SPEEDMAX`` environment variable instead:
>>> $ ZSTD_SPEEDMAX=1 python -m build -w
If you want to build with existing distribution of libzstd just add ``--external`` option
>>> $ python setup.py build_ext --external clean
When using a PEP 517 builder you can use ``ZSTD_EXTERNAL`` environment variable instead:
>>> $ ZSTD_EXTERNAL=1 python -m build -w
If you want to build with a lot of debug output to stderr just add ``--debug`` option
>>> $ python setup.py build_ext --debug clean
When using a PEP 517 builder you can use ``ZSTD_DEBUG`` environment variable instead:
>>> $ ZSTD_DEBUG=1 python -m build -w
If you want to build with a lot more of debug output to stderr just add ``--debug-notice`` option
>>> $ python setup.py build_ext --debug-notice clean
When using a PEP 517 builder you can use ``ZSTD_DEBUG_NOTICE`` environment variable instead:
>>> $ ZSTD_DEBUG_NOTICE=1 python -m build -w
If you want to build with a lot more of debug output to stderr just add ``--debug-info`` option
>>> $ python setup.py build_ext --debug-info clean
When using a PEP 517 builder you can use ``ZSTD_DEBUG_INFO`` environment variable instead:
>>> $ ZSTD_DEBUG_INFO=1 python -m build -w
Some python builds need to force disabing LTO, so just add ``--force-no-lto`` option
>>> $ python setup.py build_ext --force-no-lto clean
When using a PEP 517 builder you can use ``ZSTD_BUILD_NO_LTO`` environment variable instead:
>>> $ ZSTD_BUILD_NO_LTO=1 python -m build -w
Some python builds need to force enabling stripping binary of the module, so just add ``--force-strip`` option
>>> $ python setup.py build_ext --force-strip clean
When using a PEP 517 builder you can use ``ZSTD_BUILD_STRIP`` environment variable instead:
>>> $ ZSTD_BUILD_STRIP=1 python -m build -w
If paths to header file ``zstd.h`` and libraries is uncommon - use common ``build`` params:
--libraries --include-dirs --library-dirs.
>>> $ python setup.py build_ext --external --include-dirs /opt/zstd/usr/include --libraries zstd --library-dirs /opt/zstd/lib clean
But If you want to force build with bundled distribution of libzstd just add ``--
libzstd-bundled`` option
>>> $ python setup.py build_ext --libzstd-bundled clean
When using a PEP 517 builder you can use ``ZSTD_BUNDLED`` environment variable instead:
>>> $ ZSTD_BUNDLED=1 python -m build -w
If you want to check if build w/o any warnings just add ``--
all-warnings`` option
>>> $ python setup.py build_ext --all-warnings clean
When using a PEP 517 builder you can use ``ZSTD_WARNINGS`` environment variable instead:
>>> $ ZSTD_WARNINGS=1 python -m build -w
If you want to treat all warnings as errors just add ``--all-warnings-errors`` option
>>> $ python setup.py build_ext --all-warnings-errors clean
When using a PEP 517 builder you can use ``ZSTD_WERRORS`` environment variable instead:
>>> $ ZSTD_WERRORS=1 python -m build -w
When using a PEP 517 builder you can use ``ZSTD_FULLTIME_TESTS`` environment variable, to run tests with fulltime length:
>>> $ ZSTD_FULLTIME_TESTS=1 python setup.py test
Install from pypi
-----------------
>>> # for Python 2.7+
>>> $ pip install zstd
>>> # or for Python 3.4+
>>> $ pip3 install zstd
API
___
Error
Standard python Exception for zstd module
ZSTD_compress (data[, level, threads, strict]): string|bytes
Function, compress input data block via mutliple threads, return compressed block, or raises Error.
Params:
* **data**: string|bytes - input data block, length limited by 2Gb by Python API
* **level**: int - compression level, ultra-fast levels from -100 (ultra) to -1 (fast) available since zstd-1.3.4, and from 1 (fast) to 22 (slowest), 0 or unset - means default (3). Default - 3.
* **threads**: int - how many threads to use, from 0 to 200, 0 or unset - auto-tune by cpu cores count. Default - 0. Since: 1.4.4.1
* **strict**: int - strict behaviour, raise `zstd.Error` if threads number or compression level is beyond limitations. Default - 0. Since: 1.5.6.3
Aliases:
- *compress(...)*,
- *dumps(...)*,
- *encode(...)* since: 1.5.6.2
Exception if:
- level bigger than max level
Max number of threads:
- 32bit system: 64
- 64bit system: 256
If provided bigger number - silently set maximber (since 1.5.4.1)
Since: 0.1
ZSTD_uncompress (data): string|bytes
Function, decompress input compressed data block, return decompressed block, or raises Error.
Support compressed data with multiple/concatenated frames (blocks) (since 1.5.5.1).
Support streamed data, since 1.5.6.8.
Params:
* **data**: string|bytes - input compressed data block, length limited by 2Gb by Python API
Aliases:
- *decompress(...)*,
- *uncompress(...)*,
- *loads(...)*,
- *decode(...)* since: 1.5.6.2
Since: 0.1
ZSTD_check (data): int
Function, checks if input is zstd compressed data block, and returns: 1 if yes, 0 if no or 2 if it is a stream data.
Support compressed data with multiple/concatenated frames (blocks) .
Params:
* **data**: string|bytes - input compressed data block, length limited by 2Gb by Python API
Aliases:
- *check(...)*,
- *verify(...)* since: 1.5.6.3
Since: 1.5.6.2
version (): string|bytes
Returns this module doted version string.
The first three digits are folow libzstd version.
Fourth digit - module revision number for that version.
Since: 1.3.4.3
ZSTD_version (): string|bytes
Returns ZSTD library doted version string, with which are compiled.
Since: 1.3.4.3
Aliases:
- ZSTD_version_compiled (): string|bytes Since: 1.5.7.3
ZSTD_version_loaded (): string|bytes
Returns ZSTD library doted version string, with which currently loaded.
Since: 1.5.7.3
ZSTD_version_number (): int
Returns ZSTD library version, compiled with, in format: MAJOR*100*100 + MINOR*100 + RELEASE.
Since: 1.3.4.3
ZSTD_threads_count (): int
Returns ZSTD determined CPU cores count.
Better to get this nuber as early as possible befor compression starts.
Since: 1.5.4.1
ZSTD_max_threads_count (): int
Returns ZSTD library determined maximum working threads count.
Since: 1.5.4.1
ZSTD_max_compression_level (): int
Returns ZSTD library determined maximum number of compression level .
Since: 1.5.6.3
ZSTD_min_compression_level (): int
Returns ZSTD library determined minimum number of compression level .
Since: 1.5.6.3
ZSTD_default_compression_level (): int
Returns ZSTD library determined default number of compression level .
Since: 1.5.7.1
ZSTD_external (): int
Returns 0 of 1 if ZSTD library linked as external.
Since: 1.5.0.2
ZSTD_legacy_support (): int
Returns 0 of 1 if ZSTD library built with legacy formats support.
Since: 1.5.6.3
ZSTD_with_threads (): int
Returns 0 of 1 if bundled ZSTD library build with threads support.
Since: 1.5.6.2
ZSTD_with_asm (): int
Returns 0 of 1 if bundled ZSTD library build with asm optimizations.
Since: 1.5.6.2
ZSTD_is_debug_enable (): int
Returns 0 of 1 if module built with debug output.
Since: 1.5.7.1
ZSTD_is_debug_notice_enable (): int
Returns 0 of 1 if module built with debug output - notice level.
Since: 1.5.7.1
ZSTD_is_debug_info_enable (): int
Returns 0 of 1 if module built with debug output - info level.
Since: 1.5.7.1
ZSTD_is_debug_error_enable (): int
Returns 0 of 1 if module built with debug output - error level.
Since: 1.5.7.1
Removed
_______
ZSTD_compress_old (data[, level]): string|bytes
Function, compress input data block, return compressed block, or raises Error.
**DEPRECATED**: Returns not compatible with ZSTD block header
**REMOVED**: since 1.5.0
Params:
* **data**: string|bytes - input data block, length limited by 2Gb by Python API
* **level**: int - compression level, ultra-fast levels from -5 (ultra) to -1 (fast) available since zstd-1.3.4, and from 1 (fast) to 22 (slowest), 0 or unset - means default (3). Default - 3.
Since: 1.0.0.99.1
ZSTD_uncompress_old (data): string|bytes
Function, decompress input compressed data block, return decompressed block, or raises Error.
**DEPRECATED**: Accepts data with not compatible with ZSTD block header
**REMOVED**: since 1.5.0
Params:
* **data**: string|bytes - input compressed data block, length limited by 2Gb by Python API
Since: 1.0.0.99.1
Use
___
Module has simple API:
>>> import zstd
>>> dir(zstd)
['Error', 'ZSTD_compress', 'ZSTD_external', 'ZSTD_uncompress', 'ZSTD_version', 'ZSTD_version_number', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'compress', 'decompress', 'dumps', 'loads', 'uncompress', 'version']
>>> zstd.version()
'1.5.1.0'
>>> zstd.ZSTD_version()
'1.5.1'
>>> zstd.ZSTD_version_number()
10501
>>> zstd.ZSTD_external()
0
In python2
>>> data = "123456qwert"
In python3 use bytes
>>> data = b"123456qwert"
>>> cdata = zstd.compress(data, 1)
>>> data == zstd.decompress(cdata)
True
>>> cdata_mt = zstd.compress(data, 1, 4)
>>> cdata == cdata_mt
True
>>> data == zstd.decompress(cdata_mt)
True
|