Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views2 pages

Python Module Creation

This document outlines the process of creating a Python module, including setting up a virtual environment, generating source and wheel distributions, and local testing. It also details how to create a command line interface for the module and the steps to publish it to PyPI. The final section provides links to the PyPI project and the GitHub repository for the module.

Uploaded by

Akanksha Soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Python Module Creation

This document outlines the process of creating a Python module, including setting up a virtual environment, generating source and wheel distributions, and local testing. It also details how to create a command line interface for the module and the steps to publish it to PyPI. The final section provides links to the PyPI project and the GitHub repository for the module.

Uploaded by

Akanksha Soni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Module creation

Creating a virtual environment :


python3 -m venv venv

Activation the vr. Environment:


source venv/bin/activate

Python setup.py sdist bdist_wheel

Generates 2 distributions :
. A sourced distribution which contains the files for us which is python
scripts
. The wheel distribution : contains binaries which are platform specific.
Contains all necessary files and dependencies to run the file

Means generates 2 folder : build and dist

In Dist folder we have a wheel file which is the actually file which we can share
with people and others can use our module through this

Local Testing
Done before actually pushing data on the actual open source file
Pip install dist/pyinspirationquotes-0.1-py3-none-any.whl
Pip list
– Your python package must be in the list

To create it as a command line interface or cli application


Now this package will directly run from command line
Add these in setup
entry_points={
'console_scripts': [
2
'pyinspirationalquotes=pyinspirationalquotes.main:hello',
],
1
},

PUBLISH TO PYPI

This is from where the pip gets its modules


Creating Inspirational Quotes Module
quotes.txt
rm -rf build/ dist/ pyinspirationquotes.egg-info
python setup.py sdist bdist_wheel
pip install --upgrade dist/pyinspirationquotes-1.0.0-py3-none-any.whl --force-
reinstall

twine upload dist/*

pypi-
AgEIcHlwaS5vcmcCJDQxNzk1MjQ3LTdjOTQtNDM5YS1iMTY0LWFhZmJmMTliM
DRhZAACKlszLCIwNDBiNjNjZi0yZjZmLTQxMjgtYjlhNi00MDUzYjNhMGU2MmQi
XQAABiCxZAfXJfoH6wsAMANH01JvUsXV_3ypmG4O4orzmoOZgQ

https://pypi.org/project/pyinspirationquotes/

https://pypi.org/project/pyinspirationquotes/
https://github.com/akankshasoni024/pyinspirationquotes.git

You might also like