Show DevBest Automated third party module installer for python

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Updated code is over at:

Wrote a neat little script that installs missing modules automatically through pip, using python's default os module.
This is great if you plan on releasing a python project but can't be bothered to use cx_freeze etc to pack third party modules along with your project.

Here's a youtube demo of it in action with my python flask web framework:

The code's on:

rqe5LHy4S3_JDL1-iu0OaQ.png
 
Last edited:

MayoMayn

BestDev
Oct 18, 2016
1,423
683
Cheers bro, python will always be hip.
I really like the idea about this. If it is possible, it could be nice if you coded it into something like npm or composer kinda, but for python.
Or does something like that already exist? (Didn't bother to search)
 

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
I really like the idea about this. If it is possible, it could be nice if you coded it into something like npm or composer kinda, but for python.
Or does something like that already exist? (Didn't bother to search)
pip is essentially npm i think, without the logical commands
 
Hey, it's me again. I saw alot of love for this script so i decided to fully recode it to be fully modular and object oriented, cheers.
Updated code is over at:
00ca8374dfa84c41aa07cfe89cc5762c.png
 

Mikee

Active Member
Jul 8, 2017
162
102
pip is essentially npm i think, without the logical commands
 
Hey, it's me again. I saw alot of love for this script so i decided to fully recode it to be fully modular and object oriented, cheers.
Updated code is over at:
00ca8374dfa84c41aa07cfe89cc5762c.png
Few questions
  • why are u using camelcase for function definitions then underscores for variable assignments :p
  • Also, why not assign the modules_to_be_assigned in the constructor for the class.
  • Also why dont anyone of the functions like checkIfExists have a following argument for the module they want to check.
  • Why not make the class be used as a blueprint, instead of initalizing a new instance of the class everytime i wanna do something simple like check_if_exists

In other words why do you make the users do this
1. Go into the module and manually add the modules by hand into the dictionary (dont understand why you've done it this way)
Then do.
new_api = Apis()
new_api.check_if_exists()

Why not just
Apis().check_if_exists(selenium) --> returns a boolean​

Those are some of the things i don't understand.
 
Last edited:

griimnak

You're a slave to the money then you die
Jul 20, 2013
957
800
Few questions
  • why are u using camelcase for function definitions then underscores for variable assignments :p
  • Also, why not assign the modules_to_be_assigned in the constructor for the class.
  • Also why dont anyone of the functions like checkIfExists have a following argument for the module they want to check.
  • Why not make the class be used as a blueprint, instead of initalizing a new instance of the class everytime i wanna do something simple like check_if_exists

In other words why do you make the users do this
1. Go into the module and manually add the modules by hand into the dictionary (dont understand why you've done it this way)
Then do.
new_api = Apis()
new_api.check_if_exists()

Why not just
Apis().check_if_exists(selenium) --> returns a boolean​

Those are some of the things i don't understand.
Well, prepare to not understand even more things about this script because this is literally replaced by:
Code:
pip install -r requirements.txt
requirements.txt:
Code:
flask
gunicorn
pymysql
passlib
some_other_module
I had no idea of the command at the time, so it rendered my script useless. I don't suggest anyone use this, just put your requirements in a txt and pip install -r :p

In other words why do you make the users do this
1. Go into the module and manually add the modules by hand into the dictionary (dont understand why you've done it this way)
Then do.
new_api = Apis()
new_api.check_if_exists()

Why not just
Apis().check_if_exists(selenium) --> returns a boolean
^ Yeah i definitely agree
 

Users who are viewing this thread

Top