zipcodes 3.0.0__tar.gz → 3.0.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.
- {zipcodes-3.0.0 → zipcodes-3.0.1}/Cargo.lock +2 -2
- {zipcodes-3.0.0 → zipcodes-3.0.1}/Cargo.toml +1 -1
- {zipcodes-3.0.0 → zipcodes-3.0.1}/PKG-INFO +14 -10
- {zipcodes-3.0.0 → zipcodes-3.0.1}/README.md +13 -9
- zipcodes-3.0.1/crates/zipcodes/src/zips.json.bz2 +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/crates/zipcodes-py/src/lib.rs +3 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/python/zipcodes/__init__.py +6 -11
- zipcodes-3.0.0/crates/zipcodes/src/zips.json.bz2 +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/LICENSE.txt +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/crates/zipcodes/Cargo.toml +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/crates/zipcodes/README.md +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/crates/zipcodes/examples/gen_schema.rs +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/crates/zipcodes/src/lib.rs +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/crates/zipcodes-py/Cargo.toml +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/pyproject.toml +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/python/zipcodes/_zipcodes.pyi +0 -0
- {zipcodes-3.0.0 → zipcodes-3.0.1}/python/zipcodes/py.typed +0 -0
|
@@ -216,7 +216,7 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
|
216
216
|
|
|
217
217
|
[[package]]
|
|
218
218
|
name = "zipcodes"
|
|
219
|
-
version = "3.0.
|
|
219
|
+
version = "3.0.1"
|
|
220
220
|
dependencies = [
|
|
221
221
|
"bzip2",
|
|
222
222
|
"serde",
|
|
@@ -226,7 +226,7 @@ dependencies = [
|
|
|
226
226
|
|
|
227
227
|
[[package]]
|
|
228
228
|
name = "zipcodes-py"
|
|
229
|
-
version = "3.0.
|
|
229
|
+
version = "3.0.1"
|
|
230
230
|
dependencies = [
|
|
231
231
|
"pyo3",
|
|
232
232
|
"serde_json",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zipcodes
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.1
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -23,14 +23,12 @@ Project-URL: Issues, https://github.com/seanpianka/zipcodes/issues
|
|
|
23
23
|
|
|
24
24
|
# Zipcodes
|
|
25
25
|
|
|
26
|
-

|
|
27
|
-
|
|
28
|
-
[](https://crates.io/crates/zipcodes)
|
|
29
|
-
[](https://pepy.tech/project/zipcodes)
|
|
30
|
-
[](https://github.com/seanpianka/zipcodes/graphs/contributors)
|
|
26
|
+
Python:  [](https://pypi.org/project/zipcodes/) [](https://pepy.tech/project/zipcodes) [](https://pepy.tech/project/zipcodes)
|
|
27
|
+
|
|
28
|
+
Rust: [](https://crates.io/crates/zipcodes) [](https://crates.io/crates/zipcodes) [)](https://crates.io/crates/zipcodes) [)](https://crates.io/crates/zipcodes)
|
|
31
29
|
|
|
32
30
|
Zipcodes is a simple library for querying U.S. zipcodes. No SQLite, no
|
|
33
|
-
network, no runtime data files — the full dataset is embedded in the package.
|
|
31
|
+
network, no runtime data files — the full dataset is embedded in the package. [](https://github.com/seanpianka/zipcodes/graphs/contributors)
|
|
34
32
|
|
|
35
33
|
Since 2.0, the library is implemented in Rust and published from a single
|
|
36
34
|
codebase as both the [`zipcodes` Python package](https://pypi.org/project/zipcodes/)
|
|
@@ -146,20 +144,26 @@ automatically.
|
|
|
146
144
|
To rebuild the dataset manually:
|
|
147
145
|
|
|
148
146
|
```shell script
|
|
149
|
-
$ pip install
|
|
147
|
+
$ pip install -r scripts/requirements.txt
|
|
150
148
|
$ curl -fsSL https://download.geonames.org/export/zip/US.zip -o /tmp/geonames_us.zip
|
|
151
|
-
$ # download the .
|
|
149
|
+
$ # download the .xlsx linked from https://postalpro.usps.com/ZIP_Locale_Detail
|
|
152
150
|
$ python scripts/update_zipcode_dataset.py \
|
|
153
151
|
--base scripts/data/zip_code_database.csv \
|
|
154
152
|
--gps scripts/data/zip-codes-database-FREE.csv \
|
|
155
153
|
--geonames-zip /tmp/geonames_us.zip \
|
|
156
|
-
--usps-
|
|
154
|
+
--usps-file /tmp/usps_zip_locale.xlsx \
|
|
157
155
|
--output-bz2 crates/zipcodes/src/zips.json.bz2 \
|
|
158
156
|
--summary-output /tmp/change_summary.json
|
|
159
157
|
```
|
|
160
158
|
|
|
161
159
|
## Tests
|
|
162
160
|
|
|
161
|
+
[CI](https://github.com/seanpianka/Zipcodes/actions/workflows/ci.yml) runs Rust
|
|
162
|
+
checks and Python tests on pushes to `master` and pull requests. Rust API docs
|
|
163
|
+
are built automatically on [docs.rs](https://docs.rs/zipcodes) after each crate
|
|
164
|
+
release; this README is published to [PyPI](https://pypi.org/project/zipcodes/)
|
|
165
|
+
with each Python release.
|
|
166
|
+
|
|
163
167
|
The tests are defined in a declarative, table-based format that generates test
|
|
164
168
|
cases.
|
|
165
169
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# Zipcodes
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
[](https://crates.io/crates/zipcodes)
|
|
6
|
-
[](https://pepy.tech/project/zipcodes)
|
|
7
|
-
[](https://github.com/seanpianka/zipcodes/graphs/contributors)
|
|
3
|
+
Python:  [](https://pypi.org/project/zipcodes/) [](https://pepy.tech/project/zipcodes) [](https://pepy.tech/project/zipcodes)
|
|
4
|
+
|
|
5
|
+
Rust: [](https://crates.io/crates/zipcodes) [](https://crates.io/crates/zipcodes) [)](https://crates.io/crates/zipcodes) [)](https://crates.io/crates/zipcodes)
|
|
8
6
|
|
|
9
7
|
Zipcodes is a simple library for querying U.S. zipcodes. No SQLite, no
|
|
10
|
-
network, no runtime data files — the full dataset is embedded in the package.
|
|
8
|
+
network, no runtime data files — the full dataset is embedded in the package. [](https://github.com/seanpianka/zipcodes/graphs/contributors)
|
|
11
9
|
|
|
12
10
|
Since 2.0, the library is implemented in Rust and published from a single
|
|
13
11
|
codebase as both the [`zipcodes` Python package](https://pypi.org/project/zipcodes/)
|
|
@@ -123,20 +121,26 @@ automatically.
|
|
|
123
121
|
To rebuild the dataset manually:
|
|
124
122
|
|
|
125
123
|
```shell script
|
|
126
|
-
$ pip install
|
|
124
|
+
$ pip install -r scripts/requirements.txt
|
|
127
125
|
$ curl -fsSL https://download.geonames.org/export/zip/US.zip -o /tmp/geonames_us.zip
|
|
128
|
-
$ # download the .
|
|
126
|
+
$ # download the .xlsx linked from https://postalpro.usps.com/ZIP_Locale_Detail
|
|
129
127
|
$ python scripts/update_zipcode_dataset.py \
|
|
130
128
|
--base scripts/data/zip_code_database.csv \
|
|
131
129
|
--gps scripts/data/zip-codes-database-FREE.csv \
|
|
132
130
|
--geonames-zip /tmp/geonames_us.zip \
|
|
133
|
-
--usps-
|
|
131
|
+
--usps-file /tmp/usps_zip_locale.xlsx \
|
|
134
132
|
--output-bz2 crates/zipcodes/src/zips.json.bz2 \
|
|
135
133
|
--summary-output /tmp/change_summary.json
|
|
136
134
|
```
|
|
137
135
|
|
|
138
136
|
## Tests
|
|
139
137
|
|
|
138
|
+
[CI](https://github.com/seanpianka/Zipcodes/actions/workflows/ci.yml) runs Rust
|
|
139
|
+
checks and Python tests on pushes to `master` and pull requests. Rust API docs
|
|
140
|
+
are built automatically on [docs.rs](https://docs.rs/zipcodes) after each crate
|
|
141
|
+
release; this README is published to [PyPI](https://pypi.org/project/zipcodes/)
|
|
142
|
+
with each Python release.
|
|
143
|
+
|
|
140
144
|
The tests are defined in a declarative, table-based format that generates test
|
|
141
145
|
cases.
|
|
142
146
|
|
|
Binary file
|
|
@@ -175,6 +175,7 @@ fn contains<'py>(
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
/// Use `kwargs` to select for desired attributes from list of zipcode dicts
|
|
178
179
|
#[pyfunction]
|
|
179
180
|
#[pyo3(signature = (zips=None, **kwargs))]
|
|
180
181
|
fn filter_by<'py>(
|
|
@@ -235,6 +236,8 @@ fn filter_by_coordinates<'py>(
|
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
238
|
|
|
239
|
+
/// Calculate the great circle distance in miles between two points on the
|
|
240
|
+
/// earth (specified in decimal degrees).
|
|
238
241
|
#[pyfunction]
|
|
239
242
|
fn haversine(lon1: f64, lat1: f64, lon2: f64, lat2: f64) -> f64 {
|
|
240
243
|
zipcodes::haversine(lon1, lat1, lon2, lat2)
|
|
@@ -96,22 +96,17 @@ def filter_by_zip_code_type(zip_code_type, zips=None):
|
|
|
96
96
|
return filter_by(zips, zip_code_type=zip_code_type)
|
|
97
97
|
|
|
98
98
|
|
|
99
|
-
def haversine(lon1, lat1, lon2, lat2):
|
|
100
|
-
"""
|
|
101
|
-
Calculate the great circle distance in miles between two points
|
|
102
|
-
on the earth (specified in decimal degrees)
|
|
103
|
-
"""
|
|
104
|
-
return _zipcodes.haversine(lon1, lat1, lon2, lat2)
|
|
105
|
-
|
|
106
|
-
|
|
107
99
|
def filter_by_coordinates(lat, long, radius_in_miles=10, zips=None):
|
|
108
100
|
"""List of zipcode dicts within `radius_in_miles` of (`lat`, `long`)."""
|
|
109
101
|
return _zipcodes.filter_by_coordinates(lat, long, radius_in_miles, zips=zips)
|
|
110
102
|
|
|
111
103
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
# Pure passthroughs: the native functions already have the desired signature
|
|
105
|
+
# and docstring, so re-export them verbatim rather than wrapping. (The wrappers
|
|
106
|
+
# above add Python-only behavior — a type guard, a default arg, or caching —
|
|
107
|
+
# and so are kept.)
|
|
108
|
+
filter_by = _zipcodes.filter_by
|
|
109
|
+
haversine = _zipcodes.haversine
|
|
115
110
|
|
|
116
111
|
|
|
117
112
|
def list_all(zips=None):
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|