No project description provided
Project description
pygpsd
A tiny, typed Python client for polling gpsd. It opens a plain TCP connection to a running gpsd instance (default localhost:2947) and returns structured data.
Installation
You can use either uv (recommended) or pip.
-
Using uv (recommended)
- In an existing project:
uv add pygpsd - For a standalone virtual environment:
- Create/activate a venv:
uv venv && source .venv/bin/activate - Install:
uv pip install pygpsd
- Create/activate a venv:
- In an existing project:
-
Using pip
pip install pygpsd
Python 3.8+ is supported.
Quickstart
from pygpsd import GPSD, GPSInactiveWarning, NoGPSDeviceFoundException
# Connect to gpsd (defaults: host="127.0.0.1", port=2947)
try:
gpsd = GPSD()
data = gpsd.poll()
except NoGPSDeviceFoundException:
print("No GPS device reported by gpsd")
except GPSInactiveWarning:
print("gpsd is up, but GPS is inactive (no fix)")
else:
# Data is a typed object with geo/ecef and satellites
print("Mode:", data.mode)
print("Timestamp:", data.time)
print("Satellites (used/total):", len(data.get_used_satellites()), "/", data.get_satellite_count())
print("Latitude, Longitude:", data.geo.position.lat, data.geo.position.lon)
API overview
GPSD(host: str = "127.0.0.1", port: int = 2947)— opens a connection to gpsd and enables WATCH.GPSD.poll() -> Data— issues a?POLL;request and returns aDataobject.- Exceptions / warnings:
UnexpectedMessageException— gpsd responded with an unexpected payload.NoGPSDeviceFoundException— gpsd reports zero devices.GPSInactiveWarning— gpsd is running, but there is no active fix.
Datacontains:mode(Fix),time(datetime),leap_seconds(int)satellites: list[Satellite](with fields likeused,ss,prn, ...)geo(lat/lon/alt etc.) andecefpositions/velocities- Helpers:
get_used_satellites(),get_satellite_count()
Developing with uv
- Clone the repo and create a venv:
uv venvsource .venv/bin/activate(Linux/macOS) or.venv\\Scripts\\activate(Windows)
- Install the project in editable mode:
uv pip install -e .
- Try it quickly:
python -c "from pygpsd import GPSD; print(GPSD().poll())"
This project uses standard PEP 621 metadata (Hatchling backend) and ships an uv.lock for reproducible dev installs.
Requirements
- A running gpsd instance reachable from where you run your code (default port 2947).
- Python 3.8 or newer.
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygpsd-1.1.4.tar.gz.
File metadata
- Download URL: pygpsd-1.1.4.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c717a708ff16a2f5d48dc4b4ec1c7ee68bc979dd79258611ed5248fbc83665ca
|
|
| MD5 |
2ee0b0f12c3783dba7ae73f87b7dea78
|
|
| BLAKE2b-256 |
ca2de68347b7a51796496cca6eff035cf9c8d6fc17b142b10767690401daef98
|
Provenance
The following attestation bundles were made for pygpsd-1.1.4.tar.gz:
Publisher:
release.yml on nbdy/pygpsd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygpsd-1.1.4.tar.gz -
Subject digest:
c717a708ff16a2f5d48dc4b4ec1c7ee68bc979dd79258611ed5248fbc83665ca - Sigstore transparency entry: 628692868
- Sigstore integration time:
-
Permalink:
nbdy/pygpsd@64a8a15380701f60e4ee0c9a6bff041124063978 -
Branch / Tag:
refs/tags/v1.1.4 - Owner: https://github.com/nbdy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@64a8a15380701f60e4ee0c9a6bff041124063978 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pygpsd-1.1.4-py3-none-any.whl.
File metadata
- Download URL: pygpsd-1.1.4-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd560eb490d20807b1fcc5157157b086e127bdcbf23f4b74dff251635d348551
|
|
| MD5 |
0cb13d83834ab66a2c767c70fecdad61
|
|
| BLAKE2b-256 |
6eb2892fbdb373c616d9fe65b961252f5f204b0503133f13491feaed19fa9497
|
Provenance
The following attestation bundles were made for pygpsd-1.1.4-py3-none-any.whl:
Publisher:
release.yml on nbdy/pygpsd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygpsd-1.1.4-py3-none-any.whl -
Subject digest:
dd560eb490d20807b1fcc5157157b086e127bdcbf23f4b74dff251635d348551 - Sigstore transparency entry: 628692876
- Sigstore integration time:
-
Permalink:
nbdy/pygpsd@64a8a15380701f60e4ee0c9a6bff041124063978 -
Branch / Tag:
refs/tags/v1.1.4 - Owner: https://github.com/nbdy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@64a8a15380701f60e4ee0c9a6bff041124063978 -
Trigger Event:
push
-
Statement type: