Skip to content

Commit

Permalink
Merge pull request #391 from LSSTDESC/u/EiffL/pypi
Browse files Browse the repository at this point in the history
Updates the travis ci encryption and adds documentation for PyPi deployement
  • Loading branch information
EiffL committed Jun 1, 2018
2 parents 7187092 + 982255a commit 2d7768d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 77 deletions.
103 changes: 35 additions & 68 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,49 @@
language: python

# Caching all the depencencies so that they don't have to be redownloaded and
# compiled everytime
cache:
directories:
- $TRAVIS_BUILD_DIR/build/GSL/src
- $TRAVIS_BUILD_DIR/build/FFTW/src
- $TRAVIS_BUILD_DIR/build/SWIG/src
- $TRAVIS_BUILD_DIR/build/CLASS/src
- $TRAVIS_BUILD_DIR/build/ANGPOW/src
- $HOME/miniconda

# Definition of python build matrix for osx comes from:
# https://docs.travis-ci.com/user/multi-os/#Python-example-(unsupported-languages)
- "$TRAVIS_BUILD_DIR/build/GSL/src"
- "$TRAVIS_BUILD_DIR/build/FFTW/src"
- "$TRAVIS_BUILD_DIR/build/SWIG/src"
- "$TRAVIS_BUILD_DIR/build/CLASS/src"
- "$TRAVIS_BUILD_DIR/build/ANGPOW/src"
- "$HOME/miniconda"
matrix:
include:
- os: linux
python: 2.7
sudo: required
env: TOXENV=py27
- os: linux
sudo: required
python: 3.6
env: TOXENV=py36
- os: osx
language: generic
env: TOXENV=py27
- os: osx
language: generic
env: TOXENV=py36

#addons:
# apt:
# packages:
# - texlive-latex-recommended
# - texlive-latex-extra
# - texlive-fonts-recommended
# - texlive-fonts-extra
# - dvipng

include:
- os: linux
python: 2.7
sudo: required
env: TOXENV=py27
- os: linux
sudo: required
python: 3.6
env: TOXENV=py36
- os: osx
language: generic
env: TOXENV=py27
- os: osx
language: generic
env: TOXENV=py36
install:
- ./.travis/install.sh
- if ! [[ $TRAVIS_OS_NAME == "linux" ]]; then source $HOME/miniconda/bin/activate; fi
- if ! [[ $TRAVIS_OS_NAME == "linux" ]]; then hash -r ; fi
- if ! [[ $TRAVIS_OS_NAME == "linux" ]]; then source activate test-environment ; fi
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
- export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
- cmake --version
- python --version

- "./.travis/install.sh"
- if ! [[ $TRAVIS_OS_NAME == "linux" ]]; then source $HOME/miniconda/bin/activate; fi
- if ! [[ $TRAVIS_OS_NAME == "linux" ]]; then hash -r ; fi
- if ! [[ $TRAVIS_OS_NAME == "linux" ]]; then source activate test-environment ; fi
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
- export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
- cmake --version
- python --version
script:
# First, building and testing the python module
- python setup.py build
- nosetests tests/run_tests.py --all --debug --detailed-errors --verbose --process-restartworker --with-coverage --cover-package=pyccl
# Second, building and testing the C module
- sudo make -Cbuild install
- check_ccl

- python setup.py build
- nosetests tests/run_tests.py --all --debug --detailed-errors --verbose --process-restartworker --with-coverage --cover-package=pyccl
- sudo make -Cbuild install
- check_ccl
after_success:
- coveralls

- coveralls
deploy:
provider: pypi
user: desc-ccl
password:
secure: 3IJWS9UggkSS5TGiE9Q1BK/YPgcPogwnR91wid351u3goaHscIyUCHbijkTeJj2h1ulzzoPmSnj0q82FKMhdkjlfo4scMRfGLTtmJ/A1Cx2s9FejMZPf3ROyVjv/qpXIpGHXkSLTDbCIsUi/s+jVhHYdhRdZ6NdiG8AXmd4m1hiZW/wQ6jJ1PpLA7r1VlMQFhpmvL8M94MmNjx9RpaQ+tb2B9c1Y9z3DVAFEvFoEHcuMCMIWu4cc3Y0iVuLW41330Huud1CskPSK1V8g1O3IcT1NzYaORdq3gGR0II8CyFRyNm2FaVgrAGrmvSqcJmM1w3g2qErGBiKCnVYnZyJl2wMualxQvAJeMzjepbI89KRF3xOz5qdXh/ax/duSveeWqRl40DpjT9nvX37GcZFfYbYFf6GClk/G/XvLLapdwvnyjiWFwjPHYp6yIAoLWa9gsD7M4bb9MTj/KrI4u1TB6nVMz8M4xzVV5g9T5SyapjnTxoicgygXK5h1OpnEkEXsmh+cnAURE0TbWjW1hsvpkydOPDPTYFf5E7HXwFVS+UO2T3kzs6bjcVY7smdbywpiKXYISAErjZhx9p24cvWnP5AjtgGfkhM8tpd5XhcL0pQNODfAOG1h1p91zLpiluwQ2s2oxw8Ds2Za7HXTKc4pLm+kOR3hUcsU+ZDrc2ZmmMc=
secure: mW6yYWqTxSOlqRE4nlaBucmCg7JBEhm2kDRT18imbIA998JSnA+3TNNc87XbrU5KBHeLgtlX6hFGaquNMi69jY64zmVy4880hnuShpFWYGiwHkvdJCqnQe2wHl183/zQxFpgLZrWj5TyzSgz7ESWIbqt6SS8kT87oKpjtE813jLICUv8kwwRoOo2RQ0EVKKlmOsbbDPOh26/lx0MKRHYeU7pzSo96kXty6fLSARKJLngDDq+e8Vph7pYE5N0ZMoOwagAMBHUtv6zXhzTz5Kfu9menaDpClFwJqjkvbP9IhVSa1sJhituk/GG+d4MBMYmVadsH5J9dJlUm7oGrxJsiuwePfENjxafV8O+JcT02Q9RlvP9741bckw9hy1wLN0qOdPnaMx3kdXin3Ooj9Oud+3Uv8Y6HC1IYvkS1H6Od4EoowJCIDBz3NmDjiuGpzCcenRmaxFQJnbwf/H44pedDLkB0c+EnYxfh2U7LJj7ztVmeFS8AV3P/E3aYx0StP/LnPnzvWDBIhStdZSMAX3K1RZBSjvu5nmTbk2w6TMI6ihlKfAmjyTwEOH7KcZtdv/o7A5VbBiz6PGehAJ6MrWLKtkiLVO1K2AeKH/AZ2Bknh8CUyLBpQ4JYg5URHvGa7wvnM4rPVh1dU/LvJrbaVXqlZp4gNVW0wrzVakfu4Q6Qng=
on:
tags: true
branch: master

