pip_tkinter package

Submodules

pip_tkinter.config module

pip_tkinter.config.find_bit_of_python()[source]

Find whether system is running in 32 bit or 64 bit mode

pip_tkinter.config.get_build_platform()[source]

Get OS of the device Returns ‘Linux’, ‘Windows’ or ‘Darwin’

pip_tkinter.config.get_python_distributions_in_linux()[source]

Return path of Python executables in Linux Related information : PEP 3149 and PEP 3147 For example, Python3.4 may have multiple entries in /usr/bin :

  1. python3.4
  2. python3.4m
  3. python3.4d
  4. python3.4b
  5. python3

Although it is not clear whether they are symlinked, all of them used the same executable when they were tried to be executed

pip_tkinter.config.get_python_distributions_in_macos()[source]

Return path of Python executables in Mac OS Common install locations in python :

  1. /usr/bin/
  2. /usr/local/bin/
  3. /opt/local/bin (Homebrew installation)
pip_tkinter.config.get_python_distributions_in_windows()[source]

Return path of Python executables in Windows. Install locations can be found from windows registry. Possible registry keys :

  1. HKEY_CURRENT_USERSoftwarePython<Company><Tag><InstallPath>
  2. HKEY_LOCAL_MACHINESoftwarePython<Company><Tag><InstallPath>
  3. HKEY_LOCAL_MACHINEWow6432NodePython<Company><Tag><InstallPath>

pip_tkinter.install_page module

class pip_tkinter.install_page.InstallFromAlternateRepo(parent, controller)[source]

Bases: tkinter.ttk.Frame

class pip_tkinter.install_page.InstallFromLocalArchive(parent, controller)[source]

Bases: tkinter.ttk.Frame

abort_installation()[source]

Stop pip installation : Currently not sure to provide option for aborting installation in between

create_entry_form()[source]

Make a labelled frame for entry widget with browse option

create_nav_buttons()[source]

Create back and next buttons

execute_pip_commands()[source]

Execute pip commands

get_file_name()[source]
log_from_install_queue()[source]
navigate_previous_frame()[source]

Navigate to previous frame

update_installation_log()[source]
class pip_tkinter.install_page.InstallFromPyPI(parent, controller)[source]

Bases: tkinter.ttk.Frame

abort_installation()[source]

Stop pip installation : Currently not sure to provide option for aborting installation in between

abort_search_command()[source]

Stop searching for packages

check_search_queue()[source]
create_multitem_treeview()[source]

Create multitem treeview to show search results with headers : 1. Python Module 2. Installed version 3. Available versions

List of buttons : 1. navigate_back 2. navigate_next 3. search_button

create_nav_buttons()[source]

Create back and next buttons

execute_pip_commands()[source]

Execute pip commands

log_from_install_queue()[source]
navigate_previous_frame()[source]

Navigate to previous frame

scroll_tree_select()[source]

If treeview is selected, enable update buttons

show_summary()[source]

Show the details of the selected package

update_installation_log()[source]
update_search_results()[source]

Show search results

class pip_tkinter.install_page.InstallFromPythonlibs(parent, controller)[source]

Bases: tkinter.ttk.Frame

abort_installation()[source]

Stop pip installation : Currently not sure to provide option for aborting installation in between

abort_search_command()[source]

Stop searching for packages

check_search_queue()[source]
create_buttons()[source]

Create back and next buttons, Also creates option menu for selecting compatibility tag

create_multitem_treeview()[source]

Create multitem treeview to show search results with headers : 1. Python Module 2. Installed Version 3. Available Version

List of buttons : 1. navigate_back 2. navigate_next 3. search_button

execute_pip_commands()[source]

Execute pip commands

log_from_download_queue()[source]
log_from_install_queue()[source]
navigate_previous_frame()[source]

Navigate to previous frame

scroll_tree_select()[source]

If treeview is selected, enable update buttons

show_summary()[source]

Show the details of the selected package

sync_pythonlibs_packages()[source]

