It provides a simple super-basic framework for making a Python app. I created this framework because I was all the time making the same architecture from scratch, for all my Python apps. Now it's a bit faster.
It contains several folders and files, among them:
Files:
launcher.sh
a double click on it will launch your app, with the entry point insrc/main.py
. It also load the locallib/
folder inPYTHONPATH
.src/SettingFileReader.py
for dealing with settings written in the filesettings/settings.ini
settings.ini
a config file to be used with theConfigParser
module.README.md
the readme, using markdown syntax.
Folders:
src
must contain your python source files.lib
contains the external Python modules (from Pypi, Github...)test
you can place your test sources there
When your code is in the src
folder with main.py
as entry point and your external module in the lib
folder, just double click on launcher.sh
to start the program.
Use the class SettingFileReader
if you need to tune your app with some parameters. An example of using this feature is in the main
function from src/main.py
.
SettingFileReader
needs tobe used with only two functions: constructor and getter.
-
Constructor: default is without any argument. In this case the "setting.ini" file will be used. You can specify another file using a relative address (from the launcher) or absolute.
-
Getter :
getSetting
returns the parameter written in "setting.ini" (by default) after casting it to float if it's a float, to int if it's an integer or to string in other cases.
Takes two arguments:group
: the group of arguments, writen between square bracketsname
: name of the argument
It was developped on OSX but should work without any problem on any UNIX platform.
- Adding a smart command line argument interpreter (not in main, but rather another module), with some try/except blocks (because it always looks fancy) + makes this compatible with the
setting.ini
file. - Adding a text file containing the help, accessible with
-h
or--help
or just by typing some not-existing arguments - Adding a
model/view/controller
structure in order to make it easily compatible to a GUI development with the minimalist TKinter