diff --git a/Examples/PythonPackageExample/python/requirements.txt b/Examples/PythonPackageExample/python/requirements.txt index e4ea3e2223..f3c7e8e6ff 100644 --- a/Examples/PythonPackageExample/python/requirements.txt +++ b/Examples/PythonPackageExample/python/requirements.txt @@ -1,2 +1 @@ nose -sphinx \ No newline at end of file diff --git a/Examples/PythonPackageExample/python/sample/helpers.py b/Examples/PythonPackageExample/python/sample/helpers.py index 62e7ed37b1..ab25d44e41 100644 --- a/Examples/PythonPackageExample/python/sample/helpers.py +++ b/Examples/PythonPackageExample/python/sample/helpers.py @@ -1,3 +1,3 @@ # this is a list of thoughts which is used by the thinker -thoughts = ["camel", "open", "toe", "cherry", "delicious"] \ No newline at end of file +thoughts = ["itk", "genious", "core", "blue", "vtk", "grand", "berry", "delicious"] diff --git a/Examples/PythonPackageExample/python/sample/tests/test_advanced.py b/Examples/PythonPackageExample/python/sample/tests/test_advanced.py index 52533e64a7..f0912a5167 100644 --- a/Examples/PythonPackageExample/python/sample/tests/test_advanced.py +++ b/Examples/PythonPackageExample/python/sample/tests/test_advanced.py @@ -1,35 +1,35 @@ # -*- coding: utf-8 -*- import unittest from sample.thinker import Thinker class AdvancedTestSuite(unittest.TestCase): """Advanced test cases.""" def setUp(self): # like in JUnit/CppUnit we can define setUp and tearDown methods # create a thinker with 5 thoughts: self.nr_thoughts = 5 self.thinker = Thinker(self.nr_thoughts) def test_thoughts(self): """ - Test is the correct number of thoughts is produced + test if the correct number of thoughts is produced :return: """ self.assertEquals(self.nr_thoughts, len(self.thinker.think()), "correct number of thoughts is produced") def test_constructor(self): """ test if trying to construct a thinker without argument raises an error :return: """ with self.assertRaises(TypeError): Thinker() if __name__ == '__main__': unittest.main() diff --git a/Examples/PythonPackageExample/python/sample/tests/test_basic.py b/Examples/PythonPackageExample/python/sample/tests/test_basic.py index 304b64131a..f1864e176e 100644 --- a/Examples/PythonPackageExample/python/sample/tests/test_basic.py +++ b/Examples/PythonPackageExample/python/sample/tests/test_basic.py @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- import unittest class BasicTestSuite(unittest.TestCase): - """Basic test cases. THis is just a fake, go to test_advanced for a real + """Basic test cases. This is just a fake, go to test_advanced for a real test""" def test_absolute_truth_and_meaning(self): assert True if __name__ == '__main__': unittest.main() diff --git a/Examples/PythonPackageExample/python/setup.py b/Examples/PythonPackageExample/python/setup.py index 176488c71f..65a6fcdc89 100755 --- a/Examples/PythonPackageExample/python/setup.py +++ b/Examples/PythonPackageExample/python/setup.py @@ -1,28 +1,30 @@ # -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('README.rst') as f: readme = f.read() with open('LICENSE') as f: license = f.read() setup( name='sample', version='0.0.2', description='Sample package adapted from Python-Guide.org for MITK', long_description=readme, - author='Sebastian Wirkert', - author_email='s.wirkert@dkfz-heidelberg.de', + # if you want, put your own name here + # (this would likely result in people sending you emails) + author='MBI@DKFZ', + author_email='mitk-users@lists.sourceforge.net', url='http://mitk.org', license=license, - packages=find_packages(exclude=('tests', 'docs')), - # the requirements to install this project. Since this one is so simple this - # is empty. + packages=find_packages(exclude=('tests', 'docs', 'tutorials')), + # the requirements to install this project. + # Since this one is so simple this is empty. install_requires=[] # a more sophisticated project might have something like: #install_requires=['numpy>=1.11.0', 'scipy>=0.17', 'scikit-learn'] ) diff --git a/Examples/PythonPackageExample/python/tutorials/ThinkerExample.ipynb b/Examples/PythonPackageExample/python/tutorials/ThinkerExample.ipynb index 63304ba78c..379f0cf650 100644 --- a/Examples/PythonPackageExample/python/tutorials/ThinkerExample.ipynb +++ b/Examples/PythonPackageExample/python/tutorials/ThinkerExample.ipynb @@ -1,148 +1,148 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "This is a very short example showing how a ipython notebook tutorial could look like" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# The next three line tell python where to look for the code\n", "# in case the package was installed (e.g. make install) they are not necessary.\n", "import os\n", "import sys\n", "sys.path.insert(0, os.path.abspath('..'))\n", "\n", "# import our great new class\n", "from sample.thinker import Thinker" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "currently I'm thinking of...\n", + "core\n", + "grand\n", "delicious\n", - "open\n", - "camel\n", - "camel\n", - "camel\n" + "berry\n", + "vtk\n" ] } ], "source": [ "# create a thinker and let it think\n", "initial_nr_thoughts = 5\n", "thinker = Thinker(initial_nr_thoughts)\n", "thinker.think_out_loud()" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "currently I'm thinking of...\n", - "toe\n", - "toe\n", "delicious\n", - "open\n", - "toe\n" + "vtk\n", + "itk\n", + "delicious\n", + "blue\n" ] } ], "source": [ "# our thinker will produce new thoughts every time we call it\n", "thinker.think_out_loud()" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "currently I'm thinking of...\n", - "camel\n", - "open\n" + "grand\n", + "core\n" ] } ], "source": [ "# we can also manipulate the number of thoughts it thinks\n", "thinker.number_of_thoughts = 2\n", "thinker.think_out_loud()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "That's it, what a great tutorial!" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }