Create and run setup.py
PyCharm provides an action that helps create setup.py script, intended for building, distributing, and installing modules. Once setup.py is created, the corresponding action becomes disabled
Create setup.py
In the Project tool window, select the package. Then, from the main menu, select .
In the New Setup Script dialog, specify package name, its version, the author, the author email, the package description, and any licence details:
Click OK when ready. PyCharm creates setup.py and opens it in the editor.
Note that PyCharm creates the setup.py file with the limited set of the arguments. You might want to manually add the rest of the needed details. Refer to the Python Packaging User Guide for more details about setup.py arguments.
When you work with any project that comes setup.py, you can run some tasks to build, install, and distribute packages described within the setup.py file. PyCharm helps you create the command-line sequence of the following format:
setup.py <task> <arguments>
Run a setup.py task
From the main menu, select
.In the Enter setup.py task name dialog, type the letters of the task names.
Note that asterisk wildcard and initial letters of the snake_case names are honored. As you type, the suggestion list shrinks to show the matching names only. Choose the desired task, and press Enter.
In the Command Line field, enter the argument of the task to execute.
You can leave this field empty if no arguments are needed.
Once you click OK, the command line begins to execute in the Run tool window.
For more information about the setup.py command arguments, see Building and Distributing Packages with Setuptools.