# Check why the note creation process crashes
# - make -C doc/0000-ccl_note
#after_success:
# if [[ -n "$GITHUB_API_KEY" ]; then
# git checkout --orphan pdf
# git rm -rf .
# cp doc/0000-ccl_note/main.pdf 0000-ccl_note.pdf
# git add -f 0000-ccl_note.pdf
# git -c user.name='travis' -c user.email='travis' commit -m init
# git push -q -f https://drphilmarshall:$GITHUB_API_KEY@github.com/DarkEnergyScienceCollaboration/CCL pdf
# fi
44 changes: 37 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ $ python setup.py build

Debug mode in Python
--------------------------------------------
Because of the way the Python wrapper handles exceptions that occur inside the C code, by default
users will only see error messages for the most recent error to occur. If multiple errors occured
during a CCL function call, all but the most recent error message will be overwritten. This can
Because of the way the Python wrapper handles exceptions that occur inside the C code, by default
users will only see error messages for the most recent error to occur. If multiple errors occured
during a CCL function call, all but the most recent error message will be overwritten. This can
make it difficult to debug the root cause of a problem.

To help with debugging this kind of issue, you can enable debug mode in the Python wrapper. To do
this, simply call `pyccl.debug_mode(True)`. This will cause the Python wrapper to print all C
error messages to `stderr` whenever they occur. Python exceptions will only be raised for the most
recent error, as before, but you can at least see if other exceptions were thrown by inspecting
To help with debugging this kind of issue, you can enable debug mode in the Python wrapper. To do
this, simply call `pyccl.debug_mode(True)`. This will cause the Python wrapper to print all C
error messages to `stderr` whenever they occur. Python exceptions will only be raised for the most
recent error, as before, but you can at least see if other exceptions were thrown by inspecting
the `stderr` output.

(Note that Jupyter notebooks do not print `stderr` messages by default.)
Expand Down Expand Up @@ -202,6 +202,8 @@ to maintain backwards compatibility for all releases with the same major
version number, i.e. v1.1 should support all the same behaviors that v1.0
supported, plus whatever new additions are made.

See section below for instructions on how to deploy a new release.

Compiling the CCL note
--------------------------------------------
After making changes to the library, you should document them in the CCL note.
Expand Down Expand Up @@ -240,3 +242,31 @@ click in your build you will find more information about its status and a log
describing the process. If your build errors or fails, you can scroll through
the log to find out what went wrong. If your additions require new dependencies
make sure that you include them in `.travis.yml`.


Creating a new release and deploying on PyPi
--------------------------------------------

When cutting a new release, the procedure is as follows:
- Make sure any API changes are documented in `CHANGELOG.md`
- Update the version number in `setup.py`
- Commit to master
- Create a new release from the GitHub interface here: https://github.com/LSSTDESC/CCL/releases/new

This will trigger a new Travis build and automatically upload the new version to
PyPi.

This should not be necessary, but in case a release needs to be manually uploaded
to PyPi, the procedure is as follows:
- Manually create a source distribution from the root CCL folder:
```
$ python setup.py sdist
```
This will create a .tar.gz file in the `dist` folder

- Upload source distribution to PyPi using `twine` (can be installed using `pip`):
```
$ twine upload dist/pyccl-x.x.x.tar.gz
```
Make sure your `twine` and `setuptools` are up to date, otherwise the markdown
formatting of the README.md will not be correctly processed on the CCL PyPi page.
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from setuptools.command.build_py import build_py as _build
from setuptools import setup
from subprocess import call
from io import open
import glob
import os
import sys
Expand All @@ -25,15 +26,16 @@ def run(self):
_build.run(self)

# read the contents of the README file
with open('README.md') as f:
with open('README.md', encoding="utf-8") as f:
long_description = f.read()

setup(name="pyccl",
description="Library of validated cosmological functions.",
long_description=long_description,
long_description_content_type='text/markdown',
author="LSST DESC",
version="0.3",
version="0.3.2",
url="https://github.com/LSSTDESC/CCL",
packages=['pyccl'],
provides=['pyccl'],
package_data={'pyccl': ['_ccllib.so', 'ccl_params.ini']},
Expand Down

0 comments on commit 2d7768d

Please sign in to comment.