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

Adding option to install library stubs from PyPi #229

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

Jessseee
Copy link
Contributor

@Jessseee Jessseee commented Jun 17, 2024

Implementation of feature request #140, this is something I would really like to see as a PyCharm user.

As described in the PyCharm + CircuitPython setup guide there are packages available on PyPi that contain stubs for libraries from the Adafruit Library Bundle, these packages help give the IDE you are using context for your CircuitPython code so that code hinting can work properly.

Instead of having to manually install these stubs after installing packages using CircUp, this PR adds the --stubs flag to the circup install command which enables a step in the installation process to try to install the available stubs package using pip.

This would currently only work for libraries in the Adafruit CircuitPython Bundle, as I don't see an easy way to find out whether there are stubs packages on PyPi for any other CircuitPython libraries.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this functionality @Jessseee

I think this should not be in the Backend class. Backend and it's sub-classes are meant to contain only functionality that needs to interact with CircuitPython devices.

Since the new functionality is installing stubs on the PC that is running circup rather than doing anything to the Circuitpython device that is connected I think it would be best to move it somewhere else.

In my mind having the new functionality inside of install() function in commands.py would be a good spot for this. https://github.com/adafruit/circup/blob/main/circup/commands.py#L314

@Jessseee
Copy link
Contributor Author

Ah yes, I was debating where to put it, but with that explanation, it would indeed make more sense to put it in the install command.

@Jessseee Jessseee force-pushed the installing_pypi_stubs branch 4 times, most recently from 4bd5d7d to 2f81dc6 Compare June 17, 2024 18:32
@Jessseee
Copy link
Contributor Author

@FoamyGuy Moved the installation of the stubs packages to commands.py and reverted any changes I made to backends.py. Sorry for spamming the CI, I had a small fight with your pre-commit pipeline. 😅

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks again for adding this @Jessseee!

I tested this branch successfully in a local venv.

@FoamyGuy FoamyGuy merged commit cb3de91 into adafruit:main Jul 1, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants