Skip to content

Pip package learning and this is used to setup a new pc with pip libraries i need

License

Notifications You must be signed in to change notification settings

Subhangmokkarala/subhangpack

Repository files navigation

subhangpack

hello namegen

Python Package

to install

pip install subhangpack

to use

from subhangpack import namegen

to generate a random name

namegen.gen()

to generate from terminal

subhangpack-devicename

pip package for generating random names for homelab and network devices

noobs guide for making a pip package

0. Install pip

sudo apt install python3-pip

install libraries

pip install wheel
pip install setuptools

1. Make a new folder and cd into it which will be the name of your package

mkdir yourpackagename
cd yourpackagename

2. Make a init.py file in the folder

touch __init__.py

3. Make a py file which will be the main file of your package to say what your package does

touch namegen.py

4. add your module code in the py file to make it work

#write your code here

5. import your module in the init.py file to say that it is a package

from .namegen import *

6. Make a setup.py file

touch setup.py

7. Add the following code in the setup.py file

from setuptools import setup

setup(name='yourpackagename',
      version='0.1',
      description='write a description here',
      url='
        author='your name',
        author_email='your email',
        license='MIT',
        packages=['yourpackagename'],
        zip_safe=False)

8. now package your module for source distribution

python setup.py sdist

9. now use wheel to package your module for build distribution

python setup.py bdist_wheel

10. now install your module to test it locally before publishing it to pypi

pip install yourpackagename.whl

11. now you can use your module in any python file

import yourpackagename

12. now you can upload your module to pypi

pip install twine

13. now upload your module to pypi

twine upload dist/*

14. now you can install your module from pypi

pip install yourpackagename

tada you have made your first pip package

About

Pip package learning and this is used to setup a new pc with pip libraries i need

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages