maxminddb-rust 0.7.0__tar.gz → 0.8.0__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.
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.github/dependabot.yml +15 -3
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.github/workflows/benchmark.yml +2 -2
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.github/workflows/codeql.yml +1 -1
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.github/workflows/lint.yml +3 -3
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.github/workflows/test.yml +3 -3
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.github/workflows/zizmor.yml +1 -1
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/CHANGELOG.md +17 -1
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/Cargo.lock +51 -47
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/Cargo.toml +2 -2
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/MIGRATION.md +16 -13
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/PKG-INFO +3 -4
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/README.md +2 -3
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/benchmarks/_common.py +5 -5
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/benchmarks/benchmark.py +8 -3
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/benchmarks/benchmark_batch.py +10 -4
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/benchmarks/benchmark_comprehensive.py +14 -10
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/benchmarks/benchmark_parallel.py +7 -3
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/benchmarks/benchmark_path.py +16 -20
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/benchmarks/compare_refs.py +114 -68
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/examples/basic_usage.py +4 -4
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/examples/batch_processing.py +15 -16
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/examples/context_manager.py +12 -12
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/examples/iterator_demo.py +22 -32
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/maxminddb_rust.pyi +53 -74
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/pyproject.toml +23 -1
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/src/lib.rs +3 -3
- maxminddb_rust-0.8.0/tests/bad_data_test.py +154 -0
- maxminddb_rust-0.8.0/tests/benchmark_args_test.py +50 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/concurrency_test.py +1 -2
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/get_many_path_test.py +18 -21
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/get_many_test.py +24 -39
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/introspection_test.py +4 -3
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/maxmind/README.md +20 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/maxmind/reader_test.py +202 -16
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/open_mode_test.py +8 -15
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/path_test.py +29 -39
- maxminddb_rust-0.8.0/tests/resource_guard_test.py +61 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/uv.lock +23 -7
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.githooks/pre-commit +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.github/workflows/release.yml +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.gitignore +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/.gitmodules +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/CONTRIBUTING.md +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/LICENSE +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/dev-bin/release.sh +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/precious.toml +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/py.typed +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/src/decode.rs +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/src/ip.rs +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/src/iterator.rs +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/src/metadata.rs +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/src/open.rs +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/src/path.rs +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/__init__.py +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/maxmind/UPSTREAM_LICENSE +0 -0
- {maxminddb_rust-0.7.0 → maxminddb_rust-0.8.0}/tests/maxmind/__init__.py +0 -0
|
@@ -8,7 +8,9 @@ updates:
|
|
|
8
8
|
time: "14:00"
|
|
9
9
|
open-pull-requests-limit: 10
|
|
10
10
|
cooldown:
|
|
11
|
-
default-days:
|
|
11
|
+
default-days: 7
|
|
12
|
+
allow:
|
|
13
|
+
- dependency-type: all
|
|
12
14
|
|
|
13
15
|
- package-ecosystem: pip
|
|
14
16
|
directory: /
|
|
@@ -17,7 +19,9 @@ updates:
|
|
|
17
19
|
time: "14:00"
|
|
18
20
|
open-pull-requests-limit: 10
|
|
19
21
|
cooldown:
|
|
20
|
-
default-days:
|
|
22
|
+
default-days: 7
|
|
23
|
+
allow:
|
|
24
|
+
- dependency-type: all
|
|
21
25
|
|
|
22
26
|
- package-ecosystem: github-actions
|
|
23
27
|
directory: /
|
|
@@ -25,4 +29,12 @@ updates:
|
|
|
25
29
|
interval: daily
|
|
26
30
|
time: "14:00"
|
|
27
31
|
cooldown:
|
|
28
|
-
default-days:
|
|
32
|
+
default-days: 7
|
|
33
|
+
|
|
34
|
+
- package-ecosystem: gitsubmodule
|
|
35
|
+
directory: /
|
|
36
|
+
schedule:
|
|
37
|
+
interval: daily
|
|
38
|
+
time: "14:00"
|
|
39
|
+
cooldown:
|
|
40
|
+
default-days: 7
|
|
@@ -45,12 +45,12 @@ jobs:
|
|
|
45
45
|
submodules: recursive
|
|
46
46
|
|
|
47
47
|
- name: Install Rust
|
|
48
|
-
uses: dtolnay/rust-toolchain@
|
|
48
|
+
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master
|
|
49
49
|
with:
|
|
50
50
|
toolchain: stable
|
|
51
51
|
|
|
52
52
|
- name: Install uv
|
|
53
|
-
uses: astral-sh/setup-uv@
|
|
53
|
+
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
54
54
|
|
|
55
55
|
- name: Run benchmark comparison
|
|
56
56
|
env:
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
persist-credentials: false
|
|
19
19
|
|
|
20
20
|
- name: Install Rust
|
|
21
|
-
uses: dtolnay/rust-toolchain@
|
|
21
|
+
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master
|
|
22
22
|
with:
|
|
23
23
|
toolchain: stable
|
|
24
24
|
components: clippy
|
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
persist-credentials: false
|
|
36
36
|
|
|
37
37
|
- name: Install Rust
|
|
38
|
-
uses: dtolnay/rust-toolchain@
|
|
38
|
+
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master
|
|
39
39
|
with:
|
|
40
40
|
toolchain: stable
|
|
41
41
|
components: rustfmt
|
|
@@ -69,7 +69,7 @@ jobs:
|
|
|
69
69
|
persist-credentials: false
|
|
70
70
|
|
|
71
71
|
- name: Setup Node.js
|
|
72
|
-
uses: actions/setup-node@
|
|
72
|
+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
73
73
|
with:
|
|
74
74
|
node-version: "20"
|
|
75
75
|
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
python-version: ${{ matrix.python-version }}
|
|
33
33
|
|
|
34
34
|
- name: Install Rust
|
|
35
|
-
uses: dtolnay/rust-toolchain@
|
|
35
|
+
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master
|
|
36
36
|
with:
|
|
37
37
|
toolchain: stable
|
|
38
38
|
|
|
@@ -61,12 +61,12 @@ jobs:
|
|
|
61
61
|
submodules: recursive
|
|
62
62
|
|
|
63
63
|
- name: Set up free-threaded Python 3.14
|
|
64
|
-
uses: actions/setup-python@
|
|
64
|
+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
65
65
|
with:
|
|
66
66
|
python-version: "3.14t"
|
|
67
67
|
|
|
68
68
|
- name: Install Rust
|
|
69
|
-
uses: dtolnay/rust-toolchain@
|
|
69
|
+
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c # master
|
|
70
70
|
with:
|
|
71
71
|
toolchain: stable
|
|
72
72
|
|
|
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.8.0] - 2026-09-12
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Updated the `maxminddb` crate from 0.30.0 to 0.32.0, adding decoding resource
|
|
13
|
+
limits, fixing overflowing extended data types, and improving record decoding,
|
|
14
|
+
search-tree lookups, and selective path lookups.
|
|
15
|
+
- Databases that exceed the new decoding limits now raise `InvalidDatabaseError`,
|
|
16
|
+
including databases that previously decoded successfully.
|
|
17
|
+
- Updated Rust and Python dependencies and the MaxMind-DB test submodule.
|
|
18
|
+
- Dependabot now covers all Cargo and Python dependency types and test-submodule
|
|
19
|
+
updates, with seven-day cooldowns across all ecosystems.
|
|
20
|
+
- Synced applicable reader tests from the official Python reader's 3.2.0 release,
|
|
21
|
+
including bounded payload-amplification and pointer fan-out tests.
|
|
22
|
+
|
|
8
23
|
## [0.7.0] - 2026-07-19
|
|
9
24
|
|
|
10
25
|
### Changed
|
|
@@ -221,7 +236,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
221
236
|
- Python 3.8+
|
|
222
237
|
- CPython implementation
|
|
223
238
|
|
|
224
|
-
[0.
|
|
239
|
+
[0.8.0]: https://github.com/oschwald/maxminddb-rust-python/compare/v0.7.0...v0.8.0
|
|
240
|
+
[0.7.0]: https://github.com/oschwald/maxminddb-rust-python/compare/v0.6.0...v0.7.0
|
|
225
241
|
[0.6.0]: https://github.com/oschwald/maxminddb-rust-python/compare/v0.5.0...v0.6.0
|
|
226
242
|
[0.5.0]: https://github.com/oschwald/maxminddb-rust-python/compare/v0.4.0...v0.5.0
|
|
227
243
|
[0.4.0]: https://github.com/oschwald/maxminddb-rust-python/compare/v0.3.0...v0.4.0
|
|
@@ -25,26 +25,25 @@ checksum = "cf370abdafd54d13e54a620e8c3e1145f28e46cc9d704bc6d94414559df41763"
|
|
|
25
25
|
|
|
26
26
|
[[package]]
|
|
27
27
|
name = "libc"
|
|
28
|
-
version = "0.2.
|
|
28
|
+
version = "0.2.189"
|
|
29
29
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
-
checksum = "
|
|
30
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
31
31
|
|
|
32
32
|
[[package]]
|
|
33
33
|
name = "maxminddb"
|
|
34
|
-
version = "0.
|
|
34
|
+
version = "0.32.0"
|
|
35
35
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
-
checksum = "
|
|
36
|
+
checksum = "9b43d2458d977b610b04a3858e6504f06133663d303a1a0606601b530bfc9bc6"
|
|
37
37
|
dependencies = [
|
|
38
38
|
"ipnetwork",
|
|
39
39
|
"memchr",
|
|
40
40
|
"serde",
|
|
41
|
-
"simdutf8",
|
|
42
41
|
"thiserror",
|
|
43
42
|
]
|
|
44
43
|
|
|
45
44
|
[[package]]
|
|
46
45
|
name = "maxminddb-rust"
|
|
47
|
-
version = "0.
|
|
46
|
+
version = "0.8.0"
|
|
48
47
|
dependencies = [
|
|
49
48
|
"arc-swap",
|
|
50
49
|
"ipnetwork",
|
|
@@ -58,9 +57,9 @@ dependencies = [
|
|
|
58
57
|
|
|
59
58
|
[[package]]
|
|
60
59
|
name = "memchr"
|
|
61
|
-
version = "2.8.
|
|
60
|
+
version = "2.8.3"
|
|
62
61
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
-
checksum = "
|
|
62
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
64
63
|
|
|
65
64
|
[[package]]
|
|
66
65
|
name = "memmap2"
|
|
@@ -79,24 +78,24 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
|
79
78
|
|
|
80
79
|
[[package]]
|
|
81
80
|
name = "portable-atomic"
|
|
82
|
-
version = "1.
|
|
81
|
+
version = "1.15.0"
|
|
83
82
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
-
checksum = "
|
|
83
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
85
84
|
|
|
86
85
|
[[package]]
|
|
87
86
|
name = "proc-macro2"
|
|
88
|
-
version = "1.0.
|
|
87
|
+
version = "1.0.107"
|
|
89
88
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
-
checksum = "
|
|
89
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
91
90
|
dependencies = [
|
|
92
91
|
"unicode-ident",
|
|
93
92
|
]
|
|
94
93
|
|
|
95
94
|
[[package]]
|
|
96
95
|
name = "pyo3"
|
|
97
|
-
version = "0.29.
|
|
96
|
+
version = "0.29.2"
|
|
98
97
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
99
|
-
checksum = "
|
|
98
|
+
checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
|
|
100
99
|
dependencies = [
|
|
101
100
|
"libc",
|
|
102
101
|
"once_cell",
|
|
@@ -108,18 +107,18 @@ dependencies = [
|
|
|
108
107
|
|
|
109
108
|
[[package]]
|
|
110
109
|
name = "pyo3-build-config"
|
|
111
|
-
version = "0.29.
|
|
110
|
+
version = "0.29.2"
|
|
112
111
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
113
|
-
checksum = "
|
|
112
|
+
checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
|
|
114
113
|
dependencies = [
|
|
115
114
|
"target-lexicon",
|
|
116
115
|
]
|
|
117
116
|
|
|
118
117
|
[[package]]
|
|
119
118
|
name = "pyo3-ffi"
|
|
120
|
-
version = "0.29.
|
|
119
|
+
version = "0.29.2"
|
|
121
120
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
-
checksum = "
|
|
121
|
+
checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
|
|
123
122
|
dependencies = [
|
|
124
123
|
"libc",
|
|
125
124
|
"pyo3-build-config",
|
|
@@ -127,33 +126,33 @@ dependencies = [
|
|
|
127
126
|
|
|
128
127
|
[[package]]
|
|
129
128
|
name = "pyo3-macros"
|
|
130
|
-
version = "0.29.
|
|
129
|
+
version = "0.29.2"
|
|
131
130
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
-
checksum = "
|
|
131
|
+
checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
|
|
133
132
|
dependencies = [
|
|
134
133
|
"proc-macro2",
|
|
135
134
|
"pyo3-macros-backend",
|
|
136
135
|
"quote",
|
|
137
|
-
"syn",
|
|
136
|
+
"syn 2.0.119",
|
|
138
137
|
]
|
|
139
138
|
|
|
140
139
|
[[package]]
|
|
141
140
|
name = "pyo3-macros-backend"
|
|
142
|
-
version = "0.29.
|
|
141
|
+
version = "0.29.2"
|
|
143
142
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
-
checksum = "
|
|
143
|
+
checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
|
|
145
144
|
dependencies = [
|
|
146
145
|
"heck",
|
|
147
146
|
"proc-macro2",
|
|
148
147
|
"quote",
|
|
149
|
-
"syn",
|
|
148
|
+
"syn 2.0.119",
|
|
150
149
|
]
|
|
151
150
|
|
|
152
151
|
[[package]]
|
|
153
152
|
name = "quote"
|
|
154
|
-
version = "1.0.
|
|
153
|
+
version = "1.0.47"
|
|
155
154
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
|
-
checksum = "
|
|
155
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
157
156
|
dependencies = [
|
|
158
157
|
"proc-macro2",
|
|
159
158
|
]
|
|
@@ -166,21 +165,21 @@ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
|
166
165
|
|
|
167
166
|
[[package]]
|
|
168
167
|
name = "rustversion"
|
|
169
|
-
version = "1.0.
|
|
168
|
+
version = "1.0.23"
|
|
170
169
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
171
|
-
checksum = "
|
|
170
|
+
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
|
172
171
|
|
|
173
172
|
[[package]]
|
|
174
173
|
name = "self_cell"
|
|
175
|
-
version = "1.
|
|
174
|
+
version = "1.3.0"
|
|
176
175
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
177
|
-
checksum = "
|
|
176
|
+
checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813"
|
|
178
177
|
|
|
179
178
|
[[package]]
|
|
180
179
|
name = "serde"
|
|
181
|
-
version = "1.0.
|
|
180
|
+
version = "1.0.229"
|
|
182
181
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
183
|
-
checksum = "
|
|
182
|
+
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
|
184
183
|
dependencies = [
|
|
185
184
|
"serde_core",
|
|
186
185
|
"serde_derive",
|
|
@@ -188,35 +187,40 @@ dependencies = [
|
|
|
188
187
|
|
|
189
188
|
[[package]]
|
|
190
189
|
name = "serde_core"
|
|
191
|
-
version = "1.0.
|
|
190
|
+
version = "1.0.229"
|
|
192
191
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
193
|
-
checksum = "
|
|
192
|
+
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
|
194
193
|
dependencies = [
|
|
195
194
|
"serde_derive",
|
|
196
195
|
]
|
|
197
196
|
|
|
198
197
|
[[package]]
|
|
199
198
|
name = "serde_derive"
|
|
200
|
-
version = "1.0.
|
|
199
|
+
version = "1.0.229"
|
|
201
200
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
202
|
-
checksum = "
|
|
201
|
+
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
203
202
|
dependencies = [
|
|
204
203
|
"proc-macro2",
|
|
205
204
|
"quote",
|
|
206
|
-
"syn",
|
|
205
|
+
"syn 3.0.5",
|
|
207
206
|
]
|
|
208
207
|
|
|
209
208
|
[[package]]
|
|
210
|
-
name = "
|
|
211
|
-
version = "0.
|
|
209
|
+
name = "syn"
|
|
210
|
+
version = "2.0.119"
|
|
212
211
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
-
checksum = "
|
|
212
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
213
|
+
dependencies = [
|
|
214
|
+
"proc-macro2",
|
|
215
|
+
"quote",
|
|
216
|
+
"unicode-ident",
|
|
217
|
+
]
|
|
214
218
|
|
|
215
219
|
[[package]]
|
|
216
220
|
name = "syn"
|
|
217
|
-
version = "
|
|
221
|
+
version = "3.0.5"
|
|
218
222
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
219
|
-
checksum = "
|
|
223
|
+
checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9"
|
|
220
224
|
dependencies = [
|
|
221
225
|
"proc-macro2",
|
|
222
226
|
"quote",
|
|
@@ -231,22 +235,22 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
|
231
235
|
|
|
232
236
|
[[package]]
|
|
233
237
|
name = "thiserror"
|
|
234
|
-
version = "2.0.
|
|
238
|
+
version = "2.0.20"
|
|
235
239
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
236
|
-
checksum = "
|
|
240
|
+
checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
|
|
237
241
|
dependencies = [
|
|
238
242
|
"thiserror-impl",
|
|
239
243
|
]
|
|
240
244
|
|
|
241
245
|
[[package]]
|
|
242
246
|
name = "thiserror-impl"
|
|
243
|
-
version = "2.0.
|
|
247
|
+
version = "2.0.20"
|
|
244
248
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
245
|
-
checksum = "
|
|
249
|
+
checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
|
|
246
250
|
dependencies = [
|
|
247
251
|
"proc-macro2",
|
|
248
252
|
"quote",
|
|
249
|
-
"syn",
|
|
253
|
+
"syn 3.0.5",
|
|
250
254
|
]
|
|
251
255
|
|
|
252
256
|
[[package]]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "maxminddb-rust"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.8.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Gregory Oschwald <oschwald@gmail.com>"]
|
|
6
6
|
description = "Rust-based Python binding for MaxMind DB - high-performance alternative to maxminddb"
|
|
@@ -15,7 +15,7 @@ crate-type = ["cdylib"]
|
|
|
15
15
|
[dependencies]
|
|
16
16
|
arc-swap = "1"
|
|
17
17
|
ipnetwork = "0.21"
|
|
18
|
-
maxminddb =
|
|
18
|
+
maxminddb = "0.32.0"
|
|
19
19
|
memmap2 = "0.9"
|
|
20
20
|
pyo3 = "0.29.0"
|
|
21
21
|
rustc-hash = "2"
|
|
@@ -20,8 +20,8 @@ The only change required is updating your import statement:
|
|
|
20
20
|
```python
|
|
21
21
|
import maxminddb
|
|
22
22
|
|
|
23
|
-
reader = maxminddb.open_database(
|
|
24
|
-
result = reader.get(
|
|
23
|
+
reader = maxminddb.open_database("/path/to/GeoIP2-City.mmdb")
|
|
24
|
+
result = reader.get("8.8.8.8")
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
### After (maxminddb-rust)
|
|
@@ -29,8 +29,8 @@ result = reader.get('8.8.8.8')
|
|
|
29
29
|
```python
|
|
30
30
|
import maxminddb_rust
|
|
31
31
|
|
|
32
|
-
reader = maxminddb_rust.open_database(
|
|
33
|
-
result = reader.get(
|
|
32
|
+
reader = maxminddb_rust.open_database("/path/to/GeoIP2-City.mmdb")
|
|
33
|
+
result = reader.get("8.8.8.8")
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
That's it! All other code remains identical.
|
|
@@ -52,8 +52,8 @@ If you want to minimize changes initially, use an alias:
|
|
|
52
52
|
import maxminddb_rust as maxminddb
|
|
53
53
|
|
|
54
54
|
# Rest of your code remains unchanged
|
|
55
|
-
reader = maxminddb.open_database(
|
|
56
|
-
result = reader.get(
|
|
55
|
+
reader = maxminddb.open_database("/path/to/GeoIP2-City.mmdb")
|
|
56
|
+
result = reader.get("8.8.8.8")
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
This allows gradual migration while maintaining compatibility.
|
|
@@ -95,7 +95,7 @@ Then explicitly choose in your code:
|
|
|
95
95
|
|
|
96
96
|
```python
|
|
97
97
|
import maxminddb_rust # Use Rust implementation
|
|
98
|
-
import maxminddb
|
|
98
|
+
import maxminddb # Use official implementation (if still needed)
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
## API Compatibility
|
|
@@ -140,11 +140,12 @@ import maxminddb
|
|
|
140
140
|
from flask import Flask, request
|
|
141
141
|
|
|
142
142
|
app = Flask(__name__)
|
|
143
|
-
reader = maxminddb.open_database(
|
|
143
|
+
reader = maxminddb.open_database("/var/lib/GeoIP/GeoIP2-City.mmdb")
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
|
|
146
|
+
@app.route("/lookup")
|
|
146
147
|
def lookup():
|
|
147
|
-
ip = request.args.get(
|
|
148
|
+
ip = request.args.get("ip")
|
|
148
149
|
result = reader.get(ip)
|
|
149
150
|
return result
|
|
150
151
|
```
|
|
@@ -157,11 +158,12 @@ import maxminddb_rust
|
|
|
157
158
|
from flask import Flask, request
|
|
158
159
|
|
|
159
160
|
app = Flask(__name__)
|
|
160
|
-
reader = maxminddb_rust.open_database(
|
|
161
|
+
reader = maxminddb_rust.open_database("/var/lib/GeoIP/GeoIP2-City.mmdb")
|
|
162
|
+
|
|
161
163
|
|
|
162
|
-
@app.route(
|
|
164
|
+
@app.route("/lookup")
|
|
163
165
|
def lookup():
|
|
164
|
-
ip = request.args.get(
|
|
166
|
+
ip = request.args.get("ip")
|
|
165
167
|
result = reader.get(ip)
|
|
166
168
|
return result
|
|
167
169
|
```
|
|
@@ -199,6 +201,7 @@ Check which one is imported:
|
|
|
199
201
|
|
|
200
202
|
```python
|
|
201
203
|
import maxminddb_rust
|
|
204
|
+
|
|
202
205
|
print(maxminddb_rust.__file__)
|
|
203
206
|
```
|
|
204
207
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: maxminddb-rust
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Environment :: WebAssembly :: Emscripten
|
|
6
6
|
Classifier: Intended Audience :: Developers
|
|
@@ -174,9 +174,7 @@ Iterate over all networks in the database:
|
|
|
174
174
|
```python
|
|
175
175
|
import maxminddb_rust
|
|
176
176
|
|
|
177
|
-
with maxminddb_rust.open_database(
|
|
178
|
-
"/var/lib/GeoIP/GeoLite2-Country.mmdb"
|
|
179
|
-
) as reader:
|
|
177
|
+
with maxminddb_rust.open_database("/var/lib/GeoIP/GeoLite2-Country.mmdb") as reader:
|
|
180
178
|
for network, data in reader:
|
|
181
179
|
print(f"{network}: {data['country']['iso_code']}")
|
|
182
180
|
```
|
|
@@ -252,6 +250,7 @@ uv run python examples/batch_processing.py
|
|
|
252
250
|
|
|
253
251
|
```python
|
|
254
252
|
import maxminddb_rust
|
|
253
|
+
|
|
255
254
|
help(maxminddb_rust.open_database)
|
|
256
255
|
help(maxminddb_rust.Reader.get)
|
|
257
256
|
```
|
|
@@ -136,9 +136,7 @@ Iterate over all networks in the database:
|
|
|
136
136
|
```python
|
|
137
137
|
import maxminddb_rust
|
|
138
138
|
|
|
139
|
-
with maxminddb_rust.open_database(
|
|
140
|
-
"/var/lib/GeoIP/GeoLite2-Country.mmdb"
|
|
141
|
-
) as reader:
|
|
139
|
+
with maxminddb_rust.open_database("/var/lib/GeoIP/GeoLite2-Country.mmdb") as reader:
|
|
142
140
|
for network, data in reader:
|
|
143
141
|
print(f"{network}: {data['country']['iso_code']}")
|
|
144
142
|
```
|
|
@@ -214,6 +212,7 @@ uv run python examples/batch_processing.py
|
|
|
214
212
|
|
|
215
213
|
```python
|
|
216
214
|
import maxminddb_rust
|
|
215
|
+
|
|
217
216
|
help(maxminddb_rust.open_database)
|
|
218
217
|
help(maxminddb_rust.Reader.get)
|
|
219
218
|
```
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
|
-
from typing import Optional
|
|
5
|
-
|
|
6
4
|
|
|
7
5
|
DEFAULT_DATABASE_DIR = Path("/var/lib/GeoIP")
|
|
8
6
|
PREFERRED_DATABASE_NAMES = (
|
|
@@ -34,19 +32,21 @@ def default_databases() -> list[Path]:
|
|
|
34
32
|
return preferred or databases
|
|
35
33
|
|
|
36
34
|
|
|
37
|
-
def resolve_database(path:
|
|
35
|
+
def resolve_database(path: str | None) -> Path:
|
|
38
36
|
"""Resolve an explicit database path or choose an installed default."""
|
|
39
37
|
if path is not None:
|
|
40
38
|
database = Path(path).expanduser()
|
|
41
39
|
if not database.is_file():
|
|
42
|
-
|
|
40
|
+
msg = f"MaxMind DB file does not exist: {database}"
|
|
41
|
+
raise FileNotFoundError(msg)
|
|
43
42
|
return database
|
|
44
43
|
|
|
45
44
|
databases = default_databases()
|
|
46
45
|
if databases:
|
|
47
46
|
return databases[0]
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
msg = (
|
|
50
49
|
f"No MaxMind DB files found under {DEFAULT_DATABASE_DIR}. "
|
|
51
50
|
"Install a database there or pass --file /path/to/database.mmdb."
|
|
52
51
|
)
|
|
52
|
+
raise FileNotFoundError(msg)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/python
|
|
2
|
+
"""Measure full-record lookup throughput."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
2
5
|
|
|
3
6
|
import argparse
|
|
4
7
|
import random
|
|
@@ -6,12 +9,13 @@ import socket
|
|
|
6
9
|
import struct
|
|
7
10
|
import timeit
|
|
8
11
|
|
|
9
|
-
import maxminddb_rust
|
|
10
|
-
|
|
11
12
|
from _common import resolve_database
|
|
12
13
|
|
|
14
|
+
import maxminddb_rust
|
|
15
|
+
|
|
13
16
|
|
|
14
|
-
def generate_ips(count):
|
|
17
|
+
def generate_ips(count: int) -> list[str]:
|
|
18
|
+
"""Generate a reproducible sequence of random IPv4 addresses."""
|
|
15
19
|
random.seed(0)
|
|
16
20
|
return [
|
|
17
21
|
socket.inet_ntoa(struct.pack("!L", random.getrandbits(32)))
|
|
@@ -36,6 +40,7 @@ ips = generate_ips(args.count)
|
|
|
36
40
|
|
|
37
41
|
|
|
38
42
|
def lookup_ip_addresses() -> None:
|
|
43
|
+
"""Look up each prepared IP address."""
|
|
39
44
|
for ip in ips:
|
|
40
45
|
reader.get(ip)
|
|
41
46
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/python
|
|
2
|
+
"""Compare individual and batched lookup throughput."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
2
5
|
|
|
3
6
|
import argparse
|
|
4
7
|
import random
|
|
@@ -6,12 +9,13 @@ import socket
|
|
|
6
9
|
import struct
|
|
7
10
|
import timeit
|
|
8
11
|
|
|
9
|
-
import maxminddb_rust
|
|
10
|
-
|
|
11
12
|
from _common import resolve_database
|
|
12
13
|
|
|
14
|
+
import maxminddb_rust
|
|
15
|
+
|
|
13
16
|
|
|
14
|
-
def generate_ips(count):
|
|
17
|
+
def generate_ips(count: int) -> list[str]:
|
|
18
|
+
"""Generate a reproducible sequence of random IPv4 addresses."""
|
|
15
19
|
random.seed(0)
|
|
16
20
|
return [
|
|
17
21
|
socket.inet_ntoa(struct.pack("!L", random.getrandbits(32)))
|
|
@@ -30,7 +34,8 @@ parser.add_argument(
|
|
|
30
34
|
|
|
31
35
|
args = parser.parse_args()
|
|
32
36
|
if args.batch_size <= 0:
|
|
33
|
-
|
|
37
|
+
msg = "--batch-size must be positive"
|
|
38
|
+
raise ValueError(msg)
|
|
34
39
|
|
|
35
40
|
database = resolve_database(args.file)
|
|
36
41
|
reader = maxminddb_rust.open_database(database)
|
|
@@ -42,6 +47,7 @@ batches = [
|
|
|
42
47
|
|
|
43
48
|
|
|
44
49
|
def lookup_batches() -> None:
|
|
50
|
+
"""Look up the prepared IP addresses in batches."""
|
|
45
51
|
for batch in batches:
|
|
46
52
|
reader.get_many(batch)
|
|
47
53
|
|