Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Botond Sipos committed Sep 28, 2016
0 parents commit 4f3fd57
Show file tree
Hide file tree
Showing 25 changed files with 1,188 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
57 changes: 57 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
image: ubuntu:14.04
# It might be a good idea to switch to a different base image and so avoid installing packages for each commit.

stages:
- test
- pages
- release

before_script:
- apt-get update
- apt-get install -y software-properties-common
- apt-add-repository universe
- apt-get update
- apt-get install -y python-pip make
- pip install --upgrade sphinx sphinx-argparse sphinx_rtd_theme pytest pycmd


do_testing:
stage: test
script:
- make test
except:
- tags

pages:
stage: pages
script:
- pip install -e ./
- make docs
- mv docs/_build/html public
artifacts:
paths:
- public/
only:
- master
except:
- tags


do_release:
stage: release
script:
# Build project
- python setup.py sdist
# Going to push project via ssh.
# PYPI_KEY and PYPI_HOST should set up as project variables on Gitlab
# PYPI_KEY is private key produced by ssh-keygen
- apt-get install -y openssh-client
- eval $(ssh-agent -s)
- ssh-add <(set +x; echo "$PYPI_KEY")
- scp -o StrictHostKeyChecking=no dist/* gitlab-ci-pypi@${PYPI_HOST}:/opt/ont-pypi/site-packages/
only:
# Only do a release of tags marked explicit as release (match this regular expression)
- /^release_.*$/
except:
# Do look for tags in branches
- branches
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

include README.md
include LICENSE

recursive-exclude * __pycache__
recursive-exclude * *.py[co]

recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
80 changes: 80 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
MODULE=wub

.PHONY: clean clean-test clean-pyc clean-build docs com help

.DEFAULT_GOAL := help

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts


clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/

lint: ## check style with flake8
flake8 $(MODULE)

test: ## run tests quickly with the default Python
py.test

test-all: ## run tests on every Python version with tox
tox

coverage: ## check code coverage quickly with the default Python
coverage run --source $(MODULE) setup.py test
coverage report -m
coverage html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/$(MODULE).rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ $(MODULE)
(cd docs; ./cmd_tools.py > cmd_list.rst)
$(MAKE) -C docs clean
$(MAKE) -C docs html

servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: clean ## package and upload a release
python setup.py sdist upload
python setup.py bdist_wheel upload

dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install

com: ## commit all changes to git
git commit -a
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Wub: tools and software library developed by the ONT Applications group
=======================================================================


Installation
------------

Install the package:

```
python setup.py install
```

Install the package in developer mode:

```
python setup.py develop
```

Run the tests:

```
make test
```

Build the documentation:

```
make docs
```

Issue `make help` to get a list of `make` targets.

Documentation
-------------

Documentation can be found at: https://apps.git.oxfordnanolabs.local/wub

Contributing
------------

- Please fork the repository and create a merge request to contribute.
- Please respect the structure outlined in `scripts/_template_script.py` from command line tools so documentation can be generated automatically.
- Use [bumpversion](http://bit.ly/2cSUryt) to manage package versioning.
- The code should be [PEP8](https://www.python.org/dev/peps/pep-0008) compliant, which can be tested by `make lint`.
- For more guidance regarding coding style please refer to the [Tao of Tang](https://git.oxfordnanolabs.local/research/tang/blob/master/tao.md).

TODO
----
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.rst
Loading

0 comments on commit 4f3fd57

Please sign in to comment.