-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This was based on the cookiecutter template ionelmc/pylibrary, but simplified!
- Loading branch information
Showing
23 changed files
with
542 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = True | ||
tag = True | ||
|
||
[bumpversion:file:setup.py] | ||
search = version='{current_version}' | ||
replace = version='{new_version}' | ||
|
||
[bumpversion:file:README.rst] | ||
search = v{current_version}. | ||
replace = v{new_version}. | ||
|
||
[bumpversion:file:docs/conf.py] | ||
search = version = release = '{current_version}' | ||
replace = version = release = '{new_version}' | ||
|
||
[bumpversion:file:tlo/__init__.py] | ||
search = __version__ = '{current_version}' | ||
replace = __version__ = '{new_version}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[paths] | ||
source = | ||
tlo | ||
|
||
[run] | ||
branch = true | ||
source = | ||
tlo | ||
tests | ||
parallel = true | ||
|
||
[report] | ||
show_missing = true | ||
precision = 2 | ||
omit = *migrations* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
charset = utf-8 | ||
|
||
[*.{bat,cmd,ps1}] | ||
end_of_line = crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
language: python | ||
sudo: false | ||
cache: pip | ||
env: | ||
global: | ||
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so | ||
- SEGFAULT_SIGNALS=all | ||
matrix: | ||
- TOXENV=check | ||
- TOXENV=docs | ||
matrix: | ||
include: | ||
- python: '3.6' | ||
env: | ||
- TOXENV=py36,report | ||
before_install: | ||
- python --version | ||
- uname -a | ||
- lsb_release -a | ||
install: | ||
- pip install tox | ||
- virtualenv --version | ||
- easy_install --version | ||
- pip --version | ||
- tox --version | ||
script: | ||
- tox -v | ||
after_failure: | ||
- more .tox/log/* | cat | ||
- more .tox/*/log/* | cat | ||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
graft docs | ||
graft src | ||
graft ci | ||
graft tests | ||
|
||
include .bumpversion.cfg | ||
include .coveragerc | ||
include .cookiecutterrc | ||
include .editorconfig | ||
|
||
include README.rst | ||
|
||
include tox.ini .travis.yml | ||
|
||
global-exclude *.py[cod] __pycache__ *.so *.dylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
======== | ||
Overview | ||
======== | ||
|
||
.. start-badges | ||
.. image:: https://travis-ci.com/UCL/TLOmodel.svg?branch=master | ||
:alt: Travis-CI Build Status | ||
:target: https://travis-ci.com/UCL/TLOmodel | ||
|
||
.. end-badges | ||
Thanzi la Onse Epidemiology Model | ||
================================= | ||
|
||
This is the main software framework for epidemiology and health system modelling in the Thanzi la Onse project. | ||
|
||
See https://www.york.ac.uk/igdc/research/thanzi-la-onse/ for more about the project. | ||
|
||
Installation | ||
============ | ||
|
||
To get started quickly, we recommend using Anaconda Python, and installing within a fresh environment. | ||
|
||
:: | ||
|
||
conda create -n tlo python=3.6 virtualenv | ||
source activate tlo | ||
pip install -r requirements/dev.txt | ||
pip install -e . | ||
|
||
This will install the software in 'editable' mode, so any changes you make to the source will immediately be reflected. | ||
After the initial install, each time you wish to use the model simply activate the environment:: | ||
|
||
source activate tlo | ||
|
||
Documentation | ||
============= | ||
|
||
To build the documentation, activate your environment as above then run:: | ||
|
||
tox -e docs | ||
|
||
Development | ||
=========== | ||
|
||
To run all the tests run:: | ||
|
||
tox | ||
|
||
Note, to combine test coverage data from all the tox environments run: | ||
|
||
.. list-table:: | ||
:widths: 10 90 | ||
:stub-columns: 1 | ||
|
||
- - Windows | ||
- :: | ||
|
||
set PYTEST_ADDOPTS=--cov-append | ||
tox | ||
|
||
- - Other | ||
- :: | ||
|
||
PYTEST_ADDOPTS=--cov-append tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
Authors | ||
======= | ||
|
||
* Jonathan Cooper - http://iris.ucl.ac.uk/iris/browse/profile?upi=JCOOP83 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
import os | ||
|
||
|
||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.autosummary', | ||
'sphinx.ext.coverage', | ||
'sphinx.ext.doctest', | ||
'sphinx.ext.extlinks', | ||
'sphinx.ext.ifconfig', | ||
'sphinx.ext.napoleon', | ||
'sphinx.ext.todo', | ||
'sphinx.ext.viewcode', | ||
] | ||
if os.getenv('SPELLCHECK'): | ||
extensions += 'sphinxcontrib.spelling', | ||
spelling_show_suggestions = True | ||
spelling_lang = 'en_GB' | ||
|
||
source_suffix = '.rst' | ||
master_doc = 'index' | ||
project = 'TLOmodel' | ||
year = '2018' | ||
author = 'Jonathan Cooper' | ||
copyright = '{0}, {1}'.format(year, author) | ||
version = release = '0.1.0' | ||
|
||
pygments_style = 'trac' | ||
templates_path = ['.'] | ||
extlinks = { | ||
'issue': ('https://github.com/UCL/TLOmodel/issues/%s', '#'), | ||
'pr': ('https://github.com/UCL/TLOmodel/pull/%s', 'PR #'), | ||
} | ||
# on_rtd is whether we are on readthedocs.org | ||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True' | ||
|
||
if not on_rtd: # only set the theme if we're building docs locally | ||
html_theme = 'sphinx_rtd_theme' | ||
|
||
html_use_smartypants = True | ||
html_last_updated_fmt = '%b %d, %Y' | ||
html_split_index = False | ||
html_sidebars = { | ||
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'], | ||
} | ||
html_short_title = '%s-%s' % (project, version) | ||
|
||
napoleon_use_ivar = True | ||
napoleon_use_rtype = False | ||
napoleon_use_param = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
============ | ||
Contributing | ||
============ | ||
|
||
We'll flesh out the guidelines here further as the project gets going! | ||
|
||
Bug reports | ||
=========== | ||
|
||
When `reporting a bug <https://github.com/UCL/TLOmodel/issues>`_ please include: | ||
|
||
* Your operating system name and version. | ||
* Any details about your local setup that might be helpful in troubleshooting. | ||
* Detailed steps to reproduce the bug. | ||
|
||
Development | ||
=========== | ||
|
||
To set up `TLOmodel` for local development: | ||
|
||
1. Fork `TLOmodel <https://github.com/UCL/TLOmodel>`_ | ||
(look for the "Fork" button). | ||
If you have write access to this main repository, you can skip this step and clone | ||
it directly in step 2. | ||
2. Clone your fork locally:: | ||
|
||
git clone [email protected]:your_name_here/TLOmodel.git | ||
|
||
3. Create a branch for local development:: | ||
|
||
git checkout -b name-of-your-bugfix-or-feature | ||
|
||
Now you can make your changes locally. | ||
|
||
4. When you're done making changes, run all the checks, doc builder and spell checker with `tox <http://tox.readthedocs.io/en/latest/install.html>`_ one command:: | ||
|
||
tox | ||
|
||
5. Commit your changes and push your branch to GitHub:: | ||
|
||
git add . | ||
git commit # Write a description of your changes in the editor and save | ||
git push origin name-of-your-bugfix-or-feature | ||
|
||
6. Submit a pull request through the GitHub website. | ||
|
||
Pull Request Guidelines | ||
----------------------- | ||
|
||
If you need some code review or feedback while you're developing the code just make the pull request. | ||
|
||
For merging, you should: | ||
|
||
1. Include passing tests (run ``tox``) [1]_. | ||
2. Update documentation when there's new API, functionality etc. | ||
3. Add a note to ``CHANGELOG.rst`` about the changes. | ||
4. Add yourself to ``AUTHORS.rst``. | ||
|
||
.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will | ||
`run the tests <https://travis-ci.com/UCL/TLOmodel/pull_requests>`_ for each change you add in the pull request. | ||
It will be slower though ... | ||
Tips | ||
---- | ||
|
||
To run a subset of tests:: | ||
|
||
tox -e py36 -- pytest -k test_myfeature | ||
|
||
To run all the test environments in *parallel* (you need to ``pip install detox``):: | ||
|
||
detox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
======== | ||
Contents | ||
======== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
readme | ||
installation | ||
usage | ||
reference/index | ||
contributing | ||
authors | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
============ | ||
Installation | ||
============ | ||
|
||
To get started quickly, we recommend using Anaconda Python, and installing within a fresh environment. | ||
|
||
:: | ||
|
||
conda create -n tlo python=3.6 virtualenv | ||
source activate tlo | ||
pip install -r requirements/dev.txt | ||
pip install -e . | ||
|
||
This will install the software in 'editable' mode, so any changes you make to the source will immediately be reflected. | ||
After the initial install, each time you wish to use the model simply activate the environment:: | ||
|
||
source activate tlo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.. include:: ../README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Reference | ||
========= | ||
|
||
.. toctree:: | ||
:glob: | ||
|
||
tlo* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tlo | ||
=== | ||
|
||
.. testsetup:: | ||
|
||
from tlo import * | ||
|
||
.. automodule:: tlo | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sphinx>=1.3 | ||
sphinx-rtd-theme | ||
-e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
builtin | ||
builtins | ||
classmethod | ||
staticmethod | ||
classmethods | ||
staticmethods | ||
args | ||
kwargs | ||
callstack | ||
Changelog | ||
Indices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
===== | ||
Usage | ||
===== | ||
|
||
To use TLOmodel in a project:: | ||
|
||
import tlo | ||
|
||
More to come... |
Oops, something went wrong.