Skip to main content

C implementations of functions for use within SABnzbd

Project description

SABCTools - C implementations of functions for use within SABnzbd

This module implements three main sets of C implementations that are used within SABnzbd:

  • yEnc decoding and encoding using SIMD routines
  • CRC32 calculations
  • Non-blocking SSL-socket reading
  • Marking files as sparse

Of course, they can also be used in any other application.

yEnc decoding and encoding using SIMD routines

yEnc decoding and encoding performed by using yencode from animetosho,
which utilizes x86/ARM SIMD optimised routines if such CPU features are available.

CRC32 calculations

We used the crcutil library for very fast CRC calculations.

Non-blocking SSL-socket reading

When Python reads data from a non-blocking SSL socket, it is limited to receiving 16K data at once. This module implements a patched version that can read as much data is available at once. For more details, see the cpython pull request.

Marking files as sparse

Uses Windows specific system calls to mark files as sparse and set the desired size. On other platforms the same is achieved by calling truncate.

Utility functions

Use sabctools.bytearray_malloc(size) to get an bytearray that is uninitialized (not set to 0's). This is much faster than the built-in bytearray(size) because the data inside the new bytearray will be whatever is present in the memory block.

Installing

As simple as running:

pip install sabctools --upgrade  

When you want to compile from sources, you can run in the sabctools directory:

pip install .  

SIMD detection

To see which SIMD set was detected on your system, run:

python -c "import sabctools; print(sabctools.simd);"  

OpenSSL detection

To see if we could link to OpenSSL library on your system, run:

python -c "import sabctools; print(sabctools.openssl_linked);"  

Testing

For testing we use pytest (install via pip install -r tests/requirements.txt) and test can simply be executed by browsing to the sabctools directory and running:

pytest  

Note that tests can fail if git modified the line endings of data files when checking out the repository!

Project details


Download files

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

Source Distribution

sabctools-8.1.0.tar.gz (234.7 kB view hashes)

Uploaded Source

Built Distributions

sabctools-8.1.0-cp312-cp312-win_amd64.whl (46.9 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

sabctools-8.1.0-cp312-cp312-win32.whl (42.6 kB view hashes)

Uploaded CPython 3.12 Windows x86

sabctools-8.1.0-cp312-cp312-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

sabctools-8.1.0-cp312-cp312-musllinux_1_1_aarch64.whl (744.0 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

sabctools-8.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (565.3 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

sabctools-8.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (188.5 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

sabctools-8.1.0-cp312-cp312-macosx_10_9_universal2.whl (98.4 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

sabctools-8.1.0-cp311-cp311-win_amd64.whl (46.8 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

sabctools-8.1.0-cp311-cp311-win32.whl (42.5 kB view hashes)

Uploaded CPython 3.11 Windows x86

sabctools-8.1.0-cp311-cp311-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

sabctools-8.1.0-cp311-cp311-musllinux_1_1_aarch64.whl (742.5 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

sabctools-8.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (565.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

sabctools-8.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (189.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

sabctools-8.1.0-cp311-cp311-macosx_10_9_universal2.whl (98.3 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

sabctools-8.1.0-cp310-cp310-win_amd64.whl (46.8 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

sabctools-8.1.0-cp310-cp310-win32.whl (42.5 kB view hashes)

Uploaded CPython 3.10 Windows x86

sabctools-8.1.0-cp310-cp310-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

sabctools-8.1.0-cp310-cp310-musllinux_1_1_aarch64.whl (737.4 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

sabctools-8.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (566.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

sabctools-8.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (189.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

sabctools-8.1.0-cp310-cp310-macosx_10_9_universal2.whl (98.3 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

sabctools-8.1.0-cp39-cp39-win_amd64.whl (46.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

sabctools-8.1.0-cp39-cp39-win32.whl (42.5 kB view hashes)

Uploaded CPython 3.9 Windows x86

sabctools-8.1.0-cp39-cp39-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

sabctools-8.1.0-cp39-cp39-musllinux_1_1_aarch64.whl (737.1 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

sabctools-8.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (565.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

sabctools-8.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (189.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

sabctools-8.1.0-cp39-cp39-macosx_10_9_universal2.whl (98.2 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

sabctools-8.1.0-cp38-cp38-win_amd64.whl (46.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

sabctools-8.1.0-cp38-cp38-win32.whl (42.5 kB view hashes)

Uploaded CPython 3.8 Windows x86

sabctools-8.1.0-cp38-cp38-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

sabctools-8.1.0-cp38-cp38-musllinux_1_1_aarch64.whl (738.0 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

sabctools-8.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (564.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

sabctools-8.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (190.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

sabctools-8.1.0-cp38-cp38-macosx_10_9_universal2.whl (98.2 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

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