diff --git a/00_introduction/py_project_structure/app/__init__.py b/00_introduction/py_project_structure/app/__init__.py deleted file mode 100644 index 8b13789..0000000 --- a/00_introduction/py_project_structure/app/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/00_introduction/py_project_structure/app/__main__.py b/00_introduction/py_project_structure/app/__main__.py deleted file mode 100644 index 4e28416..0000000 --- a/00_introduction/py_project_structure/app/__main__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .cli import main - -main() diff --git a/00_introduction/py_project_structure/app/__version__.py b/00_introduction/py_project_structure/app/__version__.py deleted file mode 100644 index 96bfa14..0000000 --- a/00_introduction/py_project_structure/app/__version__.py +++ /dev/null @@ -1,3 +0,0 @@ -VERSION = (1, 0, 0) - -__version__ = '.'.join(map(str, VERSION)) diff --git a/00_introduction/py_project_structure/app/cli.py b/00_introduction/py_project_structure/app/cli.py deleted file mode 100644 index 861127d..0000000 --- a/00_introduction/py_project_structure/app/cli.py +++ /dev/null @@ -1,12 +0,0 @@ -from argparse import ArgumentParser - - -def main(): - parser = ArgumentParser(prog='cli') - parser.add_argument('name', help="The user's name.") - args = parser.parse_args() - print("Hello, %s!" % args.name) - - -if __name__ == '__main__': - main() diff --git a/00_introduction/py_project_structure/MANIFEST.in b/00_introduction/py_project_structure/package/__init__.py similarity index 100% rename from 00_introduction/py_project_structure/MANIFEST.in rename to 00_introduction/py_project_structure/package/__init__.py diff --git a/00_introduction/py_project_structure/package/__pycache__/__init__.cpython-38.pyc b/00_introduction/py_project_structure/package/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000..b1151c1 Binary files /dev/null and b/00_introduction/py_project_structure/package/__pycache__/__init__.cpython-38.pyc differ diff --git a/00_introduction/py_project_structure/package/__pycache__/core.cpython-38.pyc b/00_introduction/py_project_structure/package/__pycache__/core.cpython-38.pyc new file mode 100644 index 0000000..d5c7389 Binary files /dev/null and b/00_introduction/py_project_structure/package/__pycache__/core.cpython-38.pyc differ diff --git a/00_introduction/py_project_structure/package/__pycache__/helpers.cpython-38.pyc b/00_introduction/py_project_structure/package/__pycache__/helpers.cpython-38.pyc new file mode 100644 index 0000000..8059885 Binary files /dev/null and b/00_introduction/py_project_structure/package/__pycache__/helpers.cpython-38.pyc differ diff --git a/00_introduction/py_project_structure/package/core.py b/00_introduction/py_project_structure/package/core.py new file mode 100644 index 0000000..908dd41 --- /dev/null +++ b/00_introduction/py_project_structure/package/core.py @@ -0,0 +1,9 @@ +from .helpers import get_fib_sequence + +#Function to calculate square root of the given nth fib number +def power_fib_number(number,power): + print("retrieving nth of Fibonacci sequence...") + number = get_fib_sequence(number) + + print("calculating power n of given number...") + return number ** power diff --git a/00_introduction/py_project_structure/package/helpers.py b/00_introduction/py_project_structure/package/helpers.py new file mode 100644 index 0000000..39b9c35 --- /dev/null +++ b/00_introduction/py_project_structure/package/helpers.py @@ -0,0 +1,13 @@ +# Function to get the nth number of Fibonacci sequence +# 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ... +def get_fib_sequence(fib_numbers): + if fib_numbers < 0: + print("output is incorrect") + elif fib_numbers == 0: + return 0 + elif fib_numbers == 1 or fib_numbers == 2: + return 1 + else: + return get_fib_sequence(fib_numbers - 1) + get_fib_sequence(fib_numbers - 2) + +print("file accessed") \ No newline at end of file diff --git a/00_introduction/py_project_structure/requirements.txt b/00_introduction/py_project_structure/requirements.txt index a284b1b..a11ef2f 100644 --- a/00_introduction/py_project_structure/requirements.txt +++ b/00_introduction/py_project_structure/requirements.txt @@ -1,9 +1,2 @@ -certifi==2018.1.18 -chardet==3.0.4 -idna==2.6 -pkginfo==1.4.1 -requests==2.21.0 -requests-toolbelt==0.8.0 -tqdm==4.19.7 -twine==1.10.0 -urllib3==1.24.2 +pandas +numpy \ No newline at end of file diff --git a/00_introduction/py_project_structure/runner.py b/00_introduction/py_project_structure/runner.py deleted file mode 100644 index 0082743..0000000 --- a/00_introduction/py_project_structure/runner.py +++ /dev/null @@ -1,4 +0,0 @@ -from app.cli import main - -if __name__ == '__main__': - main() diff --git a/00_introduction/py_project_structure/setup.py b/00_introduction/py_project_structure/setup.py deleted file mode 100644 index 33e405f..0000000 --- a/00_introduction/py_project_structure/setup.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Note: To use the 'upload' functionality of this file, you must install Twine: -# $ pip install -r requirements.txt - -import io -import os -import sys -from shutil import rmtree - -from setuptools import find_packages, setup, Command - -# Package meta-data. -NAME = 'mypackage' -DESCRIPTION = 'My short description for my project.' -URL = 'https://github.com/me/myproject' -EMAIL = 'me@example.com' -AUTHOR = 'Awesome Soul' -REQUIRES_PYTHON = '>=3.6.0' -VERSION = None -LICENSE = 'MIT' -# What packages are required for this module to be executed? -REQUIRED = [ - # 'requests', 'maya', 'records', -] - -here = os.path.abspath(os.path.dirname(__file__)) - -with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f: - long_description = '\n' + f.read() - -about = {} -if not VERSION: - with open(os.path.join(here, NAME, '__version__.py')) as f: - exec(f.read(), about) -else: - about['__version__'] = VERSION - - -class UploadCommand(Command): - """Support setup.py upload.""" - - description = 'Build and publish the package.' - user_options = [] - - @staticmethod - def status(s): - """Prints things in bold.""" - print('\033[1m{0}\033[0m'.format(s)) - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - try: - self.status('Removing previous builds…') - rmtree(os.path.join(here, 'dist')) - except OSError: - pass - - self.status('Building Source and Wheel (universal) distribution…') - os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable)) - - self.status('Uploading the package to PyPi via Twine…') - os.system('twine upload dist/*') - - self.status('Pushing git tags…') - os.system('git tag v{0}'.format(about['__version__'])) - os.system('git push --tags') - - sys.exit() - -setup( - name=NAME, - version=about['__version__'], - description=DESCRIPTION, - long_description=long_description, - author=AUTHOR, - author_email=EMAIL, - python_requires=REQUIRES_PYTHON, - url=URL, - py_modules=['mypackage'], - - entry_points={ - 'console_scripts': ['app=cli:main'], - }, - install_requires=REQUIRED, - include_package_data=True, - license=LICENSE, - classifiers=[ - # Trove classifiers - # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy' - ], - # $ setup.py publish support. - cmdclass={ - 'upload': UploadCommand, - }, -) diff --git a/00_introduction/py_project_structure/tests/test_core.py b/00_introduction/py_project_structure/tests/test_core.py new file mode 100644 index 0000000..f54327f --- /dev/null +++ b/00_introduction/py_project_structure/tests/test_core.py @@ -0,0 +1,11 @@ +import unittest +from package.core import * + + +class BasicTestSuite(unittest.TestCase): + def test_power_function(self): + print("running power function test") + self.assertEqual(power_fib_number(6,2), 64, "should be 64") + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/00_introduction/py_project_structure/tests/test_helpers.py b/00_introduction/py_project_structure/tests/test_helpers.py new file mode 100644 index 0000000..f5d994f --- /dev/null +++ b/00_introduction/py_project_structure/tests/test_helpers.py @@ -0,0 +1,11 @@ +import unittest +from package.helpers import get_fib_sequence + + +class BasicTestSuite(unittest.TestCase): + def test_fib_function(self): + print("running fibo function test") + self.assertEqual(get_fib_sequence(12), 142, "should be 144") + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/00_introduction/py_project_structure/tests/tests.py b/00_introduction/py_project_structure/tests/tests.py deleted file mode 100644 index 430bb53..0000000 --- a/00_introduction/py_project_structure/tests/tests.py +++ /dev/null @@ -1,8 +0,0 @@ -import unittest - -class ApplicationTests(unittest.TestCase): - - def test_hello(self): - self.assertTrue(True) - - \ No newline at end of file