Trusted answers to developer questions
Trusted Answers to Developer Questions


What is

Shittu Olumide Ayodeji


This shot will discuss an important question: What is , and why is it essential in Python programming?

Every programming language has a distinct and unique method for installing packages from the source. can help developers manage the dependencies of their packages in a way that allows them to redistribute them easily.

This shot will talk about the primary usage of, the keywords used in the file, how to write the first file, and deploying your package to the public.

The file is a Python file which indicates that the installation module/package is most likely packed and distributed using Distutils, the Python Module distribution standard. It specifies the contents of a module to Distutils so that it may execute the appropriate actions (such as locating dependencies) during the module’s first installation. The is a Python script typically included with Python-written libraries or apps. Its objective is to ensure that the program is installed correctly.

This also allows to install python packages with ease using:

python install 


$ pip install 

With the aid of pip, we can use the to install any module without having to call directly. The is a standard Python file. It can have any name, but by convention, it is named so that each script does not have a separate method.

Use of

The file may be the most significant file that should be placed at the root of the Python project directory. It primarily serves two purposes:

  1. It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on.
  2. Secondly, it serves as the command line interface via which packaging commands may be executed.

Keywords in

Examples of some keywords used when calling the setup() method:

  1. name: A string containing the package’s name.
  2. version: A string containing the package’s version number.
  3. description: A single-line text explaining the package.
  4. author: A string identifying the package’s creator/author.
  5. long_description: A string containing a more detailed description of the package.
  6. maintainer: It's a string providing the current maintainer’s name, if not the author. If the maintainer is not given, the author in PKG-INFO will be utilized by the setup tools.
  7. url: A string providing the package’s homepage URL (usually the GitHub repository or the PyPI page).
  8. download_url: A string containing the URL where the package may be downloaded.
  9. package_data: This is a dictionary where the keys are package names and the values are lists of glob patterns.
  10. py_modules: A string list containing the modules that setup tools will modify.
  11. python_requires: This is a comma-separated string providing Python version specifiers for the package’s supported Python versions.
  12. install_requires: A string list containing only the dependencies necessary for the package to function effectively.
  13. keywords: A comma-separated string or string list providing descriptive meta-data.
  14. entry_points: This is a dictionary with keys corresponding to entry point names and values corresponding to the actual entry points stated in the source code.
  15. license: A string containing the package’s licensing information.

You can find a comprehensive list of the keywords here, in the official documentation.

How to write the first script

The setup file may include only a few lines of code.

from distutils.core import setup

      description='Python Distribution Utilities',
      author='Greg Ward',
      packages=['distutils', 'distutils.command'],

Alternatively, it may include more sophisticated lines of code with more information.

from setuptools import setup
    author='Bejamin Frakline',
    description='A brief synopsis of the project',
    long_description='A much longer explanation of the project and helpful resources',
    keywords='development, setup, setuptools',
    python_requires='>=3.7, <4',
    packages=find_packages(include=['exampleproject', 'exampleproject.*']),
        'sample': ['sample_data.csv'],
        'runners': [

Deploying the file

Finally, we're ready to post the package to so that others may use pip install yourpackage to install it. Using these two procedures, we may deploy the file.

  1. Step 1: First, we publish it on the temporary server. Next, we publish it on the permanent server for the public to utilize the package.
  2. Step 2: We follow this step when we've the login credentials and are familiar with the technique. We may publish right immediately on the permanent server (e.g., username, password, package name).


We've discussed how to use file in Python to handle package dependencies and ease package distribution. We also discussed the basic purpose of, the keywords used in files, creating the first file, and publishing the package for public use.

Please note that the Python’s package distribution requirements are always developing, most notably in the last few years, so make sure to stay up to speed and follow best practices on a regular basis.



Shittu Olumide Ayodeji

View all Courses

Keep Exploring

Learn in-demand tech skills in half the time

Copyright ©2022 Educative, Inc. All rights reserved.