{"id":20716712,"url":"https://github.com/kingabzpro/creating-python-package-using-jupyter-notebook","last_synced_at":"2026-04-22T06:39:22.012Z","repository":{"id":133142321,"uuid":"389067469","full_name":"kingabzpro/Creating-Python-Package-using-Jupyter-Notebook","owner":"kingabzpro","description":"Creating your first data science python package straight from Jupyter Notebook.","archived":false,"fork":false,"pushed_at":"2021-08-28T19:18:51.000Z","size":335,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T22:12:03.713Z","etag":null,"topics":["article","begineer","data-science","notebook-jupyter","package","tutorial"],"latest_commit_sha":null,"homepage":"https://deepnote.com/@abid/Creating-Python-Package-in-Jupyter-Notebook-JvApLhCiQIqj-0yR-PAfdQ","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kingabzpro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-24T10:24:21.000Z","updated_at":"2024-08-14T09:05:38.000Z","dependencies_parsed_at":"2023-07-08T04:16:56.729Z","dependency_job_id":null,"html_url":"https://github.com/kingabzpro/Creating-Python-Package-using-Jupyter-Notebook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FCreating-Python-Package-using-Jupyter-Notebook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FCreating-Python-Package-using-Jupyter-Notebook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FCreating-Python-Package-using-Jupyter-Notebook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kingabzpro%2FCreating-Python-Package-using-Jupyter-Notebook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kingabzpro","download_url":"https://codeload.github.com/kingabzpro/Creating-Python-Package-using-Jupyter-Notebook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242989415,"owners_count":20217782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["article","begineer","data-science","notebook-jupyter","package","tutorial"],"created_at":"2024-11-17T03:06:36.872Z","updated_at":"2025-12-24T06:30:50.549Z","avatar_url":"https://github.com/kingabzpro.png","language":"Jupyter Notebook","readme":"# Creating Python Package using Jupyter Notebook\n Creating your first data science python package straight from Jupyter Notebook.\n\n![img](Images/pythonpackage.jpg)\n\n\u003e **Creating your first data science python package straight from Jupyter Notebook.**\n\n[![View in Deepnote](https://deepnote.com/static/buttons/view-in-deepnote-white.svg)](https://deepnote.com/viewer/github/kingabzpro/Creating-Python-Package-using-Jupyter-Notebook/blob/main/python_packages.ipynb)\n\nHave you wondered how Python packages like Scikit-learn, pandas, and NumPy are built? They are all based on Object Orient Programming (OOP) to create complex and easy-to-use packages. For a data scientist it's a necessity to learn OOP so they can use it in development of production ready products.\n\nWe are going to use the cloud Jupyter Notebook to ease the setting up of the environment and completely focus on creating a package. The project includes fundamentals of OOP like Inheritance, objects, class, and magic functions. The project is highly influenced by AWS Machine Learning Foundations course, and it took me ten minutes to recreate the package once I knew how to build it.\n\n# Creating ***__init__.py*** Function\n\nWe need to create __init__.py file in the distributions folder to initialize the classes within the python file. This will help us call specific classes directly.\n\nWe have initiated both Binomial and Gaussian class.\n\n```python\n%%writefile distributions/__init__.py\n\nfrom .binomial import Binomial\n\nfrom .gaussian import Gaussian\n```\n\n```\nWriting distributions/__init__.py \n```\n\n# Creating *setup.py* Function\n\nsetup.py function giving all necessary information about the package. It uses setuptools library to create package name, version, description, author name, etc. We have to create this file outside the distribution folder.\n\n```python\n%%writefile setup.py\n\nfrom setuptools import setup\n\nsetup(name='distributions',\n\n   version='0.2',\n\n   description='Gaussian and Binomial distributions',\n\n   packages=['distributions'],\n\n   author = \"Abid Ali Awan\",\n\n   author_email = \"abidaliawan@rocketmail.com\",\n\n   zip_safe=False)\n\n```\n```\nWriting setup.py \n```\n\n# Directory\n\nThe image below shows the package directory contain all required files.\n\n![Picture title](Images/image-20210724-124844.png)\n\n# Installing distributions Package\n\nUsing `pip install .` or `pip install -U .` to install the python package which we can use in any project. As we can see our distribution package is successfully installed.\n\n```\n(venv) root@deepnote:~/work # pip install -U .\nProcessing /work\nBuilding wheels for collected packages: distributions\n  Building wheel for distributions (setup.py) ... done\n  Created wheel for distributions: filename=distributions-0.2-py3-none-any.whl size=4800 sha256=39bc76cbf407b2870caea42b684b05efc15641c0583f195f36a315b3bc4476da\n  Stored in directory: /tmp/pip-ephem-wheel-cache-ef8q6wh9/wheels/95/55/fb/4ee852231f420991169c6c5d3eb5b02c36aea6b6f444965b4b\nSuccessfully built distributions\nInstalling collected packages: distributions\n  Attempting uninstall: distributions\n    Found existing installation: distributions 0.2\n    Uninstalling distributions-0.2:\n      Successfully uninstalled distributions-0.2\nSuccessfully installed distributions-0.2\n```\n\n# Testing our Package\n\nWe will be running Python kernel within Linius terminal and then test  both classes. Well done you have created your first python package.\n\n```\n\u003e\u003e\u003e from distributions import Gaussian\n\u003e\u003e\u003e from distributions import Binomial\n\u003e\u003e\u003e \n\u003e\u003e\u003e print(Gaussian(20,6))\nmean 20, standard deviation 6\n\u003e\u003e\u003e print(Binomial(0.4,50))\nmean 20.0, standard deviation 3.4641016151377544, p 0.4, n 50\n\u003e\u003e\u003e \n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingabzpro%2Fcreating-python-package-using-jupyter-notebook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingabzpro%2Fcreating-python-package-using-jupyter-notebook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingabzpro%2Fcreating-python-package-using-jupyter-notebook/lists"}