This topic describes common tasks you can perform with Python projects.
To perform this task |
Follow these steps |
Create New Project |
- In the IDE go to File > New Project > Python Project
- Under Categories select Python, under Projects select Python Project
- For Name and Location you must do the following:
- Project Name. Specify the name of the project. This name is also used to create the project directory.
- Project Location. Specify the location of the directory where you want to store the project metadata and source code.
- Set as Main Project. Set the newly created project as the main project if desired.
- Create Main File. Specify the name of the main file if needed.
- Python Platform. Select the Python platform to use for your project.
- Click Finish and the project is created and opened in both the Projects and Files windows.
|
Create New Project from Existing Sources |
- In the IDE go to File > New Project > Python Project with Existing Sources
- In the Name and Location page, you have to set the following properties:
- Project Name. Specifies the display name of the project. This name is also used to create the project folder.
- Project Location. Specifies the folder where you want to store the project metadata and source code.
- Set as Main Project. Sets the newly created project as the main project.
- Python Platform. You can select the Python platform to use for your project.
- In the Existing Sources page, you have to set the following properties:
- Source Root Folders. Specify the root directory of the existing sources.
- Test Root Folders. Specify the root directory of the existing tests.
- When you click Finish, the project is created on your computer and opened in both the Projects and Files windows.
|
Running Python Applications |
- To run a project, right-click the project node in the Projects window and choose Run. (or F6 to run the Main Project).
- To Run a file, click on the file name in the Projects window and choose Run > Run File.
|
Debugging Python Applications |
- Go to Tools > Options, click Python, then the Debugger tab.
- Set the Debugger listening starting port.
- Use the default Debugging shell colors and fonts, or modify as you prefer.
- Leave Stop at First Line checked to stop the debugger script after one line, or uncheck the box and the debugger
will stop at the first found breakpoint in script.
- Set breakpoints in the Source Editor by clicking in the left margin next to the line of code where you want to set a breakpoint.
For additional details please see Debugging Python Applications.
|
Adding New Python Modules |
- Right-click on the project node and choose New > Empty Module.
- In the Name and Location page, set the following properties:
- File Name. Name of the new module
- Project. The project that this module will be added to.
- Folder. The directory which you want the module to be created.
- Click Finish and the new module is added to the project with a default code template.
|
Adding New Python Packages |
- Right-click the Project node and choose New > Python Package
- In the Name and Location page, you have to set the following properties:
- File Name. Name of the package.
- Project. The project that this module will be added to.
- Folder. The directory which you want the module to be created.
- When you click Finish, the package is added to the project with a default file already added.
|
Using the Python Interactive Console |
- Go to Window > PythonConsole.
- Add the Python script you wish to run to the Python Interactive Console window.
- Click the green Run button on the left border of the output window to Run the script.
|
Managing Python Platforms |
In the IDE go to Tools > Python Platforms. The Python Platform Manager enables you to do the following:
- Add and Remove Platforms.
- Specify which Python runtime, CPython or Jython, to use as a default.
- Choose which CPython is used.
- Specify values for command line arguments.
- Set, Add and Remove Global Python Path variables.
- Set, Add and Remove Java Classpath variables.
|