This release is a pre-release and may not be stable for production use.
pyxpo-location
Device location, compass heading and geocoding for pyxpo apps. The API follows
expo-location. iOS uses Core Location. Android uses the
platform LocationManager (no Google Play services), the accelerometer and magnetometer for the heading, and
Geocoder for geocoding.
pip install pyxpo-location
[tool.pyxpo]
modules = ["location"]
# Optional: the text of the iOS permission prompts.
[tool.pyxpo.module_options.location]
locationWhenInUsePermission = "Show places near you."
import pyxpo_location as Location
perm = await Location.request_foreground_permissions_async()
if perm["granted"]:
loc = await Location.get_current_position_async(accuracy=Location.Accuracy.HIGH)
print(loc["coords"]["latitude"], loc["coords"]["longitude"])
sub = await Location.watch_position_async({"accuracy": Location.Accuracy.BALANCED, "distanceInterval": 10},
lambda loc: print(loc["coords"]))
sub.remove()
places = await Location.reverse_geocode_async({"latitude": 48.8584, "longitude": 2.2945})
Functions
| Function | Notes |
|---|---|
request_foreground_permissions_async() / get_foreground_permissions_async() |
Expo's permission response, plus ios: {"scope"} ("whenInUse", "always", "none") or android: {"accuracy"} ("fine", "coarse", "none"). The Android user may allow only approximate location. |
request_background_permissions_async() / get_background_permissions_async() |
Ask for the foreground permission first. Android needs ACCESS_BACKGROUND_LOCATION in [tool.pyxpo.android] permissions. |
use_foreground_permissions() / use_background_permissions() |
Hooks: (response, request, get). |
get_current_position_async(accuracy=...) |
A fresh location: {"coords": {"latitude", "longitude", "altitude", "accuracy", "altitudeAccuracy", "heading", "speed"}, "timestamp", "mocked"}. Unknown values are None. mocked is Android only. |
get_last_known_position_async(max_age=None, required_accuracy=None) |
The cached location, or None. |
watch_position_async(options, callback, error_handler=None) |
Options: accuracy, time_interval (Android, ms), distance_interval (m). Returns a subscription; call .remove(). |
watch_heading_async(callback) / get_heading_async() |
{"trueHeading", "magHeading", "accuracy"} in degrees. trueHeading is -1 until the location is known. Raises on devices without a compass (and on the iOS Simulator). |
geocode_async(address) |
[{"latitude", "longitude", "altitude", "accuracy"}]. Needs the network. |
reverse_geocode_async({"latitude", "longitude"}) |
Addresses: name, street, streetNumber, district, city, subregion, region, postalCode, country, isoCountryCode, timezone, formattedAddress. |
has_services_enabled_async() |
Whether location services are on. |
get_provider_status_async() |
locationServicesEnabled, backgroundModeEnabled; on Android also gpsAvailable, networkAvailable, passiveAvailable. |
enable_network_provider_async() |
Android: opens the location settings when network location is off. |
Accuracy runs from LOWEST (about 3 km) to BEST_FOR_NAVIGATION. camelCase names work too
(getCurrentPositionAsync, {"distanceInterval": 10}).
Not supported yet
Background updates (start_location_updates_async) and geofencing (start_geofencing_async) need a background
task manager, which pyxpo does not have yet. They raise NotSupportedError; is_background_location_available_async()
returns False. Use watch_position_async while the app is open.
Platforms
iOS 15+ and Android 7+ (API 24). On desktop the functions raise NotSupportedError, except
has_services_enabled_async(), which returns False.
Metadata
Release files for pyxpo-location 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyxpo_location-0.1.0a1.tar.gz | 19.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyxpo_location-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.1 kB
Release files / pyxpo_location-0.1.0a1.tar.gz
| Download URL | pyxpo_location-0.1.0a1.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00211c426262930f42cd67b13a31ef0f28e4100294d24a8644011f70e8a9c5d2
|
|
BLAKE2b-256 checksum How to use checksums |
f236595d4462dc77194617ae9e268c61d9a034a0abc94a99dfaa54c09c5a217b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / pyxpo_location-0.1.0a1-py3-none-any.whl
| Download URL | pyxpo_location-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 19.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a855708469fe10bb93d83a2856d8c99ec1113c61fd3511b51e9a172ac59d0f14
|
|
BLAKE2b-256 checksum How to use checksums |
6f156f9eb50b4e08c200e66c5c0f95b2c47f2fc0072397b1baab35332851c60b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log