What’s the correct process to install and run a .py application and its dependencies? Where should I save the .py file, where should I run it from, and can it interfere with the rest of my system?

Often there is an application/script I’d like to use and it is provided as a .py file download, along with a list of other applications/scripts that need to be installed separately for it to work. Often not all of these dependencies are available in my distro’s repository. There seems to be an assumption of prior knowledge as to how to get set up to run .py files, and it is therefore not documented on developers pages. Can anyone fill me in?

I’d like to install this application. Perhaps it could be used as an example to help explain the process.

My distro is Debian 13, in case that’s relevant.

Thanks!

  • Da Oeuf@slrpnk.netOP
    link
    fedilink
    arrow-up
    2
    ·
    7 hours ago

    Thanks for the help! For some reason tab autocompletion doesn’t work for me but that’s an issue for another day…

    put the .py file in the right place to run inside the venv

    This could be where I’ve been getting lost. How do I figure out what the right place is?

    • doodoo_wizard@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      7 hours ago

      One man’s right place is another man’s evidence of clinical insanity. You could just leave them on your desktop and invoke them through the venv. You could make a folder called Folder For Python Scripts That Don’t Run Good and put all your different python things there.

      You can also put the target python script inside the folder its respective venv lives in.

      Really the world is your oyster because ultimately you’re gonna make another script that does something like “read $a; ~./<venv_location>/python3 <target_.py_file> $a;” and naming it what you wanna type to run your .py and put it in your local $PATH directory.

      Don’t trust that one liner btw it’s definitley wrong.

      • Da Oeuf@slrpnk.netOP
        link
        fedilink
        arrow-up
        3
        ·
        5 hours ago

        Ok, so am I understanding correctly that for example the .py can be anywhere, as long as it is run from a suitable venv folder and the path to it is defined in the command?

        • doodoo_wizard@lemmy.ml
          link
          fedilink
          arrow-up
          4
          ·
          4 hours ago

          Yeah, a python venv has two parts, one part is just a bunch of copies of some basic python shit that you know you’re gonna need, that’s honestly 99% of what you want when you do a venv and need to install a million stupid piles of crap by copy pasting a pip one liner into your shell.

          You use this part by just invoking your python3 or pip command inside the venv folder. So ~./<venv_location>/pip install <joes_dumb_crap> or something.

          The other one percent is actually invoking the venv which is a really important one percent in terms of not being a guy who plays fast and loose with his systems security and privacy when messing around with totally trustworthy python stuff. It’s only one percent because tbh no one is that guy they’re all the “do whatever just make it run” guy.

          So you could have a script file called rectarg in your local path folder that invokes rectarg.py using the python3 executable inside your venv folder and passes whatever you type after “rectarg” straight to rectarg.py.