Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Import a library and all its dependencies on lib folder

    Scheduled Pinned Locked Moved WiPy 2&3
    libraryimportlibdependencies
    6 Posts 2 Posters 2.5k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Arkaik
      last edited by

      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.

      L 1 Reply Last reply Reply Quote 0
      • L Offline
        livius @Arkaik
        last edited by

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

        think about people first, then computers

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          Arkaik @livius
          last edited by

          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?

          L 1 Reply Last reply Reply Quote 0
          • L Offline
            livius @Arkaik
            last edited by

            @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 ;-)

            think about people first, then computers

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              Arkaik @livius
              last edited by

              @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 ;-)

              L 1 Reply Last reply Reply Quote 0
              • L Offline
                livius @Arkaik
                last edited by

                @Arkaik
                classic way always work ;-)

                think about people first, then computers

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom