When using the simple mode, PYTHONSTARTUP script is not loaded if defined. This PR is fixing this by loading script defined in PYTHONSTARTUP (if any).
Using python craft tinker -i
Using Ipython is the recommended way. This shell comes with a lot of features (auto completion, color highlighting and much more, see doc). This shell is automatically using PYTHONSTARTUP var meaning it will load any script defined in this env variable when starting the shell. Also it will load all scripts located in ~/.ipython/profile_default/startup/.
This PR does not do anything when using IPython as the behaviour is already great.
Fix #205 (partially at least) => We really advise here to use Ipython mode because it comes with a lot of features (such as auto-reloading). It's less work and maintenance for much more features than trying to implement (not as good as what's inside ipython) some of those features.
In addition I don't really like using the bare eval or exec methods in Masonite code... (IPython is using a safe_exec method they have implemented).
About the changes I just added the content of code.interact() method instead of calling it directly as before: this allow us to access console instance that we can use to run additional code.
Summary :
Using
python craft tinker
When using the simple mode, PYTHONSTARTUP script is not loaded if defined. This PR is fixing this by loading script defined in PYTHONSTARTUP (if any).
Using
python craft tinker -i
Using
Ipython
is the recommended way. This shell comes with a lot of features (auto completion, color highlighting and much more, see doc). This shell is automatically using PYTHONSTARTUP var meaning it will load any script defined in this env variable when starting the shell. Also it will load all scripts located in~/.ipython/profile_default/startup/
. This PR does not do anything when using IPython as the behaviour is already great.Fix #205 (partially at least) => We really advise here to use Ipython mode because it comes with a lot of features (such as auto-reloading). It's less work and maintenance for much more features than trying to implement (not as good as what's inside ipython) some of those features. In addition I don't really like using the bare
eval
orexec
methods in Masonite code... (IPython
is using asafe_exec
method they have implemented).About the changes I just added the content of
code.interact()
method instead of calling it directly as before: this allow us to accessconsole
instance that we can use to run additional code.