Skip to main content

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:
      1. Create/activate a venv: uv venv && source .venv/bin/activate
      2. Install: uv pip install pygpsd
  • 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 a Data object.
  • Exceptions / warnings:
    • UnexpectedMessageException — gpsd responded with an unexpected payload.
    • NoGPSDeviceFoundException — gpsd reports zero devices.
    • GPSInactiveWarning — gpsd is running, but there is no active fix.
  • Data contains:
    • mode (Fix), time (datetime), leap_seconds (int)
    • satellites: list[Satellite] (with fields like used, ss, prn, ...)
    • geo (lat/lon/alt etc.) and ecef positions/velocities
    • Helpers: get_used_satellites(), get_satellite_count()

Developing with uv

  1. Clone the repo and create a venv:
    • uv venv
    • source .venv/bin/activate (Linux/macOS) or .venv\\Scripts\\activate (Windows)
  2. Install the project in editable mode:
    • uv pip install -e .
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygpsd-1.1.4.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygpsd-1.1.4-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for pygpsd-1.1.4.tar.gz
Algorithm Hash digest
SHA256 c717a708ff16a2f5d48dc4b4ec1c7ee68bc979dd79258611ed5248fbc83665ca
MD5 2ee0b0f12c3783dba7ae73f87b7dea78
BLAKE2b-256 ca2de68347b7a51796496cca6eff035cf9c8d6fc17b142b10767690401daef98

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygpsd-1.1.4.tar.gz:

Publisher: release.yml on nbdy/pygpsd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pygpsd-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dd560eb490d20807b1fcc5157157b086e127bdcbf23f4b74dff251635d348551
MD5 0cb13d83834ab66a2c767c70fecdad61
BLAKE2b-256 6eb2892fbdb373c616d9fe65b961252f5f204b0503133f13491feaed19fa9497

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygpsd-1.1.4-py3-none-any.whl:

Publisher: release.yml on nbdy/pygpsd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page