omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Module grabber

    Pythonista
    4
    5
    2823
    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.
    • misha_turnbull
      misha_turnbull last edited by

      I was curious as to what some of the modules (as in, import {module}) actually look like. So I made this script to pull them from the app's site-packages folder.

      https://gist.github.com/79be00ce58370583b65f

      I'm sure it can be improved – all I ask is that you let me know so I can get the better version! :p

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        You might want to have a look at the inspect module, particularly the getsource function.

        1 Reply Last reply Reply Quote 0
        • dgelessus
          dgelessus last edited by

          I made something similar a while ago, it looks up and opens the path for a given module name.

          Bonus feature: if you have text selected that looks like a module name or import statement, that module is looked up directly without asking for a name.

          1 Reply Last reply Reply Quote 0
          • misha_turnbull
            misha_turnbull last edited by

            Thanks for the suggestions! I've implemented the inspect module and am working on something similer to the importfinder script.

            https://gist.github.com/0728664ccf51b9b2bcce

            1 Reply Last reply Reply Quote 0
            • pacco
              pacco last edited by

              Thanks for the useful tool. Python is still relatively new to me and whenever learning a new language it always helps to spend as much time as possbile reading existing code. The Python standard library modules are ideal sources (pun intended) for code to study.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors