From 9adb96b2f6e874f0f773c5187d77154d86d1d43f Mon Sep 17 00:00:00 2001 From: quantshah Date: Tue, 20 Oct 2020 08:20:58 +0200 Subject: [PATCH 1/6] Slightly more functions and tests --- mylibrary/.DS_Store | Bin 0 -> 6148 bytes mylibrary/LICENSE.md | 19 +++++ mylibrary/README.md | 2 + .../0-introduction-checkpoint.ipynb | 0 .../0-introduction.ipynb | 0 .../{mylibrary-notebooks => examples}/apt.txt | 0 .../environment.yml | 0 mylibrary/mylibrary/hello.py | 67 ++++++++++++++++-- mylibrary/requirements.txt | 1 + mylibrary/setup.py | 10 +-- .../test_hello.cpython-37-pytest-5.4.1.pyc | Bin 0 -> 1259 bytes mylibrary/tests/test_hello.py | 16 +++++ 12 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 mylibrary/.DS_Store rename mylibrary/{mylibrary-notebooks => examples}/.ipynb_checkpoints/0-introduction-checkpoint.ipynb (100%) rename mylibrary/{mylibrary-notebooks => examples}/0-introduction.ipynb (100%) rename mylibrary/{mylibrary-notebooks => examples}/apt.txt (100%) rename mylibrary/{mylibrary-notebooks => examples}/environment.yml (100%) create mode 100644 mylibrary/requirements.txt create mode 100644 mylibrary/tests/__pycache__/test_hello.cpython-37-pytest-5.4.1.pyc create mode 100644 mylibrary/tests/test_hello.py diff --git a/mylibrary/.DS_Store b/mylibrary/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2b658949a1cef9ec23341f1eea13b3d475054170 GIT binary patch literal 6148 zcmeHK%}T>S5T317lZx1bV2`C9$!qAv7xCoH zC-8Ng{ZXt{JSi$OF#FBU&o29=>~;Wv)jEC!pa=j4s=%Cy!v`YbLPsR0JrjsbuHiup zE^5!~j%1VLH!>i;oe3@IK?ni7`F=^;3%Q5UN3R_QNm?#HvD{dGd}7it3WdUS;n->N zu9LcHC#kvdp_uKsY17m8F6ZH^?RtAbqkB@E-QZE`22mrH#ev_zl%xG1@_Dz$JCUEr zbsQBi4AV4Eilu(Py0o-lRjZ4G1*^ZZQbv1mc`z`Ix%tZ4_Gznk*}ocG-za_={uHIm zXncWNG(I@$g%d|1kIpeFD#sy(1|&Ep;d#Y5jZ3uh%t2#_HC6d~o-${yxM1 zBBR|L+2PG*WD*0!05R}g4Csr}nEI{_XkB7}82Gaci2K1p6=-YB6w0du2iXE3=Fu$$ zZP81J8cUU6sAfMRVmXg227AMGP?+2u*SBOkFk2yw z!~iic%)pqM7RCF&`Fa08TtqWsfEf5!46uCNsn_sG`fVLKoOo+3)KgR;A}>?;T7rgr hiZNF_#U)fJ=(mJ{Xlu+Aq6dZk2uK=eAO?PvfoEO{aBlzr literal 0 HcmV?d00001 diff --git a/mylibrary/LICENSE.md b/mylibrary/LICENSE.md index e69de29..77daca4 100644 --- a/mylibrary/LICENSE.md +++ b/mylibrary/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (c) 2020 Shahnawaz Ahmed, Nathan Shammah. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/mylibrary/README.md b/mylibrary/README.md index 8d53209..68800d8 100644 --- a/mylibrary/README.md +++ b/mylibrary/README.md @@ -2,3 +2,5 @@ This simply library prints a hello world message from a python package and tests its functionality. + +We add the basic elements that you need to get a working python package - a setup file that lets you install your library locally, tests and documentation with sphinx. diff --git a/mylibrary/mylibrary-notebooks/.ipynb_checkpoints/0-introduction-checkpoint.ipynb b/mylibrary/examples/.ipynb_checkpoints/0-introduction-checkpoint.ipynb similarity index 100% rename from mylibrary/mylibrary-notebooks/.ipynb_checkpoints/0-introduction-checkpoint.ipynb rename to mylibrary/examples/.ipynb_checkpoints/0-introduction-checkpoint.ipynb diff --git a/mylibrary/mylibrary-notebooks/0-introduction.ipynb b/mylibrary/examples/0-introduction.ipynb similarity index 100% rename from mylibrary/mylibrary-notebooks/0-introduction.ipynb rename to mylibrary/examples/0-introduction.ipynb diff --git a/mylibrary/mylibrary-notebooks/apt.txt b/mylibrary/examples/apt.txt similarity index 100% rename from mylibrary/mylibrary-notebooks/apt.txt rename to mylibrary/examples/apt.txt diff --git a/mylibrary/mylibrary-notebooks/environment.yml b/mylibrary/examples/environment.yml similarity index 100% rename from mylibrary/mylibrary-notebooks/environment.yml rename to mylibrary/examples/environment.yml diff --git a/mylibrary/mylibrary/hello.py b/mylibrary/mylibrary/hello.py index 75281b5..8baeb05 100644 --- a/mylibrary/mylibrary/hello.py +++ b/mylibrary/mylibrary/hello.py @@ -2,10 +2,63 @@ A simple hello world """ -class HelloWorld(): - """ - """ - def print_message(self, message): - """ - """ - print(message) + +def hello(name): + """ + Simple function that prints "Hello X" for + an input `name`. + + Parameters + ---------- + name : str + The name of the person. + + Returns + ------- + greeting: str + The message - Hello `name`. + """ + if type(name) != str: + raise ValueError("Name should be a string") + greeting = "Hello " + name + return greeting + + +class ChatBot(object): + """ + Simple class that acts as a bot. + + Parameters + —————————- + name : str + The name of the person. + """ + + def __init__(self, name): + self.name = name + if type(name) != str: + raise ValueError("Name should be a string") + + def hello(self): + """ + Simple function that prints Hello `name` + an input `name`. + + Returns + ——————- + str + The message - Hello `name`. + """ + return "Hello " + self.name + + def goodbye(self): + """ + Simple function that prints Bye `name` + an input `name`. + + Returns + ——————- + str + The message - Bye `name`. + """ + return "Bye " + self.name diff --git a/mylibrary/requirements.txt b/mylibrary/requirements.txt new file mode 100644 index 0000000..296d654 --- /dev/null +++ b/mylibrary/requirements.txt @@ -0,0 +1 @@ +numpy \ No newline at end of file diff --git a/mylibrary/setup.py b/mylibrary/setup.py index f9c0835..b5cff3a 100644 --- a/mylibrary/setup.py +++ b/mylibrary/setup.py @@ -1,12 +1,12 @@ #!/usr/bin/env python """ -Setup file created +Setup file """ -from setuptools import setup +from setuptools import setup, find_packages setup(name='mylibrary', - version='0.1', - description='Test', + version='0.0.1', + description='Test library', author='Shahnawaz Ahmed, Nathan Shammah', - packages = ['mylibrary'] + packages = find_packages(include=['mylibrary', 'mylibrary.*']) ) diff --git a/mylibrary/tests/__pycache__/test_hello.cpython-37-pytest-5.4.1.pyc b/mylibrary/tests/__pycache__/test_hello.cpython-37-pytest-5.4.1.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf845a94ae8719b5d2b308b4acc8ed3d4588ea67 GIT binary patch literal 1259 zcmb_cOOMkq5VoB(O|sqPv4B7VsTUAI+U@cNiAB7HkXRw{IOJlybxK2>q_SN>ODiGZ zh!8)3!}iEu@)a&z_yL?4JG;;mCnC-Gn;FORWoDdP%ggcV+fUTP2z^5f4*`4wL|q5P zQHnU`MBtRT)hm30Fe(~pfNjJR%_2-ghlz;Ni2Jk_jrB%CE$+qri z?S3Xi)h;SN5?TBMGN7#ln}&0Dt!bYCqzQ5xL~Q{Rbxyf>oC%D@>_OYInfZ zL|Nz6t<-#Ow;W3P_UBO z;+UY$ZUV`2l_?WHV`7xK7m~m%+3fX4olO^v^NYr%MdM;^)S0fNj(%;N-S~>+Dt!5` z=bfieCe=}W)-TyBHtF1v)o{Cd-O)@8RHtBrY;9bP3$|WY#m<+^UddcT>HoM)bJr*Btxxy;A-nD Date: Tue, 20 Oct 2020 08:55:39 +0200 Subject: [PATCH 2/6] gitignore updated --- mylibrary/.DS_Store | Bin 6148 -> 0 bytes mylibrary/.gitignore | 3 +- mylibrary/docs/Makefile | 20 ++++++++++++ mylibrary/docs/make.bat | 35 ++++++++++++++++++++ mylibrary/docs/source/conf.py | 55 ++++++++++++++++++++++++++++++++ mylibrary/docs/source/index.rst | 20 ++++++++++++ 6 files changed, 132 insertions(+), 1 deletion(-) delete mode 100644 mylibrary/.DS_Store create mode 100644 mylibrary/docs/Makefile create mode 100644 mylibrary/docs/make.bat create mode 100644 mylibrary/docs/source/conf.py create mode 100644 mylibrary/docs/source/index.rst diff --git a/mylibrary/.DS_Store b/mylibrary/.DS_Store deleted file mode 100644 index 2b658949a1cef9ec23341f1eea13b3d475054170..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5T317lZx1bV2`C9$!qAv7xCoH zC-8Ng{ZXt{JSi$OF#FBU&o29=>~;Wv)jEC!pa=j4s=%Cy!v`YbLPsR0JrjsbuHiup zE^5!~j%1VLH!>i;oe3@IK?ni7`F=^;3%Q5UN3R_QNm?#HvD{dGd}7it3WdUS;n->N zu9LcHC#kvdp_uKsY17m8F6ZH^?RtAbqkB@E-QZE`22mrH#ev_zl%xG1@_Dz$JCUEr zbsQBi4AV4Eilu(Py0o-lRjZ4G1*^ZZQbv1mc`z`Ix%tZ4_Gznk*}ocG-za_={uHIm zXncWNG(I@$g%d|1kIpeFD#sy(1|&Ep;d#Y5jZ3uh%t2#_HC6d~o-${yxM1 zBBR|L+2PG*WD*0!05R}g4Csr}nEI{_XkB7}82Gaci2K1p6=-YB6w0du2iXE3=Fu$$ zZP81J8cUU6sAfMRVmXg227AMGP?+2u*SBOkFk2yw z!~iic%)pqM7RCF&`Fa08TtqWsfEf5!46uCNsn_sG`fVLKoOo+3)KgR;A}>?;T7rgr hiZNF_#U)fJ=(mJ{Xlu+Aq6dZk2uK=eAO?PvfoEO{aBlzr diff --git a/mylibrary/.gitignore b/mylibrary/.gitignore index 1644965..0e47979 100644 --- a/mylibrary/.gitignore +++ b/mylibrary/.gitignore @@ -1,4 +1,5 @@ mylibrary build dist -mylibrary.egg-info \ No newline at end of file +mylibrary.egg-info +.DS_Store diff --git a/mylibrary/docs/Makefile b/mylibrary/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/mylibrary/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/mylibrary/docs/make.bat b/mylibrary/docs/make.bat new file mode 100644 index 0000000..6247f7e --- /dev/null +++ b/mylibrary/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/mylibrary/docs/source/conf.py b/mylibrary/docs/source/conf.py new file mode 100644 index 0000000..da3a476 --- /dev/null +++ b/mylibrary/docs/source/conf.py @@ -0,0 +1,55 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'mylibrary' +copyright = '2020, Shahnawaz Ahmed, Nathan Shammah' +author = 'Shahnawaz Ahmed, Nathan Shammah' + +# The full version, including alpha/beta/rc tags +release = '0.0.1' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] \ No newline at end of file diff --git a/mylibrary/docs/source/index.rst b/mylibrary/docs/source/index.rst new file mode 100644 index 0000000..1d4464a --- /dev/null +++ b/mylibrary/docs/source/index.rst @@ -0,0 +1,20 @@ +.. mylibrary documentation master file, created by + sphinx-quickstart on Tue Oct 20 08:22:04 2020. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to mylibrary's documentation! +===================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` From 3b3081da83c2d48903529e5fee0cd1a17987ea43 Mon Sep 17 00:00:00 2001 From: Shahnawaz Ahmed Date: Thu, 26 Nov 2020 10:08:23 +0100 Subject: [PATCH 3/6] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index da68462..262ba28 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# `scikit-project`: A Guide to Building Your Open-Source Science Project +# Make your code count +A Guide to building your open-source science project (started by @NathanShammah and myself as `scikit-project`). [![Unitary Fund](https://img.shields.io/badge/Supported%20By-UNITARY%20FUND-brightgreen.svg?style=for-the-badge)](http://unitary.fund) From a2498eaa5228cc15ea0b49e1bfb0a04272989893 Mon Sep 17 00:00:00 2001 From: Shahnawaz Ahmed Date: Thu, 10 Jun 2021 09:03:39 +0200 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 262ba28..56033da 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Make your code count -A Guide to building your open-source science project (started by @NathanShammah and myself as `scikit-project`). +A Guide to building your open-source scientific computing project in Python. [![Unitary Fund](https://img.shields.io/badge/Supported%20By-UNITARY%20FUND-brightgreen.svg?style=for-the-badge)](http://unitary.fund) From e08c74c97df45a93f1be8ea765269391b5dada4a Mon Sep 17 00:00:00 2001 From: Nathan Shammah Date: Tue, 22 Jun 2021 18:34:48 +0200 Subject: [PATCH 5/6] Update mylibrary/LICENSE.md --- mylibrary/LICENSE.md | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/mylibrary/LICENSE.md b/mylibrary/LICENSE.md index 77daca4..1f73bba 100644 --- a/mylibrary/LICENSE.md +++ b/mylibrary/LICENSE.md @@ -1,19 +1,29 @@ -Copyright (c) 2020 Shahnawaz Ahmed, Nathan Shammah. +BSD 3-Clause License -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Copyright (c) 2019, Nathan Shammah and Shahnawaz Ahmed +All rights reserved. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From fd23c0fdb6d501e5d48f8655d1fabb4735efb021 Mon Sep 17 00:00:00 2001 From: Nathan Shammah Date: Tue, 22 Jun 2021 18:34:54 +0200 Subject: [PATCH 6/6] Update mylibrary/docs/source/conf.py --- mylibrary/docs/source/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mylibrary/docs/source/conf.py b/mylibrary/docs/source/conf.py index da3a476..4ca727a 100644 --- a/mylibrary/docs/source/conf.py +++ b/mylibrary/docs/source/conf.py @@ -18,8 +18,8 @@ # -- Project information ----------------------------------------------------- project = 'mylibrary' -copyright = '2020, Shahnawaz Ahmed, Nathan Shammah' -author = 'Shahnawaz Ahmed, Nathan Shammah' +copyright = '2020, Nathan Shammah, Shahnawaz Ahmed' +author = 'Nathan Shammah, Shahnawaz Ahmed' # The full version, including alpha/beta/rc tags release = '0.0.1' @@ -52,4 +52,4 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file +html_static_path = ['_static']