seeing-things / track

Automates tracking of targets with a telescope using ephemeris (TLE files) and/or optical tracking.
MIT License
8 stars 0 forks source link

Replace broken and unmaintained `gps` package #274

Open bgottula opened 1 year ago

bgottula commented 1 year ago

The gps package I've been using hasn't been updated since 2019, and I discovered that it's broken in Python 3.10.

The argument encoding has been deprecated since Python 3.1, apparently.

Traceback (most recent call last):
  File "/home/rgottula/dev/track/./track/stars.py", line 168, in <module>
    main()
  File "/home/rgottula/dev/track/./track/stars.py", line 135, in main
    location = gps_client.make_location_from_args(args)
  File "/home/rgottula/dev/track/track/gps_client.py", line 410, in make_location_from_args
    location = g.get_location(
  File "/home/rgottula/dev/track/track/gps_client.py", line 215, in get_location
    if self.client.read() == -1:
  File "/home/rgottula/dev/venv/lib/python3.10/site-packages/gps/gps.py", line 285, in read
    self.unpack(self.response)
  File "/home/rgottula/dev/venv/lib/python3.10/site-packages/gps/client.py", line 199, in unpack
    self.data = dictwrapper(json.loads(buf.strip(), encoding="ascii"))
  File "/usr/lib/python3.10/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
TypeError: JSONDecoder.__init__() got an unexpected keyword argument 'encoding'

Either convince someone to update it or find a replacement.

bgottula commented 1 year ago

Okay so the gps package on PyPI is just an outdated version of the official Python client in the gpsd project. One of the maintainers listed on PyPI is also an active contributor to gpsd, so maybe that means it's "official" and not just some random person uploading it. In any case, I can see that the problem was fixed in the gpsd project in July 2020, but the most recent version of gps on PyPI is from 2019.

I opened https://gitlab.com/gpsd/gpsd/-/issues/232 in the hopes that the maintainers will push an update to PyPI. We'll see what they say.

bgottula commented 1 year ago

Well unfortunately the gpsd developer whose name was listed as a maintainer on the PyPI package denies having any control or involvement except to complain to PyPA about it. Allegedly the PyPI package was in fact uploaded by someone else and is not actually associated with gpsd.

Alternatives I can think of:

bgottula commented 1 year ago

Some alternative packages on PyPI that have been updated within the past year or so:

jgottula commented 1 year ago

I will see if I can do some digging on this...

jgottula commented 1 year ago

A quick peek suggests that this is probably the easiest good solution here. Looks like it was almost tailor-made for your "I just want a simple easy gpsd client" use case; and it's actually updated and so forth.

bgottula commented 1 year ago

Okay thanks. That was my conclusion as well, so it's first on my list to try. Not sure when exactly I'll get to it, since replacing gps wasn't what I was actually planning on working on next. As a stop-gap measure I've simply edited the gps code installed in my venv to remove the deprecated constructor arg, which seems to have worked, so at least it's not truly blocking me in the near term.