Showing posts with label pip. Show all posts
Showing posts with label pip. Show all posts

Sunday, April 1, 2018

Turning your scripts into executables

Sometimes you may want to distribute your python work as a single .exe file.   This post explains how to do it easily with PyScripter.

  • If you do not see “Install packages with pip” under Tools Tools you first need to create a new Tool that helps you to use pip from PyScripter as explained in a separate blog post.
  • Use the pip tool to install pyinstaller.
  • Setup a new tool to use PyInstaller using Tools, Configure Tools, Add and completing the dialog box as shown below:

Capture

  • Open in editor the script and invoke the new tool.  You can watch the pyinstaller output in the Output window.  After a short while and if everything goes smoothly your executable will be ready and can be found in a folder called “dist”, below your script.
  • You could create another tool to easily test the generated executable, but I will leave that as a little challenge.

Tuesday, October 24, 2017

Installing python packages the easy way and checking your code with pylint

The external tools is a powerful feature of PyScripter that is relatively unknown.   Below I describe how you can use it to install python packages easily using pip.

Start PyScripter and select Tools, Configure tools..  In the dialog box select Add.  Fill the following info:

Name : pip
Description: Install python packages
Application: $[PythonExe-Short]
Parameters: $[PythonDir-Short]Lib\site-packages\pip install $[Package?Package Name]

Note:  You can provide the custom parameters in the Application and Parameters fields easily using the Shift-Ctrl-P and Shift-Ctrl-M shortcuts.  For example to get $[PythonExe-Short] press Shift-Ctrl-P, select PythonExe and then press Shift-Ctrl-M and select Short.   See the help file topics External Tools and Parameters for more information.  This is a picture of the result.



Press OK twice to save the tool.   Now it is ready to be used.

Important:  If you are using an "All users" python installation you will need administration rights to install python packages.   Exit PyScripter and run again as administrator (In the start menu right click on PyScirpter and select the "Run as Administrator" option.

Select Tools, Tools tools pip to run the external tool.  You will prompted for a package name.  Type lint and press OK.

You will see the output of the installation process in the Output window.  If the installation is successful pylint will have been installed.

Pylint is a powerful source code checker.  To use it  place the cursor on a python module and select Tools, Tools, pylint.   The issues the pylint finds will be placed in the Messages window as in the example below.  You can click on any message to jump to the corresponding position in the code.



The pip tool will be included in the next version of PyScripter.