Sync the json file for PythonLibs at : https://raw.githubusercontent.com/upendra-k14/pythonlibs_modules/master/pythonlibs.json

update_installation_log()[source]
update_search_results()[source]

Show search results

update_sync_messages()[source]
class pip_tkinter.install_page.InstallFromRequirements(parent, controller)[source]

Bases: tkinter.ttk.Frame

abort_installation()[source]

Stop pip installation : Currently not sure to provide option for aborting installation in between

create_entry_form()[source]

Make a labelled frame for entry widget with browse option

create_nav_buttons()[source]

Create ‘back’ and ‘next’ buttons

execute_pip_commands()[source]

Execute pip commands

get_file_name()[source]
log_from_install_queue()[source]
navigate_previous_frame()[source]

Navigate to previous frame

update_installation_log()[source]
class pip_tkinter.install_page.InstallPage(root, controller=None)[source]

Bases: tkinter.ttk.Frame

Manage search and install. Implements GUI for

  1. Search and Install from PyPI
  2. Install from local archive
  3. Install from requirements file
  4. Install from PythonLibs
  5. Install from alternate repository
abort_installation()[source]
create_install_log_frame()[source]
create_message_bar()[source]

Create message bar for printing debug messages for user

create_side_navbar()[source]

Create side navigation bar for providing user with options for selecting different ways of installation

manage_frames()[source]

Manage multiple frames. Creates dictionary of multiple frames to be used for showing user different GUI frames for different ways of installation.

navigate_back()[source]
show_frame(frame_name)[source]
show_task_frame()[source]

pip_tkinter.manage_installed_modules_page module

class pip_tkinter.manage_installed_modules_page.FreezeRequirementsPage(parent, controller)[source]

Bases: tkinter.ttk.Frame

Page for providing options for ‘pip freeze’. User can generate requirement file and save it to desired location

create_buttons()[source]

Create nav and control buttons

create_multitem_treeview()[source]

Create multitem treeview to show search results with headers : 1. Python Module 2. Installed version

execute_pip_commands()[source]

Execute the command for generating requirements file

navigate_previous_frame()[source]

Navigate to previous frame

refresh_installed_packages()[source]

Update list of installed packages

scroll_tree_select()[source]

Update debug bar with number of packages selected

class pip_tkinter.manage_installed_modules_page.ManageInstalledPage(root, controller=None)[source]

Bases: tkinter.ttk.Frame

Manage already installed packages. Implements GUI for

  1. Updating package
  2. Uninstalling package
abort_process()[source]
create_message_bar()[source]

Print debug messages

create_process_log_frame()[source]

Method to create last logging frame to keep the user updated with process. Logs real time output of pip process to tkinter text widget

Parameters:self.task_frame – a tkinter frame to enclose contents
create_side_navbar()[source]

Create side navigation bar for providing user with options for selecting different ways of installation

manage_frames()[source]

Manage multiple frames. Creates dictionary of multiple frames to be used for showing user different GUI frames for different ways of installation.

navigate_back()[source]
show_frame(frame_name)[source]
show_task_frame()[source]
class pip_tkinter.manage_installed_modules_page.UninstallPackage(parent, controller)[source]

Bases: tkinter.ttk.Frame

abort_process()[source]

Stop pip process : Currently not sure to provide option for aborting process in between

create_buttons()[source]

Create back and next buttons

create_multitem_treeview()[source]

Create multitem treeview to show search results with headers : 1. Python Module 2. Installed version 3. Available versions

execute_pip_commands()[source]

Execute pip commands

log_from_uninstall_queue()[source]
navigate_previous_frame()[source]

Navigate to previous frame

refresh_installed_packages()[source]

Show search results

scroll_tree_select()[source]

If treeview is selected, enable update buttons

show_summary()[source]

Show the details of the selected package

update_uninstallation_log()[source]
class pip_tkinter.manage_installed_modules_page.UpdatePackage(parent, controller)[source]

Bases: tkinter.ttk.Frame

abort_process()[source]

Stop pip process : Currently not sure to provide option for aborting process in between

