- Create a new repository in github
- choose a license
- include a readme
- select .gitignore file for python
- Create a package directory
- Create a module inside the package directory. A module is a single
.pyfile that contains Python code — it could be functions, classes, or variables - Edit init.py
- Create setup file (setup.py)
- Example 1 :
setup( name='calc-demo', version='1.0.0', url='https://github.com/Franc6s/demo-package-test', author='Francis Mangala', author_email='francis@viz-optima.us', description='Demo basic calculator', license='MIT', packages=['calculator'] )- Example 2 :
from setuptools import setup, find_packages setup( name='MyPackageName', version='1.0.0', url='https://github.com/mypackage.git', author='Author Name', author_email='author@gmail.com', description='Description of my package', packages=find_packages(), install_requires=['numpy >= 1.11.1', 'matplotlib >= 1.5.1'] ) - Example 3 :
from setuptools import setup setup( name = 'PackageName', version = '0.1.0', author = 'An Awesome Coder', author_email = 'aac@example.com', packages = ['package_name', 'package_name.test'], scripts = ['bin/script1','bin/script2'], url = 'http://pypi.python.org/pypi/PackageName/', license = 'LICENSE.txt', description = 'An awesome package that does something', long_description = open('README.txt').read(), install_requires = [ "Django >= 1.1.1", "pytest", ] )
- Put the test file above the package directory, in the root of the project directory.
- Stage, commit, and push all the files you've created.
- Install your package with pip.
pip install .(make sure to include the .)
