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

dependency info doesn't clue circup to install connection manager #157

Closed
jepler opened this issue Feb 28, 2024 · 4 comments
Closed

dependency info doesn't clue circup to install connection manager #157

jepler opened this issue Feb 28, 2024 · 4 comments

Comments

@jepler
Copy link
Member

jepler commented Feb 28, 2024

I did a circup install adafruit_requests. Then at the repl,

>>> import adafruit_requests as requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_requests.py", line 46, in <module>
ImportError: no module named 'adafruit_connection_manager'

whatever's in the project metadata doesn't seem to have this dependency listed in a way circup understands.

@FoamyGuy
Copy link
Contributor

That is odd. My understanding of circup was that it checks requirements.txt for any dependencies deployed to pypi, and then checks pyproject.toml for a specific value that can contain dependencies which exist in a bundle but not on pypi.

It does look like connection manager is listed correctly in the requirements file:

Adafruit-Circuitpython-ConnectionManager

I'm pretty sure I saw someone mention in discord yesterday that they downloaded a project bundle from learn and it did properly contain ConnectionManager but I could have gotten wires crossed, I was not actively involved in the conversation.

It does look like circup isn't currently able to install connection manager directly either though, so perhaps our issue is deeper than just this libraries dependencies being properly linked.

circup install adafruit_connectionmanager
Found device at /media/timc/CIRCUITPY, running CircuitPython 9.0.0-beta.2.
Searching for dependencies for: ['adafruit_connectionmanager']
WARNING:
	adafruit_connectionmanager is not a known CircuitPython library.
Ready to install: []

circup install adafruit-circuitpython-connectionmanager
Found device at /media/timc/CIRCUITPY, running CircuitPython 9.0.0-beta.2.
Searching for dependencies for: ['adafruit-circuitpython-connectionmanager']
WARNING:
	adafruit_connectionmanager is not a known CircuitPython library.
Ready to install: []

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Feb 29, 2024

I think maybe whats happened is a mismatch of the expected library name. When connection manager gets imported in code it's imported as adafruit_connection_manager i.e.: https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager/blob/a37193847e3c7e9a4e5b9b3f893f0147df30cbad/examples/connectionmanager_helpers.py#L10C8-L10C35

circup typically supports both the "import name" like adafruit_connection_manager as well as the "pypi name" like Adafruit-Circuitpython-ConnectionManager

The latter isn't typically used by humans, but is internally when circup fetches dependencies from requirements.txt.

It looks like the "pypi name" for connection manager Adafruit-Circuitpython-ConnectionManager is not being properly converted into it's "import name" of adafruit_connection_manager but instead is missing that second underscore and becomes adafruit_connectionmanager which doesn't exist.

I'm not entire sure of the most appropriate way to resolve this situation though. It seems the naming isn't consistent with the logic that is currently within circup, so we either will need to rename it somewhere, or change the logic to try to handle this case.

If possible I think changing the name so that it's consistent with all of the other libraries would be good, but I don't know how much trouble would be caused by changing it.

However, if it is true that the learn project bundler can handle the naming the way it is, then perhaps it does make the most sense to update circups logic so that it's behavior matches the bundler. I know my assumption was that they did behave the same.

@dhalbert
Copy link
Contributor

I was worried about this initially when the repo was named, but saw that adafruit_bus_device and Adafruit_CircuitPython_BusDevice were working. So the question is why is it working for busdevice but not connectionmanager.

@FoamyGuy
Copy link
Contributor

this is resolved by: adafruit/circup#201

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

No branches or pull requests

3 participants