Skip to content

Commit

Permalink
[IMP] base: "--shell-file" option override for $PYTHONSTARTUP
Browse files Browse the repository at this point in the history
The $PYTHONSTARTUP env variable can contain a python script
that is used by Python shell at the start of any interactive session.

    fix this feature from being broken in python and ptpython
    include a new --shell-file=<filename> shell parameter to override
    the env variable $PYTHONSTARTUP
    group the two shell parameters in a new options group
    remove custom python shells' banners from the start of the session

Python docs: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP

Community PR: odoo/odoo#185075
task-4306704
  • Loading branch information
lordkrandel committed Nov 6, 2024
1 parent 7b6f0d9 commit 1dd44c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions content/developer/reference/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,11 @@ interaction with the :ref:`orm <reference/orm>` and its functionalities.
By default, the shell is running in transaction mode. This means that any change made to the
database is rolled back when exiting the shell. To commit changes, use `env.cr.commit()`.


.. option:: --shell-file <init_script.py>
Specify a python script to be run after the start of the shell.
Overrides the environment variable PYTHONSTARTUP.

.. option:: --shell-interface (ipython|ptpython|bpython|python)

Specify a preferred REPL to use in shell mode. This shell is started with the `env` variable
Expand Down

0 comments on commit 1dd44c3

Please sign in to comment.