Installation
============
Prerequisites
-------------
csky can be installed using standard pip or `uv `_ (uv support is
experimental). Below we discuss both options for setting up your environment.
**On macOS:** install Boost before getting started:
.. code::
brew install boost
Using pip
~~~~~~~~~
1. Make sure you have a reasonable installation of Python available. For example, if you are
working on a Cobalt and using cvmfs, ``which python3`` should return something like:::
/cvmfs/icecube.opensciencegrid.org/py3-v4.3.0/RHEL_7_x86_64/bin/python3
2. Navigate someplace you would like to store your csky venv, and create it with ``venv``:::
mkdir -p ~/venvs
cd ~/venvs
python3 -m venv csky
3. Activate the venv and upgrade your package management:::
cd ~/venvs
source csky/bin/activate
python -m pip install --upgrade pip setuptools wheel
Using uv (experimental)
~~~~~~~~~~~~~~~~~~~~~~~
1. Install uv by following the `official instructions
`_.
2. Navigate someplace you would like to store your csky venv, and create it with ``uv``. If you are
working on a Cobalt and using cvmfs, make sure to pass the ``--python-preference=system``:::
mkdir -p ~/venvs
cd ~/venvs
uv venv csky --python-preference=system
3. When following the rest of the instructions below, replace each usage of ``pip`` with ``uv pip``.
Installing csky
---------------
csky can be installed as a specific release directly from GitHub, or in an editable form in a local
clone suitable for development. Below we discuss both options for installing csky.
Release from GitHub
~~~~~~~~~~~~~~~~~~~
1. Activate the venv:::
source ~/venvs/csky/bin/activate
2. Install a specific release:::
pip install "git+ssh://git@github.com/icecube/csky.git@v1.1.14e"
Editable codebase
~~~~~~~~~~~~~~~~~
1. Activate the venv:::
source ~/venvs/bin/activate
2. Navigate someplace you would like to store your csky venv, and clone the repository:::
mkdir ~/src
cd ~/src
git clone git@github.com:icecube/csky.git
3. Install csky:::
pip install --editable ./csky
Configuration
-------------
Before getting started with using csky, you may want to set the following environment variables (in
``~/.zprofile`` or such, check your shell documentation...). Note that these settings are not
necessary on UW machines with access to ``/data/ana``, such as the cobalts.
.. code::
# where you want your mirror of /data/ana/analyses or analogous repository
export CSKY_DATA_ANALYSES_DIR="/path/to/local/mirror"
# username for rsync'ing data (leave unset to use wget instead)
export CSKY_REMOTE_USER="[cobalt username]"
Interactive Usage
-----------------
For interactive usage and development, you will probably want to use Jupyter or IPython. You may
also want to install optional dependencies such as Pandas and Seaborn. These can be setup as
follows:
1. Activate the venv and install some packages:::
source ~/venvs/csky/bin/activate
pip install --upgrade ipykernel pandas seaborn
2. Install the ipykernel for use with Jupyter:
python -m ipykernel install --user --name=csky --display-name='Python 3 / csky'
Updating csky
-------------
If you installed a csky release directly from GitHub, you can simply repeat the `Release from
GitHub`_ steps above, but selecting a newer release tag.
If you installed an editable codebase, use git to update your local clone:::
cd ~/src/csky
git pull --ff
The ``--ff`` option ensures that changes will only be applied if there are no conflicts with edits
you made to your local clone.
If there are conflicts, you might have some luck with ``git stash``. Otherwise you might ask for
help in `#csky `_ or `#software
`_ on Slack.
If you see a ``.cpp`` file in an incoming update (or if you modify the C++ code yourself), you'll
need to repeat the uv-pip-install (or pip-install) step in order to recompile the C++ extension.
Compatibility
-------------
csky may still be compatible with Python 2.7, but it is nevertheless recommended that you upgrade to
Python 3 as soon as possible. In particular, note that csky has been tested with
.. code::
eval `/cvmfs/icecube.opensciencegrid.org/py3-v4.3.0/setup.sh`