Easy cross-platform creation of shortcuts supporting virtual and Anaconda environments (fork of Shortcut)
Shortcutter is a cross platform API for creating shortcuts for python applications meant to be used in setup.py script or as a command line application (fork of the Shortcut).
Shortcutter creates shortcucts that activate python environment prior launching the app (activation can be disabled if needed). It supports virtual environments, Anaconda/Miniconda, conda environments,
sudo pip install,
pip install --user. Shortcutter will do its best to find your app, searching for the usual suspects in the usual places (i.e. those in the PATH), or you can give it a full path.
Shortcutter is intended to be used for click/drag'n'drop usage of shortcuts only. Hence do not call/source shortcutter wrapper scripts. If you need executable wrappers from activated environments see exec-wrappers.
But do not call/source them either - use
"%COMSPEC%" /c ".\path\to\execwrapper.bat" arg (
call path-cmd.bat execwrapper arg if it's in the PATH; see this) on Windows and
"./path/to/execwrapper" arg on Unix (
execwrapper arg if it's in the PATH).
Additioanlly special command/method can create shortcut to the terminal at activated environment (plus terminal shortcut at conda root). In case of Windows special env vars
%a% defined that switch encodings and
%b% var that sets UTF-8 encoding and starts Bash.
To create desktop and menu shortcuts for
- Using the app:
shortcutter python shortcutter --terminal
- Using the Python API for example in
from shortcutter import ShortCutter sc = ShortCutter() sc.create_desktop_shortcut("python") sc.create_menu_shortcut("python") sc.create_shortcut_to_env_terminal()
It was created to solve a simple problem - if you install a python package using
pip there is no simple way of creating a shortcut to the program it installs.
Shortcuts without entry points (for GUI)
The default use-case for Shortcutter is to create shortcuts for entry-points executables auto created by setup.py or conda. But sometimes such entry-points do not work (like when using pythonw on macOS with python.app package). See example how to work-around this: Enaml video app (the main idea is in bash script).
Table of contents
- Command line interface
- Python API
- Operating Systems
- Change log
Shortcut is available on pypi and can be installed using
- Using Anaconda/Miniconda:
conda install -c defaults -c conda-forge shortcutter
- Using pip:
pip install shortcutter
- System Python 3 on macOS or Linux:
pip3 install shortcutter
pip3 install --user (simply
pip3 install on Ubuntu) then you might need to add
%APPDATA%\Python\Python36\Scripts (on Windows) /
~/.local/bin (on Linux) to the PATH.
Shortcutter should work on Python 2 or can easily be bugfixed if you post an issue.
Command line interface
--help option will display the help:
usage: shortcutter [-h] [-d] [-m] [-n [NAME]] [-s] [-t] [target] Automatic shortcut creator. Shortcuts auto-activate their environments by default. positional arguments: target The target executable to create Desktop and Menu shortcuts. optional arguments: -h, --help show this help message and exit -d, --desktop Only create a desktop shortcut. -m, --menu Only create a menu shortcut. -n [NAME], --name [NAME] Name of the shortcut without extension (autoname otherwise). -s, --simple Create simple shortcut without activate wrapper. -t, --terminal Create shortcut to environment with shortcutter (plus shortcut to root environment in case of conda).
Shortcut support Windows, macOS and Linux.
The way shortcuts are provide and applications launched depends on the operating system.
.lnk files pointing directly to the application paths are created in the User Desktop and Programs folders.
macOS applications are created which run the application via a terminal and copied to the User Desktop (
~/Desktop) and Launchpad (
.desktop files are created which start the application via the shell and created in the User Desktop and applications menu (
Alpha - tested and works but issues maybe experienced and API changes are possible.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size shortcutter-0.1.21.tar.gz (31.0 kB)||File type Source||Python version None||Upload date||Hashes View|