

Inside that package directory, alongside your python files, create a file called _init_.py. Most often this has the same name as the project (this is not compulsory but makes things a bit simpler). Somewhere inside this will be included a directory which will constitute the main installable package. In most cases the context should be sufficient to make the distinction.Ī Python project will consist of a root directory with the name of the project. Such a package may consist of multiple python package/sub-packages. It can also mean a distribution package which refers to the entire distributed part of the project (as in a source distribution - or “tarball”). Note on Ambiguity: The term package can refer to an installable python package within a project (a directory containing an _init_.py file). This article gives an overview of how to create an installable Python package. Installing pip is easy: Creating a Python package '/home/shudson/miniconda3/lib/python3.6/site-packages/mpi4py/_init_.py' It is the most common way to install Python packages. Pip is a package management system, specifically designed for installing Python packages from from the internet hosted Python Package Index (commonly known as PyPI). Note: PyPI should be pronounced “pie P I” to avoid confusion with pypy (a Python implementation). All but the final section (Uploading to PyPI), can be undertaken as an exercise to understand Python packaging and test the process, without publishing a package on the formal PyPI distribution.įor a more detailed reference on package creation, see the official Python Packaging Authority (PyPA) website. The document is broken down into sections so that readers may easily skips parts of the process they are already familiar with. This is a quickstart guide to Python Packaging with a particular focus on the creation of a PyPI package, which will enable users to “pip install” the package. Python: Creating a pip installable package
