Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing dependencies from script #929

Open
ghost opened this issue Nov 6, 2022 · 1 comment
Open

Installing dependencies from script #929

ghost opened this issue Nov 6, 2022 · 1 comment
Assignees
Labels
query For asking any kind of question

Comments

@ghost
Copy link

ghost commented Nov 6, 2022

I noticed that a lot of the scripts require the user to install a module or more (obviously!).

Instead of having the user install each module required for each script, why not install these modules FROM the script itself?

I have an example of this over at my ArkEngine repository. The code is here:

import sys
import subprocess as sp

def dependencies(pip = str):
        try:
            sp.call(f'{pip} install pygame', shell = True)
            sp.call(f'{pip} install cryptography', shell = True)
        except:
            print('custom error message')
            sys.exit()

In the code snippet above, the required modules for my project are pygame and cryptography. So in each script, you can add the lines dependencies('pip3') (for macOS users) and/or dependences('pip') (for Windows users). Make sure to modify the dependencies() function to include all the modules you need.

There are many variations, you could also have the code check if the user has the dependencies (modules) installed. If they don't, install it for them. macOS requires pip3, it'll say pip is not a valid command, the same way it does for python.

I think installing the dependent modules from the scripts would improve the UX by removing another step for them.

@ghost ghost added the query For asking any kind of question label Nov 6, 2022
@ghost ghost assigned pawangeek Nov 6, 2022
@MalikMlitat
Copy link

hmm, usually you shouldn't change the system without owner's agreement or else you uninstall the modules which you installed after execution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
query For asking any kind of question
Projects
None yet
Development

No branches or pull requests

2 participants