Installation#

Download#

Download the source code

git clone https://github.com/tcrundall/chronostar-tng.git

Virtual Environment#

Chronostar-TNG utilises features from python >= 3.9, so we recommend making a virtual environment.

Conda#

Change into the directory and create a new conda environment, and activate it. Conda will automatically set up a python 3.9 environment.

cd chronostar-tng
conda env create -n chron -f environment.yml    # set up py39 environment
conda activate chron

Chronostar developers should use the dev-environment.yml, as this includes extra packages that assist in development of the code and documentation.

Pip#

Alternatively you can use pip. Note that Chronostar-TNG is only tested for python 3.9, so you need to ensure that either your default python installation is 3.9 (in which case you can remove the -p /path/to/your/3.9/bin/python argument) or that you have python 3.9 installed somewhere.

python -m pip install virtualenv
python -m virtualenv -p /path/to/your/3.9/bin/python chron
source chron/bin/activate

Once you’ve set up your virtual environment install all the libraries in requirements.txt (or dev-requirements.txt):

cd chronostar-tng
pip install -r requirements.txt

Installing Chronostar#

You can install chronostar from source so that it is importable from everywhere, and your command line has access to the command line tools. This also installs the libraries that conda can’t find but pip can.

python -m pip install .

Developers should install with the editable flag, enabling changes you make to the source code to be immediately reflected in the build libraries and command line tools:

python -m pip install -e .

Testing#

Now that all depedencies are installed, you can run all the tests. Unit tests should take less than a minute. Integration tests take over an hour.

pytest tests/unit
pytest tests/integration

Note

These tests run automatically on github on every push to main.

Confirming access#

You should now be able to import chronostar:

>>> import chronostar
>>> chronostar.__file__
/path/to/env/lib/python3.9/site-packages/chronostar/__init__.py
>>> from chronostar.component.spherespacetimecomponent import SphereSpaceTimeComponent

Note

For developers of chronostar, make sure this isn’t clashing with any local version of chronostar hiding in your PYTHONPATH.

You should also have access to the command line tools:

fit-component -h
fit-mixture -h
fit-chronostar -h