create_buttons()[source]

Create back and next buttons

create_multitem_treeview()[source]

Create multitem treeview to show search results with headers : 1. Python Module 2. Installed version 3. Available versions

execute_pip_commands()[source]

Execute pip commands

log_from_install_queue()[source]
navigate_previous_frame()[source]

Navigate to previous frame

refresh_installed_packages()[source]

Show search results

scroll_tree_select()[source]

If treeview is selected, enable update buttons

show_summary()[source]

Show the details of the selected package

update_installation_log()[source]
update_outdated_packages()[source]

pip_tkinter.pip_extensions module

class pip_tkinter.pip_extensions.GUIListCommand(*args, **kw)[source]

Bases: pip.commands.list.ListCommand

Extending the pip ListCommand to show list of packages :

  1. For uninstall : retrieves list of installed packages with their versions
  2. For update : retrieved list of installed packages which are outdated
get_installed_packages_list()[source]
output_package_listing(installed_packages)[source]
run_outdated(options)[source]
class pip_tkinter.pip_extensions.GUISearchCommand(*args, **kw)[source]

Bases: pip.commands.search.SearchCommand

Inherited the class : pip.commands.search.SearchCommand to override run method

Advantage of inheriting the class is that we can have better control of pip. For example, currently pip search gives output for latest version. But, we can retrieve output for all available versions.

Another advantage is that search can now be done with less time lag as compared to pip.main().

get_search_results()[source]

This code is taken from pip.commands.search.print_results(). It is modified to return results in dictionary format instead of printing results For all the search results obtained, we can check if a package is already installed or not. If installed then the version of installed package is found and stored.

run(options, args)[source]
class pip_tkinter.pip_extensions.GUIShowCommand(*args, **kw)[source]

Bases: pip.commands.show.ShowCommand

Parent class : pip.commands.show.ShowCommand

get_package_details()[source]
run(options, args)[source]
save_results(distributions, list_all_files)[source]
pip_tkinter.pip_extensions.runpip(argstring)[source]

Run pip with argument string containing command and options.

Parameters:argstring – is quoted version of what would follow ‘pip’ on command line.

pip_tkinter.utils module

class pip_tkinter.utils.MultiItemsList(parent, headers_list=None)[source]

Bases: object

Class for creating Treeview to show list of packages : provides options for selecting items and specifying number of headers for the treeview

create_headers()[source]

Specifies headers and width of header columns for the treeview

create_treeview()[source]

Create a multi items list consisting of a frame, horizontal and vertical scroll bar and Treeview

headers_list = None

headers_list: list of headers or fields in treeview

items_list = None

self.items_list: list of items for treeview

parent = None

parent: parent frame for treeview

populate_rows(items_list=None)[source]

Populate treeview with list of items

Parameters:items_list – list of items by which treeview is populated
scroll_tree = None

self.scroll_tree: tkinter treeview variable

class pip_tkinter.utils.Redirect(stdfile, new_target)[source]

Bases: object

Context manager for temporarily redirecting stdout/err. Simplified and generalize from contextlib.redirect_stdout. (DEPRECATED)

class pip_tkinter.utils.RunpipSubprocess(argstring, output_queue)[source]

Bases: object

Run pip with argument string containing command and options. Uses subprocess module for executing pip commands. Logs real time output in output queue.

In output queue a tuple object is sent consisting of two elements:

  • Output code : For identification of purpose of message

    Code Purpose 0 Start marker for logging output to tkinter text widget 1 Output message 2 Error message 3 End marker for logging output to tkinter text widget

  • Message : a string variable containing the string collected from stdout and stderr streams

geterror()[source]

Iterate over error line by line

getoutput()[source]

Iterate over output line by line

start_logging_threads()[source]

Starts logging to output and error queue

pip_tkinter.utils.create_resource_directory()[source]

Create resource directory if not there

pip_tkinter.utils.downloadfile(url, update_queue)[source]

A utility function to download file in small chunks and also to return download percentage

