Python Library creation concept.
Python Library creation concept.
**Local library creating and calling in program:
Folder_name:
Library_name.py [file-1]
Library_name.py [file-2]
...........................
Library_name.py [file-n]
Next:
create a "__init__.py" [file]
library calling: from folder_name import library_name
or: from folder_name.library_name import function_name
very, very important:
In local calling:
The library folder must exist in the program folder.
***creating .whl file for pip installation
pip install setuptools, wheel library
1.create setup.py [file] ↓↓↓
from setuptools import setup
setup(
name="final_name",
version="0.0.1",
install_requires=["setuptools"],
packages=["library_folder_name"]
)
cmd: python setup.py bdist_wheel to prepare the .whl file
2.create setup.py [file] ↓↓↓
import setuptools
with open("rakhin.rb") as fh:
long_description=fh.read()
setuptools.setup(
name="user_package",
version="0.0.1",
author="Rakhin babu",
description="package the function",
long_description=long_description,
long_description_content_type="text/markdown"
packages=setuptools.finds_packages(),
classifiers=[
"Programming Language::Python::3",
"Operating System::OS Independent",],
python_requires='>=3.7',
)
************
cmd: python setup.py bdist_wheel to prepare the .whl file
.........Python.........