.. _instrument.create_bluesky_ipython_profile: Create a bluesky IPython profile -------------------------------- .. note:: Compare with :ref:`reference.configure_ipython_profile` This bash command create a new IPython profile for bluesky: .. raw:: html
   $ ipython profile create bluesky --ipython-dir="~/.ipython"
   
Next, create the starter script for this profile. This will ensure that the instrument package gets loaded when starting a bluesky IPython session. .. note:: Copy *all* these lines and paste them exactly into your terminal. .. code:: bash cat > ~/.ipython/profile_bluesky/startup/00-start-bluesky.py << EOF import pathlib, sys sys.path.append(str(pathlib.Path().home() / "bluesky")) from instrument.collection import * EOF To start an IPython session with the new bluesky profile, you can now use the following command: .. raw:: html
   $ ipython --profile=bluesky
   
.. raw:: html
How to create an alias to start a bluesky session? Creating a bash alias is like creating a custom shortcut. You can do this by editing the ~/.bashrc and ~/.bash_aliases files, which are configuration files for your bash shell. Here's a simple step-by-step guide:
  1. Open a terminal.
  2. Open the ~/.bashrc and ~/.bash_aliases files with your prefered text editor, e.g.:
       $  gedit ~/.bashrc ~/.bash_aliases 
       
    If any of those files do not exist, this command will create blank ones.
  3. In ~/.bash_aliases, scroll down to the end of the file or find a suitable place to add your alias. On a new line, type:
       export BLUESKY_CONDA_ENV=bluesky_2023_3
       alias start_bluesky='conda activate ${BLUESKY_CONDA_ENV}; ipython --profile=bluesky'
       
    Note: this lines may already be included in your ~/.bash_aliases, e.g., if you have created an alias to activate the bluesky conda environment.
  4. In ~/.bashrc, scroll down to the end of the file or find a suitable place to add the following lines:
       source ~/.bash_aliases
       
  5. Save your changes.
  6. Type bash and press enter, or open a new terminal windows to make the new alias available.
You can now use the alias start_bluesky to activate the conda environment and and start a new bluesky session in a terminal.
For more info about IPython configuration, see `here `__.