superwings-spinel
Find the nearest airport from (lat, lng) coordinates — the superwings API, computed by a Ruby port of the airport_finder crate compiled to native code by Spinel, Matz's Ruby AOT compiler.
from superwings_spinel import AirportSet, airport, country_at, find_nearest_airport
find_nearest_airport(37.5665, 126.978)
# {'code': 'kr.gmp', 'name': 'Seoul, Korea'}
country_at(-29.31, 27.48)
# 'ls'
hubs = AirportSet(["HYD", "BOM", "BCN"])
hubs.resolve(17.385, 78.486, foreign_max_km=300)
# {'code': 'in.hyd', 'iata': 'HYD', 'name': 'Hyderabad, India', ...,
# 'distance_km': 18.09828547178263, 'resolution': 'same_country', 'nearest_code': 'in.bpm'}
hubs.nearest(19.07, 72.87, country="IN", limit=2)
Functions, dicts and errors are superwings 0.3.0's: import superwings_spinel as superwings is enough to switch. The answers are the crate's, bit for bit
on 150,403 test points, with one difference from superwings 0.3.0, which
bundles the crate's 0.3.1: an enclave is its own country. Maseru is Lesotho
(ls), not South Africa; 0.3.1 answered za across all of Lesotho.
Speed
The Rust wheel is faster, by about as much as the compiled code is. From
Python on an Apple M1 (superwings in parentheses): find_nearest_airport
takes 6 µs near airports (3.6 µs) and 25 µs anywhere (14 µs);
AirportSet.nearest(limit=5) 8.6 µs (6.6 µs), resolve 9 µs (4.6 µs),
airport 1 µs (0.8 µs). Loading the data on the first call takes about
33 ms (26 ms).
The library answers with numbers: airports by index, with distances. The module makes an airport's dict the first time that airport comes up and hands out copies, so a call formats and parses nothing (0.1.0 passed JSON: 2–4× superwings). The dicts kept come to about 8 MB if every airport has come up.
Notes
- The library takes one call at a time; the module serializes calls from threads with a lock.
- Wheels carry no Python extension (the library is loaded with ctypes), so one wheel per platform serves every Python 3.9+. Elsewhere the sdist builds with a C compiler alone.
$SUPERWINGS_SPINEL_LIBpoints the module at another build of the library.
License
MIT. The library includes Spinel's runtime (MIT); see THIRD_PARTY_NOTICES.
Metadata
Release files for superwings-spinel 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| superwings_spinel-0.1.1.tar.gz | 2.6 MB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| superwings_spinel-0.1.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| superwings_spinel-0.1.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| superwings_spinel-0.1.1-py3-none-macosx_11_0_universal2.whl | Python 3 | none | macOS 11.0+ universal2 (ARM64, x86-64) | Details |
Total release size: 9.2 MB
Release files / superwings_spinel-0.1.1.tar.gz
| Download URL | superwings_spinel-0.1.1.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07317de926ea03e81ca8a91b68d99a965d6e59ac291fd635386e3cd69b651f7b
|
|
BLAKE2b-256 checksum How to use checksums |
8635d1098db6ed8d4b6009c2605c08c13f0066f3385a214c94b8d9c9c2a953dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / superwings_spinel-0.1.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | superwings_spinel-0.1.1-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
534a1023644fed844e7a22d40092f20af32055c5cbfe888127303fe8871923d6
|
|
BLAKE2b-256 checksum How to use checksums |
1511ed0752c7e236ac2f1b5a4cfa39ff2a74cc817a13bd9d7bb29b8965024bbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / superwings_spinel-0.1.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | superwings_spinel-0.1.1-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
344940fd98a9af7ab59cadda05631f54e8ce1501272844cd1680be63fd3b6e9d
|
|
BLAKE2b-256 checksum How to use checksums |
c306983e720627d80fe8599001e9b3ea756175d1c4e8589f75de187f314ba6bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / superwings_spinel-0.1.1-py3-none-macosx_11_0_universal2.whl
| Download URL | superwings_spinel-0.1.1-py3-none-macosx_11_0_universal2.whl |
|---|---|
| Size | 3.3 MB |
| Tags | Python 3 macOS 11.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
b98afe9879e7f214e7e06ffc547d06cc27f9af7071cd295ea980697302150f7b
|
|
BLAKE2b-256 checksum How to use checksums |
db04b9cdbd5a141be18a5d915d7913fc74dd6b3f435fd16c73e630489a265b4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|