fastbencode 0.3.1__tar.gz → 0.3.4__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.
- fastbencode-0.3.4/Cargo.toml +16 -0
- {fastbencode-0.3.1 → fastbencode-0.3.4}/MANIFEST.in +2 -1
- {fastbencode-0.3.1/fastbencode.egg-info → fastbencode-0.3.4}/PKG-INFO +14 -13
- {fastbencode-0.3.1 → fastbencode-0.3.4}/README.md +4 -4
- fastbencode-0.3.4/fastbencode/__init__.py +48 -0
- {fastbencode-0.3.1 → fastbencode-0.3.4}/fastbencode/_bencode_py.py +43 -44
- {fastbencode-0.3.1 → fastbencode-0.3.4/fastbencode.egg-info}/PKG-INFO +14 -13
- {fastbencode-0.3.1 → fastbencode-0.3.4}/fastbencode.egg-info/SOURCES.txt +2 -6
- fastbencode-0.3.4/fastbencode.egg-info/requires.txt +6 -0
- {fastbencode-0.3.1 → fastbencode-0.3.4}/pyproject.toml +28 -8
- fastbencode-0.3.4/setup.py +17 -0
- fastbencode-0.3.4/src/lib.rs +438 -0
- fastbencode-0.3.1/fastbencode/__init__.py +0 -68
- fastbencode-0.3.1/fastbencode/_bencode_pyx.h +0 -22
- fastbencode-0.3.1/fastbencode/_bencode_pyx.pyi +0 -7
- fastbencode-0.3.1/fastbencode/_bencode_pyx.pyx +0 -450
- fastbencode-0.3.1/fastbencode/python-compat.h +0 -23
- fastbencode-0.3.1/fastbencode/tests/__init__.py +0 -33
- fastbencode-0.3.1/fastbencode/tests/test_bencode.py +0 -486
- fastbencode-0.3.1/fastbencode.egg-info/requires.txt +0 -6
- fastbencode-0.3.1/setup.py +0 -84
- {fastbencode-0.3.1 → fastbencode-0.3.4}/COPYING +0 -0
- {fastbencode-0.3.1 → fastbencode-0.3.4}/fastbencode/py.typed +0 -0
- {fastbencode-0.3.1 → fastbencode-0.3.4}/fastbencode.egg-info/dependency_links.txt +0 -0
- {fastbencode-0.3.1 → fastbencode-0.3.4}/fastbencode.egg-info/top_level.txt +0 -0
- {fastbencode-0.3.1 → fastbencode-0.3.4}/setup.cfg +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "fastbencode"
|
|
3
|
+
version = "0.3.4"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
authors = ["Jelmer Vernooij <jelmer@jelmer.uk>"]
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
description = "Implementation of bencode with Rust implementation"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
repository = "https://github.com/breezy-team/fastbencode"
|
|
10
|
+
|
|
11
|
+
[lib]
|
|
12
|
+
name = "fastbencode__bencode_rs"
|
|
13
|
+
crate-type = ["cdylib"]
|
|
14
|
+
|
|
15
|
+
[dependencies]
|
|
16
|
+
pyo3 = { version = "0.25.1", features = ["extension-module"] }
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: fastbencode
|
|
3
|
-
Version: 0.3.
|
|
4
|
-
Summary: Implementation of bencode with optional fast
|
|
3
|
+
Version: 0.3.4
|
|
4
|
+
Summary: Implementation of bencode with optional fast Rust extensions
|
|
5
5
|
Maintainer-email: Breezy Developers <breezy-core@googlegroups.com>
|
|
6
|
-
License:
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/breezy-team/fastbencode
|
|
8
8
|
Project-URL: GitHub, https://github.com/breezy-team/fastbencode
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
14
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
15
15
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
16
16
|
Classifier: Operating System :: POSIX
|
|
17
17
|
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: COPYING
|
|
21
|
-
Provides-Extra:
|
|
22
|
-
Requires-Dist:
|
|
21
|
+
Provides-Extra: rust
|
|
22
|
+
Requires-Dist: setuptools-rust>=1.0.0; extra == "rust"
|
|
23
23
|
Provides-Extra: dev
|
|
24
|
-
Requires-Dist: ruff==0.4
|
|
24
|
+
Requires-Dist: ruff==0.12.4; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
25
26
|
|
|
26
27
|
fastbencode
|
|
27
28
|
===========
|
|
@@ -29,8 +30,8 @@ fastbencode
|
|
|
29
30
|
fastbencode is an implementation of the bencode serialization format originally
|
|
30
31
|
used by BitTorrent.
|
|
31
32
|
|
|
32
|
-
The package includes both a pure-Python version and an optional
|
|
33
|
-
based on
|
|
33
|
+
The package includes both a pure-Python version and an optional Rust extension
|
|
34
|
+
based on PyO3. Both provide the same functionality, but the Rust extension
|
|
34
35
|
provides significantly better performance.
|
|
35
36
|
|
|
36
37
|
Example:
|
|
@@ -54,6 +55,6 @@ fastbencode is available under the GNU GPL, version 2 or later.
|
|
|
54
55
|
Copyright
|
|
55
56
|
=========
|
|
56
57
|
|
|
57
|
-
* Original Pure-Python bencoder
|
|
58
|
-
* Cython version and modifications (c) Canonical Ltd
|
|
58
|
+
* Original Pure-Python bencoder © Petru Paler
|
|
59
59
|
* Split out from Bazaar/Breezy by Jelmer Vernooij
|
|
60
|
+
* Rust extension © Jelmer Vernooij
|
|
@@ -4,8 +4,8 @@ fastbencode
|
|
|
4
4
|
fastbencode is an implementation of the bencode serialization format originally
|
|
5
5
|
used by BitTorrent.
|
|
6
6
|
|
|
7
|
-
The package includes both a pure-Python version and an optional
|
|
8
|
-
based on
|
|
7
|
+
The package includes both a pure-Python version and an optional Rust extension
|
|
8
|
+
based on PyO3. Both provide the same functionality, but the Rust extension
|
|
9
9
|
provides significantly better performance.
|
|
10
10
|
|
|
11
11
|
Example:
|
|
@@ -29,6 +29,6 @@ fastbencode is available under the GNU GPL, version 2 or later.
|
|
|
29
29
|
Copyright
|
|
30
30
|
=========
|
|
31
31
|
|
|
32
|
-
* Original Pure-Python bencoder
|
|
33
|
-
* Cython version and modifications (c) Canonical Ltd
|
|
32
|
+
* Original Pure-Python bencoder © Petru Paler
|
|
34
33
|
* Split out from Bazaar/Breezy by Jelmer Vernooij
|
|
34
|
+
* Rust extension © Jelmer Vernooij
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Copyright (C) 2021-2023 Jelmer Vernooij <jelmer@jelmer.uk>
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
|
5
|
+
# the Free Software Foundation; either version 2 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU General Public License
|
|
14
|
+
# along with this program; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
"""Wrapper around the bencode Rust and Python implementations."""
|
|
18
|
+
|
|
19
|
+
from typing import Type
|
|
20
|
+
|
|
21
|
+
__version__ = (0, 3, 4)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Bencached: Type
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
from fastbencode._bencode_rs import (
|
|
28
|
+
Bencached,
|
|
29
|
+
bdecode,
|
|
30
|
+
bdecode_as_tuple,
|
|
31
|
+
bdecode_utf8,
|
|
32
|
+
bencode,
|
|
33
|
+
bencode_utf8,
|
|
34
|
+
)
|
|
35
|
+
except ModuleNotFoundError as e:
|
|
36
|
+
import warnings
|
|
37
|
+
|
|
38
|
+
warnings.warn(f"failed to load compiled extension: {e}", UserWarning)
|
|
39
|
+
|
|
40
|
+
# Fall back to pure Python implementation
|
|
41
|
+
from ._bencode_py import ( # noqa: F401
|
|
42
|
+
Bencached,
|
|
43
|
+
bdecode,
|
|
44
|
+
bdecode_as_tuple,
|
|
45
|
+
bdecode_utf8,
|
|
46
|
+
bencode,
|
|
47
|
+
bencode_utf8,
|
|
48
|
+
)
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
# included in all copies or substantial portions of the Software.
|
|
15
15
|
#
|
|
16
16
|
# Modifications copyright (C) 2008 Canonical Ltd
|
|
17
|
+
# Modifications copyright (C) 2021-2023 Jelmer Vernooij
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
from typing import Callable, Dict, List, Type
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class BDecoder:
|
|
23
|
-
|
|
24
24
|
def __init__(self, yield_tuples=False, bytestring_encoding=None) -> None:
|
|
25
25
|
"""Constructor.
|
|
26
26
|
|
|
@@ -30,46 +30,46 @@ class BDecoder:
|
|
|
30
30
|
self.yield_tuples = yield_tuples
|
|
31
31
|
self.bytestring_encoding = bytestring_encoding
|
|
32
32
|
decode_func = {}
|
|
33
|
-
decode_func[b
|
|
34
|
-
decode_func[b
|
|
35
|
-
decode_func[b
|
|
36
|
-
decode_func[b
|
|
37
|
-
decode_func[b
|
|
38
|
-
decode_func[b
|
|
39
|
-
decode_func[b
|
|
40
|
-
decode_func[b
|
|
41
|
-
decode_func[b
|
|
42
|
-
decode_func[b
|
|
43
|
-
decode_func[b
|
|
44
|
-
decode_func[b
|
|
45
|
-
decode_func[b
|
|
33
|
+
decode_func[b"l"] = self.decode_list
|
|
34
|
+
decode_func[b"d"] = self.decode_dict
|
|
35
|
+
decode_func[b"i"] = self.decode_int
|
|
36
|
+
decode_func[b"0"] = self.decode_bytes
|
|
37
|
+
decode_func[b"1"] = self.decode_bytes
|
|
38
|
+
decode_func[b"2"] = self.decode_bytes
|
|
39
|
+
decode_func[b"3"] = self.decode_bytes
|
|
40
|
+
decode_func[b"4"] = self.decode_bytes
|
|
41
|
+
decode_func[b"5"] = self.decode_bytes
|
|
42
|
+
decode_func[b"6"] = self.decode_bytes
|
|
43
|
+
decode_func[b"7"] = self.decode_bytes
|
|
44
|
+
decode_func[b"8"] = self.decode_bytes
|
|
45
|
+
decode_func[b"9"] = self.decode_bytes
|
|
46
46
|
self.decode_func = decode_func
|
|
47
47
|
|
|
48
48
|
def decode_int(self, x, f):
|
|
49
49
|
f += 1
|
|
50
|
-
newf = x.index(b
|
|
50
|
+
newf = x.index(b"e", f)
|
|
51
51
|
n = int(x[f:newf])
|
|
52
|
-
if x[f:f + 2] == b
|
|
52
|
+
if x[f : f + 2] == b"-0":
|
|
53
53
|
raise ValueError
|
|
54
|
-
elif x[f:f + 1] == b
|
|
54
|
+
elif x[f : f + 1] == b"0" and newf != f + 1:
|
|
55
55
|
raise ValueError
|
|
56
56
|
return (n, newf + 1)
|
|
57
57
|
|
|
58
58
|
def decode_bytes(self, x, f):
|
|
59
|
-
colon = x.index(b
|
|
59
|
+
colon = x.index(b":", f)
|
|
60
60
|
n = int(x[f:colon])
|
|
61
|
-
if x[f:f + 1] == b
|
|
61
|
+
if x[f : f + 1] == b"0" and colon != f + 1:
|
|
62
62
|
raise ValueError
|
|
63
63
|
colon += 1
|
|
64
|
-
d = x[colon:colon + n]
|
|
64
|
+
d = x[colon : colon + n]
|
|
65
65
|
if self.bytestring_encoding:
|
|
66
66
|
d = d.decode(self.bytestring_encoding)
|
|
67
67
|
return (d, colon + n)
|
|
68
68
|
|
|
69
69
|
def decode_list(self, x, f):
|
|
70
70
|
r, f = [], f + 1
|
|
71
|
-
while x[f:f + 1] != b
|
|
72
|
-
v, f = self.decode_func[x[f:f + 1]](x, f)
|
|
71
|
+
while x[f : f + 1] != b"e":
|
|
72
|
+
v, f = self.decode_func[x[f : f + 1]](x, f)
|
|
73
73
|
r.append(v)
|
|
74
74
|
if self.yield_tuples:
|
|
75
75
|
r = tuple(r)
|
|
@@ -78,12 +78,12 @@ class BDecoder:
|
|
|
78
78
|
def decode_dict(self, x, f):
|
|
79
79
|
r, f = {}, f + 1
|
|
80
80
|
lastkey = None
|
|
81
|
-
while x[f:f + 1] != b
|
|
81
|
+
while x[f : f + 1] != b"e":
|
|
82
82
|
k, f = self.decode_bytes(x, f)
|
|
83
83
|
if lastkey is not None and lastkey >= k:
|
|
84
84
|
raise ValueError
|
|
85
85
|
lastkey = k
|
|
86
|
-
r[k], f = self.decode_func[x[f:f + 1]](x, f)
|
|
86
|
+
r[k], f = self.decode_func[x[f : f + 1]](x, f)
|
|
87
87
|
return (r, f + 1)
|
|
88
88
|
|
|
89
89
|
def bdecode(self, x):
|
|
@@ -104,19 +104,18 @@ bdecode = _decoder.bdecode
|
|
|
104
104
|
_tuple_decoder = BDecoder(True)
|
|
105
105
|
bdecode_as_tuple = _tuple_decoder.bdecode
|
|
106
106
|
|
|
107
|
-
_utf8_decoder = BDecoder(bytestring_encoding=
|
|
107
|
+
_utf8_decoder = BDecoder(bytestring_encoding="utf-8")
|
|
108
108
|
bdecode_utf8 = _utf8_decoder.bdecode
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
class Bencached:
|
|
112
|
-
__slots__ = [
|
|
112
|
+
__slots__ = ["bencoded"]
|
|
113
113
|
|
|
114
114
|
def __init__(self, s) -> None:
|
|
115
115
|
self.bencoded = s
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
class BEncoder:
|
|
119
|
-
|
|
120
119
|
def __init__(self, bytestring_encoding=None):
|
|
121
120
|
self.bytestring_encoding = bytestring_encoding
|
|
122
121
|
self.encode_func: Dict[Type, Callable[[object, List[bytes]], None]] = {
|
|
@@ -133,37 +132,35 @@ class BEncoder:
|
|
|
133
132
|
def encode_bencached(self, x, r):
|
|
134
133
|
r.append(x.bencoded)
|
|
135
134
|
|
|
136
|
-
|
|
137
135
|
def encode_bool(self, x, r):
|
|
138
136
|
self.encode_int(int(x), r)
|
|
139
137
|
|
|
140
|
-
|
|
141
138
|
def encode_int(self, x, r):
|
|
142
|
-
r.extend((b
|
|
143
|
-
|
|
139
|
+
r.extend((b"i", int_to_bytes(x), b"e"))
|
|
144
140
|
|
|
145
141
|
def encode_bytes(self, x, r):
|
|
146
|
-
r.extend((int_to_bytes(len(x)), b
|
|
142
|
+
r.extend((int_to_bytes(len(x)), b":", x))
|
|
147
143
|
|
|
148
144
|
def encode_list(self, x, r):
|
|
149
|
-
r.append(b
|
|
145
|
+
r.append(b"l")
|
|
150
146
|
for i in x:
|
|
151
147
|
self.encode(i, r)
|
|
152
|
-
r.append(b
|
|
153
|
-
|
|
148
|
+
r.append(b"e")
|
|
154
149
|
|
|
155
150
|
def encode_dict(self, x, r):
|
|
156
|
-
r.append(b
|
|
151
|
+
r.append(b"d")
|
|
157
152
|
ilist = sorted(x.items())
|
|
158
153
|
for k, v in ilist:
|
|
159
|
-
r.extend((int_to_bytes(len(k)), b
|
|
154
|
+
r.extend((int_to_bytes(len(k)), b":", k))
|
|
160
155
|
self.encode(v, r)
|
|
161
|
-
r.append(b
|
|
156
|
+
r.append(b"e")
|
|
162
157
|
|
|
163
158
|
def encode_str(self, x, r):
|
|
164
159
|
if self.bytestring_encoding is None:
|
|
165
|
-
raise TypeError(
|
|
166
|
-
|
|
160
|
+
raise TypeError(
|
|
161
|
+
"string found but no encoding specified. "
|
|
162
|
+
"Use bencode_utf8 rather bencode?"
|
|
163
|
+
)
|
|
167
164
|
return self.encode_bytes(x.encode(self.bytestring_encoding), r)
|
|
168
165
|
|
|
169
166
|
def encode(self, x, r):
|
|
@@ -171,16 +168,18 @@ class BEncoder:
|
|
|
171
168
|
|
|
172
169
|
|
|
173
170
|
def int_to_bytes(n):
|
|
174
|
-
return b
|
|
171
|
+
return b"%d" % n
|
|
172
|
+
|
|
175
173
|
|
|
176
174
|
def bencode(x):
|
|
177
175
|
r = []
|
|
178
176
|
encoder = BEncoder()
|
|
179
177
|
encoder.encode(x, r)
|
|
180
|
-
return b
|
|
178
|
+
return b"".join(r)
|
|
179
|
+
|
|
181
180
|
|
|
182
181
|
def bencode_utf8(x):
|
|
183
182
|
r = []
|
|
184
|
-
encoder = BEncoder(bytestring_encoding=
|
|
183
|
+
encoder = BEncoder(bytestring_encoding="utf-8")
|
|
185
184
|
encoder.encode(x, r)
|
|
186
|
-
return b
|
|
185
|
+
return b"".join(r)
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: fastbencode
|
|
3
|
-
Version: 0.3.
|
|
4
|
-
Summary: Implementation of bencode with optional fast
|
|
3
|
+
Version: 0.3.4
|
|
4
|
+
Summary: Implementation of bencode with optional fast Rust extensions
|
|
5
5
|
Maintainer-email: Breezy Developers <breezy-core@googlegroups.com>
|
|
6
|
-
License:
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/breezy-team/fastbencode
|
|
8
8
|
Project-URL: GitHub, https://github.com/breezy-team/fastbencode
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
14
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
15
15
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
16
16
|
Classifier: Operating System :: POSIX
|
|
17
17
|
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
-
Requires-Python: >=3.
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: COPYING
|
|
21
|
-
Provides-Extra:
|
|
22
|
-
Requires-Dist:
|
|
21
|
+
Provides-Extra: rust
|
|
22
|
+
Requires-Dist: setuptools-rust>=1.0.0; extra == "rust"
|
|
23
23
|
Provides-Extra: dev
|
|
24
|
-
Requires-Dist: ruff==0.4
|
|
24
|
+
Requires-Dist: ruff==0.12.4; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
25
26
|
|
|
26
27
|
fastbencode
|
|
27
28
|
===========
|
|
@@ -29,8 +30,8 @@ fastbencode
|
|
|
29
30
|
fastbencode is an implementation of the bencode serialization format originally
|
|
30
31
|
used by BitTorrent.
|
|
31
32
|
|
|
32
|
-
The package includes both a pure-Python version and an optional
|
|
33
|
-
based on
|
|
33
|
+
The package includes both a pure-Python version and an optional Rust extension
|
|
34
|
+
based on PyO3. Both provide the same functionality, but the Rust extension
|
|
34
35
|
provides significantly better performance.
|
|
35
36
|
|
|
36
37
|
Example:
|
|
@@ -54,6 +55,6 @@ fastbencode is available under the GNU GPL, version 2 or later.
|
|
|
54
55
|
Copyright
|
|
55
56
|
=========
|
|
56
57
|
|
|
57
|
-
* Original Pure-Python bencoder
|
|
58
|
-
* Cython version and modifications (c) Canonical Ltd
|
|
58
|
+
* Original Pure-Python bencoder © Petru Paler
|
|
59
59
|
* Split out from Bazaar/Breezy by Jelmer Vernooij
|
|
60
|
+
* Rust extension © Jelmer Vernooij
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
COPYING
|
|
2
|
+
Cargo.toml
|
|
2
3
|
MANIFEST.in
|
|
3
4
|
README.md
|
|
4
5
|
pyproject.toml
|
|
5
6
|
setup.py
|
|
6
7
|
fastbencode/__init__.py
|
|
7
8
|
fastbencode/_bencode_py.py
|
|
8
|
-
fastbencode/_bencode_pyx.h
|
|
9
|
-
fastbencode/_bencode_pyx.pyi
|
|
10
|
-
fastbencode/_bencode_pyx.pyx
|
|
11
9
|
fastbencode/py.typed
|
|
12
|
-
fastbencode/python-compat.h
|
|
13
10
|
fastbencode.egg-info/PKG-INFO
|
|
14
11
|
fastbencode.egg-info/SOURCES.txt
|
|
15
12
|
fastbencode.egg-info/dependency_links.txt
|
|
16
13
|
fastbencode.egg-info/requires.txt
|
|
17
14
|
fastbencode.egg-info/top_level.txt
|
|
18
|
-
|
|
19
|
-
fastbencode/tests/test_bencode.py
|
|
15
|
+
src/lib.rs
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
requires = [
|
|
3
3
|
"setuptools>=61.2",
|
|
4
|
-
"
|
|
4
|
+
"setuptools-rust>=1.0.0",
|
|
5
5
|
]
|
|
6
6
|
build-backend = "setuptools.build_meta"
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "fastbencode"
|
|
10
|
-
description = "Implementation of bencode with optional fast
|
|
10
|
+
description = "Implementation of bencode with optional fast Rust extensions"
|
|
11
11
|
maintainers = [{name = "Breezy Developers", email = "breezy-core@googlegroups.com"}]
|
|
12
12
|
readme = "README.md"
|
|
13
|
-
license =
|
|
13
|
+
license = "Apache-2.0"
|
|
14
14
|
classifiers = [
|
|
15
|
-
"Programming Language :: Python :: 3.8",
|
|
16
15
|
"Programming Language :: Python :: 3.9",
|
|
17
16
|
"Programming Language :: Python :: 3.10",
|
|
18
17
|
"Programming Language :: Python :: 3.11",
|
|
19
18
|
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
20
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
21
21
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
22
22
|
"Operating System :: POSIX",
|
|
23
23
|
"Operating System :: Microsoft :: Windows",
|
|
24
24
|
]
|
|
25
|
-
requires-python = ">=3.
|
|
25
|
+
requires-python = ">=3.9"
|
|
26
26
|
dynamic = ["version"]
|
|
27
27
|
dependencies = []
|
|
28
28
|
|
|
@@ -31,9 +31,9 @@ Homepage = "https://github.com/breezy-team/fastbencode"
|
|
|
31
31
|
GitHub = "https://github.com/breezy-team/fastbencode"
|
|
32
32
|
|
|
33
33
|
[project.optional-dependencies]
|
|
34
|
-
|
|
34
|
+
rust = ["setuptools-rust>=1.0.0"]
|
|
35
35
|
dev = [
|
|
36
|
-
"ruff==0.4
|
|
36
|
+
"ruff==0.12.4"
|
|
37
37
|
]
|
|
38
38
|
|
|
39
39
|
[tool.setuptools]
|
|
@@ -59,7 +59,6 @@ select = [
|
|
|
59
59
|
ignore = [
|
|
60
60
|
"ANN001",
|
|
61
61
|
"ANN002",
|
|
62
|
-
"ANN101",
|
|
63
62
|
"ANN201",
|
|
64
63
|
"ANN202",
|
|
65
64
|
"ANN204",
|
|
@@ -73,3 +72,24 @@ ignore = [
|
|
|
73
72
|
|
|
74
73
|
[tool.ruff.lint.pydocstyle]
|
|
75
74
|
convention = "google"
|
|
75
|
+
|
|
76
|
+
[tool.cibuildwheel]
|
|
77
|
+
environment = {PATH="$HOME/.cargo/bin:$PATH"}
|
|
78
|
+
before-build = "pip install -U setuptools-rust && curl https://sh.rustup.rs -sSf | sh -s -- --profile=minimal -y && rustup show"
|
|
79
|
+
|
|
80
|
+
[tool.cibuildwheel.linux]
|
|
81
|
+
skip = "*-musllinux_* *cp314*"
|
|
82
|
+
archs = ["auto", "aarch64"]
|
|
83
|
+
before-build = "pip install -U setuptools-rust && yum -y install libatomic && curl https://sh.rustup.rs -sSf | sh -s -- --profile=minimal -y && rustup show"
|
|
84
|
+
|
|
85
|
+
[tool.cibuildwheel.macos]
|
|
86
|
+
archs = ["auto", "universal2", "x86_64", "arm64"]
|
|
87
|
+
before-all = "rustup target add x86_64-apple-darwin aarch64-apple-darwin"
|
|
88
|
+
skip = """\
|
|
89
|
+
cp39-macosx_x86_64 cp39-macosx_universal2 \
|
|
90
|
+
cp310-macosx_x86_64 cp310-macosx_universal2 \
|
|
91
|
+
cp311-macosx_x86_64 cp311-macosx_universal2 \
|
|
92
|
+
cp312-macosx_x86_64 cp312-macosx_universal2 \
|
|
93
|
+
cp313-macosx_x86_64 cp313-macosx_universal2 \
|
|
94
|
+
cp314-macosx_x86_64 cp314-macosx_universal2 \
|
|
95
|
+
"""
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from setuptools import setup
|
|
6
|
+
from setuptools_rust import Binding, RustExtension
|
|
7
|
+
|
|
8
|
+
setup(
|
|
9
|
+
rust_extensions=[
|
|
10
|
+
RustExtension(
|
|
11
|
+
"fastbencode._bencode_rs",
|
|
12
|
+
binding=Binding.PyO3,
|
|
13
|
+
py_limited_api=False,
|
|
14
|
+
optional=sys.platform == "win32",
|
|
15
|
+
)
|
|
16
|
+
],
|
|
17
|
+
)
|