Uploaded by Hanzlah Shah

Python package development

advertisement
Python Package
Development
Presented By:
Muhammad Hanzlah Shah
Ms Bioinformatics
Overview
1. Basic Method To Develop Python Package.
2. My Previous Work.
Introduction
●
●
●
●
●
●
Container Organization: Python packages group multiple files (modules) and
resources together.
Structured Organization: Acts as a systematic box, organizing code as the project
expands.
Readability Maintenance: Facilitates code readability and understandability for easy
maintenance.
Project Management: Eases the handling of growing projects.
Code Reusability: Promotes the reuse of code for efficiency across different projects.
Enhanced Clarity: Provides a clear organizational framework for better code
comprehension.
Developing Python Package
●
●
Now here we have a code that
perform some simple
arithmetic operation.
Now for a code to be
converted into package it
should be organized into
function,s and if code is
complex than it should be in
classes or objects.
Workflow
Package file structure
Setup.py file script
Types of license used in Package
MIT License:
Open-source license permitting users to freely use, modify, and distribute software.Permissive
nature allows nearly unrestricted use, with the condition to retain the original copyright and
license terms.
GNU General Public License (GPL):
Copyleft license requiring derived works to be licensed under the GPL.Permits use,
modification, and distribution, but redistributed modifications must also be open-source under
the GPL.
Command to make Python Package
●
Here I open vs code in the location where my all files
are present than in terminal I type this command
“python setup.py sdist bdist_wheel”
●
Here is the result :-
Intro to PyPi
1.
2.
3.
Official repository for third-party Python
software.
Functions like an app store, housing
numerous ready-to-use modules and tools.
Offers a vast collection of libraries focused
on functionality and efficiency.
Upload your python package in
PyPi
1.
2.
3.
Go to dist file in the folder where all
modules or files of your package is present.
Now find dist folder go inside dist folder and
press shift and right click and open
powershell now type following command
“twine upload dist/*”.
Now it will ask you enter your password
enter it then hit enter now package is upload
in your pypi account.
Installing and using Package
1.
2.
Now you can type “pip install
your_package_name”
After installing it here is how we use the
package we made now.
Conclusion
Creating a Python package is like making a tidy toolbox for your code. It means grouping
modules together neatly so that things stay organized and can be reused easily. Each
module handles its own specific job, and there are handy tools inside for different tasks.
When you share this package, it's like giving others access to your well-organized toolbox.
They can use the tools you've made and even add their own. So, Python packages make it
easy to keep code organized, easy to read, and simple to use, helping everyone work
together smoothly.
Download