Skip to content

Commit

Permalink
[aehrc#42] Prepare variant-spark for external contribution (aehrc#43)
Browse files Browse the repository at this point in the history
* Integrated py-lint with spark checks + line-lenght-limit = 100

* Added installation of python dev envirment + the first version of contributing

* Added sudo to python packages installatio

* Working on contributing

* Working on contributing

* Finished first version of CONTRIBUTING.

* Updated README to include python build

* Removed a 'practice' unit test'
  • Loading branch information
piotrszul authored Nov 21, 2017
1 parent 6051cd2 commit 741d782
Show file tree
Hide file tree
Showing 23 changed files with 1,120 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ variant-spark_2.11.iml

build
dist
_build
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ branches:
- master
- /^branch-.*$/
- /^v\d+\..*$/
# command to install dependencies
install:
- sudo dev/py-setup.sh
script: dev/travis-build.sh
before_deploy: dev/travis-prepare-s3-release.sh
deploy:
Expand Down
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Contributing to VariantSpark
=============================

# Contributing Code Changes
Please review the preceding section before proposing a code change. This section documents how to do so.

When you contribute code, you affirm that the contribution is your original work and that you license the work to the project under the project’s open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project’s open source license and warrant that you have the legal authority to do so.

## Issue management

Generally, _VariantSpark_ uses _Github Issues_ to track logical issues, including bugs and improvements, and uses _Github_ pull requests to manage the review and merge of specific code changes. That is, _Github Issues_ are used to describe what should be fixed or changed, and high-level approaches, and pull requests describe how to implement that change in the project’s source code. For example, major design decisions are discussed in _Github Issues_

## Pull Request

1. Fork the Github repository at https://github.com/aehrc/VariantSpark if you haven’t already
2. Clone your fork, create a new branch, push commits to the branch.
3. Consider whether documentation or tests need to be added or updated as part of the change, and add them as needed.
4. Run all tests with `./dev/build.sh` to verify that the code still compiles, passes tests, and passes style checks. If style checks fail, review the Code Style Guide below.
5. Open a pull request against the master branch of aehrc/VariantSpark. (Only in special cases would the PR be opened against other branches.)
* The PR title should be of the form `[#XXXX] Title`, where `#XXXX` is the relevant _Github Issue_ number, and Title may be the issue title or a more specific title describing the PR itself.
* If the pull request is still a work in progress, and so is not ready to be merged, but needs to be pushed to Github to facilitate review, then add [WIP] after the issue number.

6. Your our pull request will automatically be linked to an issue. There is no need to be the Assignee of the issue to work on it, though you are welcome to comment that you have begun work.
7. The Travis-CI automatic pull request builder will test your changes
8. After about 10 minues, Travic-CI will post the results of the test to the pull request, along with a link to the full results on Jenkins.
9. Watch for the results, and investigate and fix failures promptly
* Fixes can simply be pushed to the same branch from which you opened your pull request
* Travis-CI will automatically re-test when new commits are pushed

## Closing Your Pull Request / Issue

* If a change is accepted, it will be merged and the pull request will automatically be closed, along with the associated issue if any

## Code Style Guide

Follow the [Apache Spark - Code Style Guide](http://spark.apache.org/contributing.html#code-style-guide)

In particular:

* For Python code follow PEP 8 with one exception: lines can be up to 100 characters in length, not 79.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,26 @@ To learn more watch this video from Spark Summit.

### Building

variant-spark requires java jdk 1.8+ and maven 3+
_variant-spark_ requires java jdk 1.8+ and maven 3+

In order to build the binaries use:

mvn clean install

For python _variant-spark_ requires python 2.7 with pip.
The other packages required for development are listed in `dev/dev-requirements.txt` and can be installed with:

pip install -r dev/dev-requirements.txt

or with:

./dev/py-setup.sh


The complete built including all check can be run with:

./dev/build.sh

### Running

variant-spark requires an existing spark 2.1+ installation (either a local one or a cluster one).
Expand Down
25 changes: 25 additions & 0 deletions dev/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -e
set -x

FWDIR="$(cd "`dirname $0`"/..; pwd)"
cd "$FWDIR"

# run code checks

/bin/bash ${FWDIR}/dev/py-lint.sh

# build and package the project
mvn package -B

# make build info
env | tee "target/buildinfo"

# build the python distribution

pushd ${FWDIR}/python
python setup.py sdist
python setup.py bdist_egg
popd

3 changes: 3 additions & 0 deletions dev/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sphinx>=1.3.5
pylint>=1.7.4
decorator>=4.1.2
11 changes: 11 additions & 0 deletions dev/py-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e
set -x

FWDIR="$(cd "`dirname $0`"/..; pwd)"
cd "$FWDIR"

pushd python/docs
make clean html
popd
15 changes: 15 additions & 0 deletions dev/py-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e
set -x

FWDIR="$(cd "`dirname $0`"/..; pwd)"
cd "$FWDIR"

# check code with pylint

pushd python

export PYTHONPATH=$PYTHONPATH:./deps/hail-py-0.1-src.zip
pylint variants
popd
9 changes: 9 additions & 0 deletions dev/py-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e
set -x

FWDIR="$(cd "`dirname $0`"/..; pwd)"
cd "$FWDIR"

pip install -r ${FWDIR}/dev/dev-requirements.txt
13 changes: 1 addition & 12 deletions dev/travis-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,5 @@ cd "$FWDIR"

. ${FWDIR}/dev/travis-set-ver.sh

# build and package the project
mvn package -B

# make build info
env | tee "target/buildinfo"

# build the python distribution

pushd ${FWDIR}/python
python setup.py sdist
python setup.py bdist_egg
popd
/bin/bash ${FWDIR}/dev/build.sh

Binary file added python/deps/hail-py-0.1-src.zip
Binary file not shown.
Binary file added python/deps/py4j-0.10.4-src.zip
Binary file not shown.
Binary file added python/deps/pyspark.zip
Binary file not shown.
218 changes: 218 additions & 0 deletions python/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

export PYTHONPATH=$(realpath ..):$(realpath ../deps/hail-py-0.1-src.zip):$(realpath ../deps/py4j-0.10.4-src.zip):$(realpath ../deps/pyspark.zip)

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@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"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"

.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*

.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

.PHONY: dirhtml
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

.PHONY: pickle
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

.PHONY: json
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

.PHONY: htmlhelp
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

.PHONY: qthelp
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/VariantS.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/VariantS.qhc"

.PHONY: applehelp
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."

.PHONY: devhelp
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/VariantS"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/VariantS"
@echo "# devhelp"

.PHONY: epub
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: latexpdfja
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

.PHONY: text
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

.PHONY: man
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

.PHONY: texinfo
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."

.PHONY: info
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."

.PHONY: gettext
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."

.PHONY: changes
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

.PHONY: linkcheck
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

.PHONY: doctest
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

.PHONY: coverage
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."

.PHONY: xml
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."

.PHONY: pseudoxml
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
Loading

0 comments on commit 741d782

Please sign in to comment.