Skip to content

Commit

Permalink
Merge pull request #23 from stefco/dev
Browse files Browse the repository at this point in the history
v0.2.10 add landscape.io, fix some stuff
  • Loading branch information
stefco committed Mar 6, 2016
2 parents 21560a9 + 4ead9cf commit 17ea37b
Show file tree
Hide file tree
Showing 14 changed files with 1,290 additions and 936 deletions.
5 changes: 5 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
languages:
Python: true
exclude_paths:
- "docs/*"
- "env/*"
38 changes: 38 additions & 0 deletions .hooks/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
#
# 2016-03-01 If python version is updated, tag this commit. --stefco
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".

if git rev-parse --verify HEAD~1 >/dev/null 2>&1
then
against=HEAD~1
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

if git rev-parse --verify HEAD >/dev/null 2>&1
then
current=HEAD
else
# Initial commit: diff against an empty tree object
current=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

PRJ="geco_stat"
if ! [ -e "$PRJ/_version.py" ]; then
echo "no $PRJ/_version.py file found."
elif [ "`git show $against:$PRJ/_version.py`" == "`git show $current:$PRJ/_version.py`" ]; then
echo "version info unchanged in $PRJ/_version.py."
else
echo "version info updated in $PRJ/_version.py, tagging this commit."
version=$( printf "`cat geco_stat/_version.py`\nprint('v' + __release__)\n" | python )
git tag -a "$version" -m "update to version $version"
fi

19 changes: 19 additions & 0 deletions .landscape.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# landscape.io configuration for GWpy

max-line-length: 80

# ignore non-package files/directories
ignore-paths:
- docs
- env
- hooks
# - examples
# - ez_setup.py

requirements:
- requirements.txt

# ignore errors
# pylint:
# disable:
# - super-on-old-class
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@ addons:
- python-scipy
- python-h5py

# only run 5 tests so that testing can go as quickly as possible
python:
- '2.6'
- '2.7'
# remove; somewhat redundant
# - '2.7'
- '2.7_with_system_site_packages'
- '3.2'
# low usage percentages, and unlikely to break things
# - '3.2'
- '3.3'
- '3.4'
- '3.5'
- 3.5-dev
- nightly
# somewhat redundant
# - 3.5-dev
# - nightly
# pypy causing trouble, ignore it for now
# - 'pypy'

Expand Down Expand Up @@ -57,6 +61,10 @@ script:
- python -c "import geco_stat as g; g.run_unit_tests()"
- cd ..

cache:
- apt
- pip

