Python Forum
managing modules/scripts dynamically
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
managing modules/scripts dynamically
#1
I have a collection of scripts and modules that I want to integrate into an application{CLI for now}. The application needs to be able to list all the scripts and its basic usage.Now the problem is the scripts can be changed, new ones can be added or the user can also choose which ones to add into his application.

-I want this without having to restrict scripts implementation(having then inherit from a class with certain methods)
Something similar to pip...
Is there a python library for this kinda stuff or I have to implement a system myself.

My initial approach is to use .ini or json to store some mandatory settings or options and a static relative path to main.py to store the scripts.But it does not help with adding scripts later on as users cant be trusted for setting up .ini and json files.

any suggestion is much appreciated.
Reply
#2
If they're all in a sub-directory, you could just list the contents of the directory.  Or, you could import anything in the file, and use magic variables in each file (such as __doc__ or __name__) to display a menu and help.
Reply
#3
(Oct-06-2017, 04:55 PM)nilamo Wrote: If they're all in a sub-directory, you could just list the contents of the directory.  Or, you could import anything in the file, and use magic variables in each file (such as __doc__ or __name__) to display a menu and help.
thats what it was thinking but it doesn't help with adding scripts to that subdirectory ....Like pip does. If I have 5 scripts on remote server and I only want 3 of them i just download them and they get added to that subdirectory.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  managing new windows JonWayn 1 1,790 Sep-22-2022, 05:26 PM
Last Post: Larz60+
  Managing Objects JoeDainton123 1 1,700 May-15-2021, 03:18 PM
Last Post: Yoriz
  Managing dependencies with pipenv t4keheart 6 2,948 Aug-05-2020, 12:39 AM
Last Post: t4keheart
  managing command codes for external controller box Oolongtea 0 1,915 Sep-19-2019, 08:32 AM
Last Post: Oolongtea
  Python what should be name of the module for managing data of users ? harun2525 3 3,421 Dec-06-2017, 06:11 PM
Last Post: nilamo
  Modules issue, pip3 download modules only to pyhton3.5.2 not the latest 3.6.1 bmohanraj91 6 8,446 May-25-2017, 08:15 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020