Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace broken and unmaintained gps package #274

Open
bgottula opened this issue Mar 6, 2023 · 6 comments
Open

Replace broken and unmaintained gps package #274

bgottula opened this issue Mar 6, 2023 · 6 comments
Assignees

Comments

@bgottula
Copy link
Collaborator

bgottula commented Mar 6, 2023

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 bgottula self-assigned this Mar 6, 2023
@bgottula
Copy link
Collaborator Author

bgottula commented Mar 6, 2023

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
Copy link
Collaborator Author

bgottula commented Mar 6, 2023

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:

  • Try to email the supposed author of the PyPI package and see if that person is more helpful. (Update: Email sent on 5 March, waiting for a reply.)
  • Use the python3-gps package in Ubuntu 22.04, which probably has a more recent version than what's on PyPI and presumably is compatible with Python 3.10. But using that would mean that track can no longer install that dependency automatically, which is unfortunate. It would also mean that I have to allow the virtual environment to use system packages (using --system-site-packages at venv creation) which has all kinds of horrible side effects.
  • Find some other gpsd client package on PyPI. I haven't come across one yet that looks particularly promising. Actually there are a couple of decent-looking candidates.
  • Copy gpsd's Python client directly into this repo. Definitely not my favorite option but it would get the job done.
  • Roll my own gpsd client. I only need a small subset of features, so this may not be terribly difficult. I could even start with the official client and refactor it to remove all the stuff I don't care about.

@bgottula bgottula changed the title gps package using deprecated JSONDecoder constructor arg encoding gps package is broken and unmaintained Mar 6, 2023
@bgottula bgottula changed the title gps package is broken and unmaintained Replace broken and unmaintained gps package Mar 6, 2023
@bgottula
Copy link
Collaborator Author

bgottula commented Mar 6, 2023

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

@jgottula
Copy link
Collaborator

jgottula commented Mar 6, 2023

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

@jgottula
Copy link
Collaborator

jgottula commented Mar 6, 2023

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
Copy link
Collaborator Author

bgottula commented Mar 7, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants