pyfastcdc 0.2.1__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfastcdc-0.2.1/pyfastcdc.egg-info → pyfastcdc-0.3.1}/PKG-INFO +4 -3
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/README.md +2 -2
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/__init__.py +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/__init__.pyi +2 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/cy/fastcdc.pyx +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/py/fastcdc.py +1 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/utils.py +10 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1/pyfastcdc.egg-info}/PKG-INFO +4 -3
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc.egg-info/SOURCES.txt +3 -1
- pyfastcdc-0.3.1/pyproject.toml +8 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/setup.py +5 -1
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/tests/test_arguments.py +1 -1
- pyfastcdc-0.3.1/tests/test_correctness.py +679 -0
- pyfastcdc-0.3.1/tests/test_threading.py +54 -0
- pyfastcdc-0.3.1/tests/test_utils.py +61 -0
- pyfastcdc-0.2.1/pyproject.toml +0 -3
- pyfastcdc-0.2.1/tests/test_correctness.py +0 -454
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/LICENSE +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/MANIFEST.in +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/common.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/cy/__init__.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/cy/chunk.pxd +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/cy/chunk.pyx +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/cy/constants.pxd +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/cy/constants.pyx +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/py/__init__.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/py/chunk.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/py/constants.py +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc/py.typed +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc.egg-info/dependency_links.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc.egg-info/requires.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/pyfastcdc.egg-info/top_level.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/requirements.dev.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/requirements.txt +0 -0
- {pyfastcdc-0.2.1 → pyfastcdc-0.3.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyfastcdc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: A high-performance FastCDC 2020 implementation written in Python + Cython
|
|
5
5
|
Author: Fallen_Breath
|
|
6
6
|
License: MIT
|
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
19
|
Requires-Python: >=3.6
|
|
19
20
|
Description-Content-Type: text/markdown
|
|
20
21
|
License-File: LICENSE
|
|
@@ -44,7 +45,7 @@ Dynamic: summary
|
|
|
44
45
|
|
|
45
46
|
A high-performance FastCDC 2020 implementation written in Python + [Cython](https://github.com/cython/cython)
|
|
46
47
|
|
|
47
|
-
Supports Python 3.6+. Provides prebuilt wheels for Python 3.
|
|
48
|
+
Supports Python 3.6+. Provides prebuilt wheels for Python 3.9+
|
|
48
49
|
|
|
49
50
|
Its core algorithm implementation is a direct port of the v2020 module from [nlfiedler/fastcdc-rs](https://github.com/nlfiedler/fastcdc-rs),
|
|
50
51
|
which means that the output of PyFastCDC completely matches the output of nlfiedler/fastcdc-rs
|
|
@@ -67,7 +68,7 @@ which is significantly slower (about 0.5% or less in memory chunking speed)
|
|
|
67
68
|
|
|
68
69
|
<details>
|
|
69
70
|
|
|
70
|
-
<summary>I only want to use the Cython
|
|
71
|
+
<summary>I only want to use the Cython implementation, not the slow pure-Python one</summary>
|
|
71
72
|
|
|
72
73
|
You can set the environment variable `PYFASTCDC_REQUIRE_CYTHON=true` or `PYFASTCDC_REQUIRE_CYTHON=1` for the `pip` installation command
|
|
73
74
|
to disable the pure-Python fallback on extension compilation error and make the installation fail hard.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
A high-performance FastCDC 2020 implementation written in Python + [Cython](https://github.com/cython/cython)
|
|
8
8
|
|
|
9
|
-
Supports Python 3.6+. Provides prebuilt wheels for Python 3.
|
|
9
|
+
Supports Python 3.6+. Provides prebuilt wheels for Python 3.9+
|
|
10
10
|
|
|
11
11
|
Its core algorithm implementation is a direct port of the v2020 module from [nlfiedler/fastcdc-rs](https://github.com/nlfiedler/fastcdc-rs),
|
|
12
12
|
which means that the output of PyFastCDC completely matches the output of nlfiedler/fastcdc-rs
|
|
@@ -29,7 +29,7 @@ which is significantly slower (about 0.5% or less in memory chunking speed)
|
|
|
29
29
|
|
|
30
30
|
<details>
|
|
31
31
|
|
|
32
|
-
<summary>I only want to use the Cython
|
|
32
|
+
<summary>I only want to use the Cython implementation, not the slow pure-Python one</summary>
|
|
33
33
|
|
|
34
34
|
You can set the environment variable `PYFASTCDC_REQUIRE_CYTHON=true` or `PYFASTCDC_REQUIRE_CYTHON=1` for the `pip` installation command
|
|
35
35
|
to disable the pure-Python fallback on extension compilation error and make the installation fail hard.
|
|
@@ -66,7 +66,7 @@ cdef class FastCDC:
|
|
|
66
66
|
self.config.min_size = min_size
|
|
67
67
|
self.config.max_size = max_size
|
|
68
68
|
|
|
69
|
-
bits =
|
|
69
|
+
bits = utils.logarithm2(avg_size)
|
|
70
70
|
self.config.mask_s = MASKS[bits + normalized_chunking]
|
|
71
71
|
self.config.mask_l = MASKS[bits - normalized_chunking]
|
|
72
72
|
self.config.mask_s_ls = self.config.mask_s << 1
|
|
@@ -81,7 +81,7 @@ class FastCDC:
|
|
|
81
81
|
if not (0 <= normalized_chunking <= 3):
|
|
82
82
|
raise ValueError(f'normalized_chunking {normalized_chunking} is out of range [0, 3]')
|
|
83
83
|
|
|
84
|
-
bits =
|
|
84
|
+
bits = utils.logarithm2(avg_size)
|
|
85
85
|
mask_s = MASKS[bits + normalized_chunking]
|
|
86
86
|
mask_l = MASKS[bits - normalized_chunking]
|
|
87
87
|
mask_s_ls = (mask_s << 1) & _UINT64_MASK
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import math
|
|
1
2
|
import mmap
|
|
2
3
|
import os
|
|
3
4
|
from pathlib import Path
|
|
@@ -8,6 +9,15 @@ from pyfastcdc.common import BinaryStreamReader
|
|
|
8
9
|
ReadintoFunc = Callable[[memoryview], int]
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
def logarithm2(value: int) -> int:
|
|
13
|
+
# The same as the nlfiedler/fastcdc-rs v4.0.1 Rust implementation: (value as f64).log2().round() as u32
|
|
14
|
+
if value < 0:
|
|
15
|
+
raise ValueError(f'value must be non-negative, got {value}')
|
|
16
|
+
if value == 0:
|
|
17
|
+
return 0
|
|
18
|
+
return math.floor(math.log2(value) + 0.5)
|
|
19
|
+
|
|
20
|
+
|
|
11
21
|
def create_memoryview_from_buffer(buf: Union[bytes, bytearray, memoryview]) -> memoryview:
|
|
12
22
|
if isinstance(buf, (bytes, bytearray, memoryview)):
|
|
13
23
|
return memoryview(buf)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyfastcdc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: A high-performance FastCDC 2020 implementation written in Python + Cython
|
|
5
5
|
Author: Fallen_Breath
|
|
6
6
|
License: MIT
|
|
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
19
|
Requires-Python: >=3.6
|
|
19
20
|
Description-Content-Type: text/markdown
|
|
20
21
|
License-File: LICENSE
|
|
@@ -44,7 +45,7 @@ Dynamic: summary
|
|
|
44
45
|
|
|
45
46
|
A high-performance FastCDC 2020 implementation written in Python + [Cython](https://github.com/cython/cython)
|
|
46
47
|
|
|
47
|
-
Supports Python 3.6+. Provides prebuilt wheels for Python 3.
|
|
48
|
+
Supports Python 3.6+. Provides prebuilt wheels for Python 3.9+
|
|
48
49
|
|
|
49
50
|
Its core algorithm implementation is a direct port of the v2020 module from [nlfiedler/fastcdc-rs](https://github.com/nlfiedler/fastcdc-rs),
|
|
50
51
|
which means that the output of PyFastCDC completely matches the output of nlfiedler/fastcdc-rs
|
|
@@ -67,7 +68,7 @@ which is significantly slower (about 0.5% or less in memory chunking speed)
|
|
|
67
68
|
|
|
68
69
|
<details>
|
|
69
70
|
|
|
70
|
-
<summary>I only want to use the Cython
|
|
71
|
+
<summary>I only want to use the Cython implementation, not the slow pure-Python one</summary>
|
|
71
72
|
|
|
72
73
|
You can set the environment variable `PYFASTCDC_REQUIRE_CYTHON=true` or `PYFASTCDC_REQUIRE_CYTHON=1` for the `pip` installation command
|
|
73
74
|
to disable the pure-Python fallback on extension compilation error and make the installation fail hard.
|
|
@@ -92,7 +92,10 @@ else:
|
|
|
92
92
|
from Cython.Build import cythonize
|
|
93
93
|
ext_modules = cythonize(
|
|
94
94
|
'pyfastcdc/cy/*.pyx',
|
|
95
|
-
compiler_directives={
|
|
95
|
+
compiler_directives={
|
|
96
|
+
'language_level': '3',
|
|
97
|
+
**({'freethreading_compatible': True} if sys.version_info >= (3, 13) else {}),
|
|
98
|
+
},
|
|
96
99
|
)
|
|
97
100
|
|
|
98
101
|
print(f'setuptools_version: {setuptools_version}')
|
|
@@ -135,6 +138,7 @@ setup(
|
|
|
135
138
|
'Programming Language :: Python :: 3.12',
|
|
136
139
|
'Programming Language :: Python :: 3.13',
|
|
137
140
|
'Programming Language :: Python :: 3.14',
|
|
141
|
+
'Programming Language :: Python :: 3.15',
|
|
138
142
|
],
|
|
139
143
|
ext_modules=ext_modules,
|
|
140
144
|
cmdclass={'build_ext': BuildExt},
|