top of page
  • Writer's pictureRahul R

How to create a python package for distribution

To create a Python package for deployment to PyPI, you can follow these steps:

  • Choose a name for your package and create a new directory with that name.

  • Inside the package directory, create a file. This file contains metadata about your package, such as its name, version, and author. Here's an example:

from setuptools import setup

    author="Your Name",
    description="A short description of your package",
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
  • Create a file in the package directory. This file should contain a detailed description of your package, along with any usage instructions or examples.

  • Create a LICENSE file in the package directory. This file should contain the text of the license under which you're releasing your package.

  • Write your package code and save it in a Python file or a package directory under the same name as your package.

  • Optionally, include any dependencies your package requires in a requirements.txt file.

  • Build your package by running the following command in the package directory:

python sdist bdist_wheel
  • This will create a source distribution (sdist) and a binary distribution (bdist_wheel) of your package in a dist directory.

  • Upload your package to PyPI by running the following command:

twine upload dist/*

This will upload all the distributions in the dist directory to PyPI.

Once your package is uploaded to PyPI, it can be installed using pip. For example:

pip install mypackage

9 views0 comments

Recent Posts

See All

How to setup reverse proxy on apache2

To set up a reverse proxy to a local installation using Apache2, you need to configure the Apache Virtual Hosts to forward requests to your local server. Here's a step-by-step guide: Enable Proxy Modu

How to Set Up Odoo with Apache Reverse Proxy on Ubuntu

Welcome, adventurous souls, to the whimsical world of Odoo installation! In this zany tutorial, we'll embark on a wild journey to set up Odoo, the beloved open-source ERP software, with an Apache reve

How to Attach S3 to your Django Project

Install Required Packages: Install django-storages package, which provides support for various storage backends including Amazon S3. You can install it via pip: pip install django-storages Configure D


bottom of page