Skip to content

Commit

Permalink
Add requirements.txt, invoke commands, and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblum committed Feb 20, 2016
1 parent 8e0729e commit d022b79
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -19,9 +19,8 @@ matrix:
env: DJANGO=Django==1.9

install:
- pip install -r requirements.txt
- pip install -q $DJANGO
- pip install coveralls
- pip install flake8
- python setup.py -q install

before_script:
Expand Down
18 changes: 10 additions & 8 deletions Makefile
@@ -1,20 +1,22 @@
.PHONY: install\
.PHONY: installdeps\
build\
test\
lint\
coverage\
clean

install:
# Let developers manage their python versions
# and Django versions independently
pip install coveralls flake8
installdeps:
pip install -U -r requirements.txt

build:
invoke build $(ARGS)

test:
python setup.py test
invoke test

lint:
flake8
invoke lint

clean:
find . -type f -name '*.py[cod]' -delete
invoke clean $(ARGS)

34 changes: 34 additions & 0 deletions README.rst
Expand Up @@ -56,6 +56,40 @@ Git checkout.
Note that this application requires Python 2.7/3.4 or later, and a
functional installation of Django 1.7 or newer.

Getting started with development
------------

To get started with development, first install the required packages:

```bash
make installdeps
```

For convenience a `Makefile` is included which wraps the Python `invoke
<http://www.pyinvoke.org/>`_ library. Once you work on a patch, you can test
the functionality by running:

```bash
make test
```

Or equivalently:

```bash
invoke test
```

Command line arguments can be passed to the `invoke` script through the
`Makefile` via the `ARGS` parameter. For example:

```bash
make build ARGS=--docs
```

Or equivalently:
```bash
invoke build --docs
```

Alternatives
------------
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
@@ -0,0 +1,5 @@
flake8
coveralls
Sphinx
Django>1.7,<1.9
invoke==0.12.2
32 changes: 32 additions & 0 deletions tasks.py
@@ -0,0 +1,32 @@
from invoke import run
from invoke import task


@task
def clean(docs=False, bytecode=True, extra=''):
patterns = ['build']
if docs:
patterns.append('docs/_build')
if bytecode:
patterns.append('**/*.pyc')
if extra:
patterns.append(extra)
for pattern in patterns:
run("rm -rf %s" % pattern)


@task
def build(docs=False):
run("python setup.py build")
if docs:
run("sphinx-build docs docs/_build")


@task
def test():
run("python setup.py test")


@task
def lint():
run("flake8")

0 comments on commit d022b79

Please sign in to comment.