diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..12b05f2
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,34 @@
+name: Tests
+
+on:
+ # Trigger the workflow on push or pull request,
+ # but only for the main branch
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ name: Running Tests
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ["3.8"]
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install pytest
+ pip install -e .
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+ - name: Test with pytest
+ run: |
+ pytest
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..eaf91e2
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/Github-Training-Repository.iml b/.idea/Github-Training-Repository.iml
new file mode 100644
index 0000000..d9e6024
--- /dev/null
+++ b/.idea/Github-Training-Repository.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..b534b89
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..73bbf8f
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..9661ac7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/environment.yml b/environment.yml
new file mode 100644
index 0000000..f54f8b5
--- /dev/null
+++ b/environment.yml
@@ -0,0 +1,112 @@
+name: git-training
+channels:
+ - conda-forge
+ - defaults
+dependencies:
+ - ca-certificates=2022.12.7=h5b45459_0
+ - libsqlite=3.40.0=hcfcfb64_0
+ - openssl=1.1.1s=hcfcfb64_1
+ - pip=22.3.1=pyhd8ed1ab_0
+ - python=3.8.0=hc9e8b01_5
+ - setuptools=65.5.1=pyhd8ed1ab_0
+ - sqlite=3.40.0=hcfcfb64_0
+ - ucrt=10.0.22621.0=h57928b3_0
+ - vc=14.3=h3d8a991_9
+ - vs2015_runtime=14.32.31332=h1d6e394_9
+ - wheel=0.38.4=pyhd8ed1ab_0
+ - pip:
+ - anyio==3.6.2
+ - argon2-cffi==21.3.0
+ - argon2-cffi-bindings==21.2.0
+ - arrow==1.2.3
+ - asttokens==2.2.1
+ - attrs==22.1.0
+ - backcall==0.2.0
+ - beautifulsoup4==4.11.1
+ - bleach==5.0.1
+ - cffi==1.15.1
+ - colorama==0.4.6
+ - comm==0.1.2
+ - debugpy==1.6.4
+ - decorator==5.1.1
+ - defusedxml==0.7.1
+ - entrypoints==0.4
+ - exceptiongroup==1.0.4
+ - executing==1.2.0
+ - fastjsonschema==2.16.2
+ - fqdn==1.5.1
+ - idna==3.4
+ - importlib-metadata==5.1.0
+ - importlib-resources==5.10.1
+ - iniconfig==1.1.1
+ - ipykernel==6.19.2
+ - ipython==8.7.0
+ - ipython-genutils==0.2.0
+ - ipywidgets==8.0.3
+ - isoduration==20.11.0
+ - jedi==0.18.2
+ - jinja2==3.1.2
+ - jsonpointer==2.3
+ - jsonschema==4.17.3
+ - jupyter==1.0.0
+ - jupyter-client==7.4.8
+ - jupyter-console==6.4.4
+ - jupyter-core==5.1.0
+ - jupyter-events==0.5.0
+ - jupyter-server==2.0.1
+ - jupyter-server-terminals==0.4.2
+ - jupyterlab-pygments==0.2.2
+ - jupyterlab-widgets==3.0.4
+ - markupsafe==2.1.1
+ - matplotlib-inline==0.1.6
+ - mistune==2.0.4
+ - nbclassic==0.4.8
+ - nbclient==0.7.2
+ - nbconvert==7.2.6
+ - nbformat==5.7.0
+ - nest-asyncio==1.5.6
+ - notebook==6.5.2
+ - notebook-shim==0.2.2
+ - packaging==22.0
+ - pandocfilters==1.5.0
+ - parso==0.8.3
+ - pickleshare==0.7.5
+ - pkgutil-resolve-name==1.3.10
+ - platformdirs==2.6.0
+ - pluggy==1.0.0
+ - prometheus-client==0.15.0
+ - prompt-toolkit==3.0.36
+ - psutil==5.9.4
+ - pure-eval==0.2.2
+ - pycparser==2.21
+ - pygments==2.13.0
+ - pyrsistent==0.19.2
+ - pytest==7.2.0
+ - python-dateutil==2.8.2
+ - python-json-logger==2.0.4
+ - pywin32==305
+ - pywinpty==2.0.9
+ - pyyaml==6.0
+ - pyzmq==24.0.1
+ - qtconsole==5.4.0
+ - qtpy==2.3.0
+ - rfc3339-validator==0.1.4
+ - rfc3986-validator==0.1.1
+ - send2trash==1.8.0
+ - six==1.16.0
+ - sniffio==1.3.0
+ - soupsieve==2.3.2.post1
+ - stack-data==0.6.2
+ - terminado==0.17.1
+ - tinycss2==1.2.1
+ - tomli==2.0.1
+ - tornado==6.2
+ - traitlets==5.7.0
+ - uri-template==1.2.0
+ - wcwidth==0.2.5
+ - webcolors==1.12
+ - webencodings==0.5.1
+ - websocket-client==1.4.2
+ - widgetsnbextension==4.0.4
+ - zipp==3.11.0
+prefix: C:\Users\zl\miniconda3\envs\git-training
diff --git a/scripts/Import_numerical.py.ipynb b/scripts/Import_numerical.py.ipynb
new file mode 100644
index 0000000..64bd25f
--- /dev/null
+++ b/scripts/Import_numerical.py.ipynb
@@ -0,0 +1,53 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "84e76ec0",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from src.numerical import add_numbers"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "48dfa364",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Sum: 13.5\n"
+ ]
+ }
+ ],
+ "source": [
+ "add_numbers(3.5, 10)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "git-training",
+ "language": "python",
+ "name": "git-training"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.0"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..44eebb2
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,6 @@
+from setuptools import find_packages, setup
+
+setup(
+ name='src',
+ packages=find_packages(),
+)
\ No newline at end of file
diff --git a/src/__initial__.py b/src/__initial__.py
new file mode 100644
index 0000000..e69de29
diff --git a/src/numerical.py b/src/numerical.py
new file mode 100644
index 0000000..561bc4e
--- /dev/null
+++ b/src/numerical.py
@@ -0,0 +1,18 @@
+def add_numbers(a = 7, b = 8):
+ """
+ add the numbers together
+
+ Arguments:
+ a: one number
+ b: the other number
+
+ Returns:
+ float: the addition of the two numbers
+ """
+ if isinstance(a, str) or isinstance(b, str):
+ raise NotImplementedError('This function only takes numerical values')
+ def add_numbers_inner(a, b):
+ sum = float(a) + float(b)
+ return sum
+ return add_numbers_inner(a, b)
+
diff --git a/src/plotting.py b/src/plotting.py
new file mode 100644
index 0000000..a03f546
--- /dev/null
+++ b/src/plotting.py
@@ -0,0 +1,25 @@
+import matplotlib.pyplot as plt
+import numpy as np
+
+def plot_scatter(X, Y):
+ """
+ plot a scatterplot for inputs X and Y
+
+ Arguments:
+ X: an array or a list of numbers
+ Y: an array or a list of numbers
+
+ Returns:
+ plot: scatter plot with X being x-axis and Y being Y-axis
+ """
+ # use the ALLFED plot style
+ plt.style.use("https://raw.githubusercontent.com/allfed/ALLFED-matplotlib-style-sheet/main/ALLFED.mplstyle")
+ plt.scatter(x, y)
+ plt.show()
+
+
+np.random.seed(123)
+N = 30
+x = np.random.rand(N)
+y = np.random.rand(N)
+plot_scatter(x, y)
diff --git a/tests/test1_numerical_py.py b/tests/test1_numerical_py.py
new file mode 100644
index 0000000..2b5c7eb
--- /dev/null
+++ b/tests/test1_numerical_py.py
@@ -0,0 +1,23 @@
+def add_numbers(a = 7, b = 8):
+ """
+ add the numbers together
+
+ Arguments:
+ a: one number
+ b: the other number
+
+ Returns:
+ float: the addition of the two numbers
+ """
+ if isinstance(a, str) or isinstance(b, str):
+ raise NotImplementedError('This function only takes numerical values')
+ def add_numbers_inner(a, b):
+ sum = float(a) + float(b)
+ return sum
+ return add_numbers_inner(a, b)
+
+if __name__ == '__main__':
+ assert add_numbers(4, 8) == 12
+ assert add_numbers(4.3, 9.2) == 13.5
+ assert add_numbers(-2, -3) == -5
+ print("Tests passed")
\ No newline at end of file
diff --git a/tests/test2_numerical_py.py b/tests/test2_numerical_py.py
new file mode 100644
index 0000000..84d4239
--- /dev/null
+++ b/tests/test2_numerical_py.py
@@ -0,0 +1,14 @@
+from src.numerical import add_numbers
+import pytest
+
+def test_typical():
+ assert add_numbers(4, 8) == 12
+ assert add_numbers(4.3, 9.2) == 13.5
+ assert add_numbers(-2, -3) == -5
+
+def test_raises():
+ with pytest.raises(NotImplementedError):
+ add_numbers("23", 3)
+
+ with pytest.raises(NotImplementedError):
+ add_numbers(23, "5.1")