deploy:
provider: pypi
user:
Expand Down
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(C
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help install uninstall check check-twine check-sphinx check-env clean distclean version increl decrel zerorel oldver incver decver pypi build upload env html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck test unit-test doctest coverage gettext
.PHONY: help check check-twine check-sphinx check-env clean distclean install uninstall gamut pep version increl decrel zerorel oldver incver decver pypi build upload env hooks html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck test unit-test doctest coverage gettext

help:
@echo "Please use \`make <target>\` where <target> is one of"
Expand All @@ -42,6 +42,8 @@ help:
@echo " distclean to uninstall pkg, remove generated files and the env folder"
@echo " install to clean, build, and install editable version of package with pip"
@echo " uninstall to uninstall editable package without cleaning this directory"
@echo " gamut to clean, install, and test"
@echo " pep to format python code according to (most) pep8 conventions"
@echo " test to run all doctests as well as unit tests"
@echo " unit-test to run all unit-tests"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
Expand All @@ -55,6 +57,7 @@ help:
@echo " pypi to build and upload packages to PyPI all at once"
@echo " build to build packages for upload to PyPI"
@echo " upload to upload finished PyPI packages"
@echo " hooks to symlink git hooks to the .git/hooks directory"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
Expand Down Expand Up @@ -114,7 +117,7 @@ env:
# Install a virtualenv to allow for local development and usage.
if ! [ -e "./env" ]; then virtualenv env; fi
# Install some stuff required for pip packaging and development
$(PIP) install -U "pip>=1.4" "setuptools>=0.9" "wheel>=0.21" twine "ipython" mock
$(PIP) install -U "pip>=1.4" "setuptools>=0.9" "wheel>=0.21" twine "ipython" mock autopep8
# Install sphinx itself, plus the Read the Docs theme
$(PIP) install -U "sphinx" "sphinx_rtd_theme"
# Install required packages
Expand Down Expand Up @@ -147,6 +150,13 @@ install: check-env clean uninstall build
uninstall: check-env
pip uninstall --yes $(MODULENAME) 2>&1 || printf "$(MODULENAME) not installed, moving on.\n"

gamut: clean install test
@echo "\nRan the gamut successfully.\n"

pep: check
autopep8 --in-place --recursive --select=E1,E3,E5,E7,W2,W6 geco_stat
@echo "\nDone reformatting.\n"

test: doctest unit-test
@echo "\nAll tests passed.\n"

Expand Down Expand Up @@ -212,6 +222,9 @@ build: check-env
upload: check-env check-twine
$(TWINE) upload $(PYPIDISTDIR)/*

hooks:
ln -s -f ../../.hooks/post-commit .git/hooks/post-commit

html: check-sphinx
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
| ------ | ---------------- | ------ |
| Master | Travis CI | [![Master build Status](https://travis-ci.org/stefco/geco_stat.svg?branch=master)](https://travis-ci.org/stefco/geco_stat) |
| Master | Codeship | [![Codeship Test Status](https://img.shields.io/codeship/e9762300-bd59-0133-0ed3-2a1d867cc1c8/master.svg)](https://codeship.com/projects/136547) |
| Master | Landscape | [![Code Health](https://landscape.io/github/stefco/geco_stat/master/landscape.svg?style=flat)](https://landscape.io/github/stefco/geco_stat/master) |
| Dev | Travis CI | [![Dev build Status](https://travis-ci.org/stefco/geco_stat.svg?branch=dev)](https://travis-ci.org/stefco/geco_stat) |
| Dev | Codeship | [![Codeship Test Status](https://img.shields.io/codeship/e9762300-bd59-0133-0ed3-2a1d867cc1c8/dev.svg)](https://codeship.com/projects/136547) |
| Dev | Landscape | [![Code Health](https://landscape.io/github/stefco/geco_stat/dev/landscape.svg?style=flat)](https://landscape.io/github/stefco/geco_stat/dev) |

## Purpose

Expand Down
15 changes: 15 additions & 0 deletions docs/useful_links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ Vim Fun
.. _Saving vim macros: http://stackoverflow.com/questions/2024443/saving-vim-macros
.. _Put backspace in a vim macro: http://stackoverflow.com/questions/27578758/vim-macro-with-backspace

Git Tricks
----------

* Use `git show`_ to ``cat`` the contents of an old revision of a file.
* `See the differences`_ in a particular file between revisions.
* `Tag your commits`_ with, e.g., version information
* Add `hooks`_ to your commits so that ``git`` automatically performs certain
tasks before/after operations like ``git commit``. Useful for, e.g.,
auto-tagging commits when the version updates!

.. _git show: http://stackoverflow.com/questions/888414/git-checkout-older-revision-of-a-file-under-a-new-name
.. _See the differences: http://stackoverflow.com/questions/3338126/how-to-diff-the-same-file-between-two-different-commits-on-the-same-branch
.. _Tag your commits: https://git-scm.com/book/en/v2/Git-Basics-Tagging
.. _hooks: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

Python Versions
---------------

Expand Down
16 changes: 16 additions & 0 deletions geco_stat/Exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-


class VersionException(Exception):
"""
For when the user attempts to instantiate an object using a
datastructure from a different version number of the class.
"""


class MissingChannelDataException(Exception):
"""
For when an attempt has been made to fetch a timeseries for
a given time interval, but no data has been found, or the
data request has timed out.
"""

0 comments on commit 17ea37b

Please sign in to comment.