Skip to content

Add requirement.txt support for freeze and install commands#30

Merged
ntoll merged 3 commits into
adafruit:masterfrom
stevenabadie:29
Mar 30, 2020
Merged

Add requirement.txt support for freeze and install commands#30
ntoll merged 3 commits into
adafruit:masterfrom
stevenabadie:29

Conversation

@stevenabadie
Copy link
Copy Markdown

@stevenabadie stevenabadie commented Mar 27, 2020

This adds support for managing project module requirements through a requirements.txt file. The freeze command can now output a requirements.txt file for all modules installed on a connected device. The install command can then use the requirements.txt file to install a list of requirements to a connected device.

The expected workflow would be that a project could export a requirements.txt file with the modules required for their project and provide the file in the project source. Another user could then quickly install all of the required modules for the project onto their device.

This is built on top of the existing install command which does not consider module versions. For later I think as there would need to be a way to organize all of the module versions.

Close #29

Steven Abadie added 3 commits March 27, 2020 16:14
Saves output of modules found on connected device to a requirements.txt
file in the current working directory. #29
This moves majority of existing install command to separate function and adds check for existing modules already on device. This is only checking against the names of the modules and would require further work to check versions of modules.
Adds missing install command instructions also. #29
@ladyada ladyada requested review from makermelissa and ntoll March 27, 2020 23:20
@FoamyGuy
Copy link
Copy Markdown
Contributor

I tested circup freeze -r and circup install -r requirements.txt on Win 7. Both are working as intended for me. Really like this functionality.

@ntoll ntoll merged commit 5d7f385 into adafruit:master Mar 30, 2020
@ntoll
Copy link
Copy Markdown
Collaborator

ntoll commented Mar 30, 2020

Hey @stevenabadie, you're on fire 🔥 👍

Thank you, once again, for this contribution. Please remember to make check before submitting a PR since it runs the full test suite and reports on code coverage. I've added a # pragma: no cover to the install_module function since we're not unit testing those aspects of the code which require IO interaction with the user (everything else, which does the heavy lifting, is tested).

I also took the liberty to check on the pip file format guidelines (https://pip.pypa.io/en/latest/reference/pip_install/#requirements-file-format) and made two small, but hopefully useful, changes to your code:

  1. Empty lines are ignored (they were reporting an error).
  2. Comments are honoured (Anything after a # is ignored).

As a result, a requirements.txt like the following will work:

adafruit_rsa==1.1.0
adafruit_seesaw==1.6.0

adafruit_tinylora==2.1.0  # this is a test.
# Another comment.
adafruit_waveform==1.3.0

Other than that, it's a beauty and delighted to merge..! 🙂 :shipit:

@stevenabadie
Copy link
Copy Markdown
Author

@ntoll thank you for reviewing, feedback, and additions! 🙌

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.

Add a command to install modules from requirements file

3 participants