Import a library and all its dependencies on lib folder



  • Hi ,

    I would like to use queues to communicate between my threads with this library : https://pypi.python.org/pypi/micropython-uasyncio.queues/0.1.2

    However, this library need collections.deque and uasynio.core.

    1 from collections.deque import deque
    2 from uasyncio.core import sleep
    

    I went to the micropython-lib github repository, I downloaded collection.deque and paste the source file into the lib folder.

    I think I'm not importing libraries correctly because I need to modify the line from collections.deque import deque to from collections import deque

    I tried to do the same thing with the uasyncio.core module but it also needs the logging module.

    I thing it should have a way to install a module and all its dependencies at the same time right?
    I can't imagine the only way is to manually import all the dependencies.

    Thank you in advance.



  • @Arkaik
    classic way always work ;-)



  • @livius
    Hi thought an apt-get like or pip-like system would exist ^^.

    I know that when I use pip for installing new modules there is a requires.txt file to download all the needed dependencies.

    When I download the module on pypi.python the folder architecture is the following one:

    micropython-uasyncio.core-1.0/
         micropython_uasyncio.core.egg-info/
              PKG-INFO
              requires.txt
         uasyncio/
              core.py
              test.py
              test2.py
    

    So because of this architecture I thought there would have a way to use the requires.txt file to recover all the dependencies.
    Maybe I'm dreaming ^^

    If it doesn't exist it's not a big deal, I'll just use the classic way ;-)



  • @Arkaik
    Downloading whole repository?
    How do you imagine that it will be automagically?
    I know that this is not the same but:
    Same with web page - you save it and it have link to other site. If it will automatically download all linked pages and all linked pages linked in linked pages - you will be attempting to download whole internet ;-)



  • Hi @livius, no I don't have it in the lib folder.

    I could put it in this folder but I imagine a situation where the module logging (or another one, whatever) also needs dependencies, I'll need to dowload them too.

    And if its dependencies also need other dependencies it will be a pain in the *** to import all of them independently, even more if I need to modify the way they are imported.

    That's why I'm asking if there is a faster/easier way to import a module and all its dependencies?



  • @Arkaik
    do you have logging.py in your lib folder?



Pycom on Twitter