I've made an example project of how to build and deploy packages with Travis (Linux and OSX) and AppVeyor (Windows).
https://github.com/theochem/python-cython-ci-example
To make a new release for this package (source tar.gz on Github, PyPI and compiled package on anaconda.org), I only need to push a version tag (like 1.4.1) to the github repo, thanks to the deployment features of Travis-CI and some PowerShell scripting on AppVeyor. Also the documentation is rebuilt on Travis-CI when such a tag is pushed. This makes it super easy to publish new releases.
This rapid deployment could help us when splitting up HORTON in smaller packages without ending up in dependency hell. I'm mainly thinking of two relevant use cases:
(1) End users can simply install Conda as a standardized Python environment, which works on all platforms. Installing miniconda or anaconda is trivial. E.g. for Miniconda with Python 3, these are the steps:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b # -b is for non-interactive install
source miniconda3/bin/activate # can be put in .bashrc
Once you have conda installed, installing the demo project just takes:
conda install -c tovrstra pycydemo
The -c tovrstra option selects my channel: https://anaconda.org/tovrstra. This command will install all dependencies as well. We can even put our compilations of LibXC and LibInt in such a channel, to avoid issues like #262.
When a user is interested in a package that only has Python dependencies, then pip can be used as well. For example, if your computer has Python and pip installed, one just has to run:
pip install numpy Cython
pip install pycydemo --user
Pip has some limitations, which make it not suitable for all purposes:
- It can only install Python packages, which is a problem when you have non-python dependencies.
- It does not make a distinction between stable, alpha and beta releases, which is possible on Conda and Github
- Uploading something to PyPI is an irreversible operation, no mistakes allowed.
- If you have
import numpy or import Cython in setup.py, pip cannot install your package from scratch, e.g. in a new venv. There is an ugly workaround for numpy: https://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py
- Wheels (pip's binary packages) for a broad class of Linux systems are difficult to make. The solution can be found here: https://github.com/pypa/manylinux
(2) Developers can easily install a development environment, making use of the conda environments. My first idea was to work with so-called environment.yml files, but these do not allow easy upgrading when the development version moves on to newer versions of dependencies. It would be better to add a script that takes the dependencies out of conda.recipe/meta.yaml and that installs/upgrades/downgrades these in the current Conda environment. On top of these, one may clone git repos for a few dependencies, in case one wants to develop against a development version of the dependency. Installing these into a conda environment (without root) is relatively easy.
I've made an example project of how to build and deploy packages with Travis (Linux and OSX) and AppVeyor (Windows).
https://github.com/theochem/python-cython-ci-example
To make a new release for this package (source tar.gz on Github, PyPI and compiled package on anaconda.org), I only need to push a version tag (like 1.4.1) to the github repo, thanks to the deployment features of Travis-CI and some PowerShell scripting on AppVeyor. Also the documentation is rebuilt on Travis-CI when such a tag is pushed. This makes it super easy to publish new releases.
This rapid deployment could help us when splitting up HORTON in smaller packages without ending up in dependency hell. I'm mainly thinking of two relevant use cases:
(1) End users can simply install Conda as a standardized Python environment, which works on all platforms. Installing miniconda or anaconda is trivial. E.g. for Miniconda with Python 3, these are the steps:
Once you have conda installed, installing the demo project just takes:
The
-c tovrstraoption selects my channel: https://anaconda.org/tovrstra. This command will install all dependencies as well. We can even put our compilations of LibXC and LibInt in such a channel, to avoid issues like #262.When a user is interested in a package that only has Python dependencies, then pip can be used as well. For example, if your computer has Python and pip installed, one just has to run:
Pip has some limitations, which make it not suitable for all purposes:
import numpyorimport Cythoninsetup.py, pip cannot install your package from scratch, e.g. in a new venv. There is an ugly workaround for numpy: https://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py(2) Developers can easily install a development environment, making use of the conda environments. My first idea was to work with so-called
environment.ymlfiles, but these do not allow easy upgrading when the development version moves on to newer versions of dependencies. It would be better to add a script that takes the dependencies out ofconda.recipe/meta.yamland that installs/upgrades/downgrades these in the current Conda environment. On top of these, one may clone git repos for a few dependencies, in case one wants to develop against a development version of the dependency. Installing these into a conda environment (without root) is relatively easy.