Code Purpose 0 Start marker for logging output 1 Output message 2 End marker for logging output 3 Error message

pip_tkinter.utils.pip_freeze_command()[source]

Generate requirements

pip_tkinter.utils.pip_install_from_PyPI(package_args=None, install_queue=None)[source]

Wrapper for installing pip package from PyPI

pip_tkinter.utils.pip_install_from_alternate_repo(package_args)[source]

Wrapper for installing pip package from Pythonlibs

pip_tkinter.utils.pip_install_from_local_archive(package_args, install_queue=None)[source]

Wrapper for installing pip package from local Archive

pip_tkinter.utils.pip_install_from_pythonlibs(package_url, install_queue=None)[source]

Install from pythonlibs packages in two steps :

  1. Download file
  2. Use pip install to install file
pip_tkinter.utils.pip_install_from_requirements(package_args, install_queue=None)[source]

Wrapper for installing pip package from requirements file

pip_tkinter.utils.pip_list_command()[source]

Lists all installed packages

pip_tkinter.utils.pip_list_outdated_command()[source]

Lists all outdated installed packages

pip_tkinter.utils.pip_search_command(package_name=None, thread_queue=None)[source]

Uses subprocess to retrieve results of ‘pip search’

pip_tkinter.utils.pip_show_command(package_args)[source]

Show details of a installed package

pip_tkinter.utils.pip_uninstall(package_args, uninstall_queue=None)[source]

Uninstall packages

pip_tkinter.utils.pythonlibs_search_command(package_name=None, thread_queue=None)[source]

Search for packages in Pythonlibs packages record Convention for results tuple :

Each element of tuple consists of following elements in order: 1. package name 2. version 3. summary 4. home page 5. last updated 6. This element consists of distribution specific information. For more details continue below :

For each package in json format there are different possible distributions depending on compatibility tags like : py2, py3, cp27, cp34 and system architecture. Therefore sixth element is list of available distributions with following elements in order :

  1. compatibility_tag
  2. package_size
  3. architecture

For example :

``` “ViTables”: [

{
“last_updated”: “Dec 25, 2014”, “compatibility_tag”: “py2-none”, “summary”: “ViTables , a GUI for browsing and editing files in PyTables and HDF5 formats.”, “package_size”: “329 KB”, “home_page”: “http://vitables.org/”, “version”: “2.1”, “url”: “http://www.lfd.uci.edu/~gohlke/pythonlibs/6kbpejrn/ViTables-2.1-py2-none-any.whl”, “architecture”: “any”

}, {

“last_updated”: “Dec 25, 2014”, “compatibility_tag”: “py3-none”, “summary”: “ViTables , a GUI for browsing and editing files in PyTables and HDF5 formats.”, “package_size”: “328 KB”, “home_page”: “http://vitables.org/”, “version”: “2.1”, “url”: “http://www.lfd.uci.edu/~gohlke/pythonlibs/6kbpejrn/ViTables-2.1-py3-none-any.whl”, “architecture”: “any”

}

pip_tkinter.utils.runpip(argstring)[source]

Run pip with argument string containing command and options.(DEPRECATED and replaced with runpip_using_subprocess method)

Parameters:argstring – is quoted version of what would follow ‘pip’ on command line.
pip_tkinter.utils.runpip_using_subprocess(argstring)[source]

Run pip with argument string containing command and options. Uses subprocess module for executing pip commands. Returns output and error once execution of process terminates

Parameters:argstring – is quoted version of what would follow ‘pip’ on command line.
pip_tkinter.utils.verify_pypi_url()[source]

Check if URL can be accessed

pip_tkinter.welcome_page module

class pip_tkinter.welcome_page.WelcomePage(root, controller)[source]

Bases: tkinter.ttk.Frame

Ask user about what to do : 1. Install 2. Uninstall or Update

create_welcome_page()[source]

Add content to welcome page and radio buttons for selecting among two tasks :

  1. Search and Install Package
  2. Manage already installed packages
navigate_next_frame()[source]

Navigate to next frame in response to event generated by the next button

Module contents