adafruit/circup

How are dependencies with Community Bundle libraries listed in requirements.txt?

CedarGroveStudios opened this issue · 5 comments

I think @FoamyGuy is looking into this.

@tannewt and @CedarGroveStudios I've done some poking around inside of circup to try to better understand how it operates and done some thinking about this functionality.

The pyproject.toml files aren't currently included in the zipped bundles that circup downloads, so in order to go that route we would need to alter the tool that builds the bundles to have it include that file. If we do that perhaps it should also live inside of the requirements directory within the bundle. Or perhaps we could try to have it fetch the toml file from the repo without including it the bundle.

However I've also had another idea that will be very simple to implement.

requirements.txt files allow comments with the hashtag, so we could make our own syntax that circup can look for within a comment.

something like:

Adafruit-Blinka
# circup_requirement: cedargrove_midi_tools

This way pip will ignore that line. We can slightly modify the logic here:

circup/circup/__init__.py

Lines 1082 to 1084 in abd2251

if line.startswith("#") or line == "":
# skip comments
pass
to look for our special pre-fix comment and when found add that library to the list of requirements to get installed.

What do you think about that option?

requirements.txt is included in the bundle for each library but the toml file isn't? Seems like including the toml is more future-proof to me. I'd avoid expanding the use of requirements.txt.

requirements.txt is included in the bundle for each library but the toml file isn't?

That is correct. Here is an example of the structure of a bundle currently:

examples/
    74hc595_daisy_chain/
        74hc595_daisy_chain.py
    ...

lib/
    adafruit_ads1x15/
        [library .mpy files]
    ...
    [single file library .mpy files...]

requirements/
    adafruit_ads1x15/
        requirements.txt
    ....
README.txt
VERSIONS.txt

I'll look into the bundle builder to see about adding pyproject.toml to the bundles. @tannewt where should that file go inside the bundle? Inside of the existing requirements/ directory? or make a new directory for it?

@tannewt where should that file go inside the bundle? Inside of the existing requirements/ directory? or make a new directory for it?

I don't have a preference.