pax_global_header 0000666 0000000 0000000 00000000064 14716541031 0014514 g ustar 00root root 0000000 0000000 52 comment=56db4da2f4e8c78fa67ba7e72390e267655a0cd1
pyshortcuts-1.9.5/ 0000775 0000000 0000000 00000000000 14716541031 0014137 5 ustar 00root root 0000000 0000000 pyshortcuts-1.9.5/.github/ 0000775 0000000 0000000 00000000000 14716541031 0015477 5 ustar 00root root 0000000 0000000 pyshortcuts-1.9.5/.github/dependabot.yml 0000664 0000000 0000000 00000000766 14716541031 0020340 0 ustar 00root root 0000000 0000000 # To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
pyshortcuts-1.9.5/.github/workflows/ 0000775 0000000 0000000 00000000000 14716541031 0017534 5 ustar 00root root 0000000 0000000 pyshortcuts-1.9.5/.github/workflows/test-macos.yml 0000664 0000000 0000000 00000001314 14716541031 0022335 0 ustar 00root root 0000000 0000000 name: test, macos
on: [push]
jobs:
build:
runs-on: macos-latest
strategy:
max-parallel: 5
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v2
- name: Set up Python from Miniconda
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
echo '### which python:'
which python
echo '### printev:'
printenv
echo '###'
python -m pip install --upgrade pip
python -m pip install ".[all]"
- name: Run test suite
run: |
cd tests
pytest
pyshortcuts-1.9.5/.github/workflows/test-ubuntu.yml 0000664 0000000 0000000 00000001323 14716541031 0022555 0 ustar 00root root 0000000 0000000 name: test, ubuntu
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v2
- name: Set up Python from Miniconda
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
echo '### which python:'
which python
echo '### printev:'
printenv
echo '###'
python -m pip install --upgrade pip
python -m pip install ".[doc,test]"
- name: Run test suite
run: |
cd tests
pytest
pyshortcuts-1.9.5/.github/workflows/test-windows.yml 0000664 0000000 0000000 00000001320 14716541031 0022722 0 ustar 00root root 0000000 0000000 name: test, windows
on: [push]
jobs:
build:
runs-on: windows-latest
strategy:
max-parallel: 5
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v2
- name: Set up Python from Miniconda
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
echo '### which python:'
which python
echo '### printev:'
printenv
echo '###'
python -m pip install --upgrade pip
python -m pip install ".[all]"
- name: Run test suite
run: |
cd tests
pytest
pyshortcuts-1.9.5/.gitignore 0000664 0000000 0000000 00000000163 14716541031 0016127 0 ustar 00root root 0000000 0000000 *.py[cod]
build/
dist/
eggs/
.eggs/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
doc/_build/
pyshortcuts/version.py
pyshortcuts-1.9.5/LICENSE 0000664 0000000 0000000 00000002130 14716541031 0015140 0 ustar 00root root 0000000 0000000 The MIT License
Copyright (c) 2018-2024 Matthew Newville, The University of Chicago
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXP80RESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE qUSE OR OTHER DEALINGS IN THE
SOFTWARE.
pyshortcuts-1.9.5/MANIFEST.in 0000664 0000000 0000000 00000000543 14716541031 0015677 0 ustar 00root root 0000000 0000000 include README.md LICENSE MANIFEST.in setup.py setup.cfg pyproject.toml
include doc/pyshortcutgui_screenshot.png
exclude *.pyc core.* *~ *.pdf
recursive-exclude pyyshortcuts/__pycache__ *
recursive-exclude pyshortcuts *.pyc
recursive-include pyshortcuts *.py
recursive-include pyshortcuts/icons *
recursive-include examples *
recursive-include tests *.py
pyshortcuts-1.9.5/README.md 0000664 0000000 0000000 00000022506 14716541031 0015423 0 ustar 00root root 0000000 0000000 [](https://github.com/newville/pyshortcuts/actions/workflows/test-ubuntu.yml)
[](https://github.com/newville/pyshortcuts/actions/workflows/test-windows.yml)
[](https://github.com/newville/pyshortcuts/actions/workflows/test-macos.yml)
[](https://pypi.org/project/pyshortcuts)
[](https://pypi.org/project/pyshortcuts)
Install `pyshortcuts` with
```
pip install pyshortcuts
```
Full documentation is at: [Pyshortcuts Documentation](https://newville.github.io/pyshortcuts/)
# Table of contents
1. [Pyshortcuts Overview](#about)
1. [Installation](#installation)
2. [Usage from Python](#frompytho)
3. [`pyshortcut` command-line program](#cli)
4. [Making a shortcut for single python command](#pycmd)
5. [Note for running wxPython GUIs on macOS with Anaconda Python](#wxapps_macos)
6. [`pyshortcut` graphical user interface](#wxgui)
## Pyshortcuts Overview
Pyshortcuts helps Python developers and users create shortcuts that will run
python scripts and other applications. The shortcuts created can go onto the
users desktop or into the Start Menu (for systems with Start Menus) or both.
Pyshortcuts gives a consistent interface for building shortcuts that run on
Windows, macOS, and Linux in the way that is most natural for each OS.
On Windows, a Shortcut Link is created and placed on the users Desktop and in
the Start Menu. On macOS, a minimal but complete Application is created and
placed on the users Desktop. On Linux a ".desktop" file is created and placed
on the users Desktop (if that exists) and in $HOME/.local/share/applications
(if that exists), which will often get presented in a Start Menu for windowing
desktop themes that use a one. On all platforms, the shortcuts created on the
Deskop or Start Menu can be put either directly onto the Desktop / Start Menu
or in a sub-folder of the Desktop / Start Menu. Shortcuts can have a custom
icon (`.ico` files on Windows or Linux, or `.icns` files on macOS) specified,
defaulting to a Python icon included with pyshortcuts.
By writing only to the users Desktop or application folder that gets read by
the Start Menu, there is no need for elevated permission and no writing to
system-level files (registry entries, /Applications, /usr/bin, etc). After the
shortcut has been created, the end user has complete control to rename, move,
or delete it.
Pyshortcuts is pure python, small, readily installed, and easy to use from a
the command-line or from Python scripts. This means that Pyshortcuts can be
made part of an installation (or post-installation process) process for larger
packages.
Special attention is given to Anaconda Python on Windows. For that
environment, the shortcut created will be sure to run in an Anaconda
environment, explicitly selecting the "base" environment even if that has not
been explicitly set by the user.
## installation
To install `pyshortcuts`, use
```
pip install pyshortcuts
```
On Windows, pyshortcuts requires the pywin32 package and will be installed
if needed. There are no depenendencies on macOS or Linux.
In order to use the pyshortcut GUI, the wxPython package is required.
## Usage from Python
Shortcuts can be created from a Python script with
```python
from pyshortcuts import make_shortcut
make_shortcut('/home/user/bin/myapp.py', name='MyApp', icon='/home/user/icons/myicon.ico')
```
The arguments to the `make_shortcut` function are:
* `script` (str) scipt or command to be run. This can include command-line arguments
* `name` (str or None) name to use for shortcut [defaults to script name]
* `description` (str or None) longer description of script [defaults to `name`]
* `icon` (str or None) path to icon file [defaults to python icon]
* `folder` (str or None) folder on Desktop to put shortcut [defaults to Desktop]
* `terminal` (bool) whether to run in a Terminal [True]
* `desktop` ((bool) whether to add shortcut to Desktop [True]
* `startmenu` (bool) whether to add shortcut to Start Menu [True]
* `executable` (str or None) name of executable to use [this Python]
Note that the Start Menu does not exist for macOSX.
The `executable` defaults to the version of Python executable used to make shortcut.
## `pyshortcut` command-line program
Pyshortcuts installs a `pyshortcut` command-line program for creating a shortcut.
From a shell or Command window with PATH set to include python programs and scripts,
a command to create a shortcut might look like:
```
~> pyshortcut -n MyApp -i /home/user/icons/myicon.icns /home/user/bin/myapp.py
```
To include command-line options for the script, put them in double quotes
```
~> pyshortcut -n MyApp -i /home/user/icons/myicon.icns "/home/user/bin/myapp.py -t 10"
```
The `pyshortcut` command line program has a form of
```
pyshortcut [-h] [-v] [-n NAME] [-i ICON] [-f FOLDER] [-e EXE] [-t] [-g] [-d] [-s] [-w] [scriptname]
```
where `scriptname` is the name of the script. To include arguments to that
script, enclose the script name and arguments in quotes (double quotes on
Windows).
There are several optional arguments:
* `-h`, `--help` show help message and exit
* `-v`, `--version` show program's version number and exit
* `-n NAME`, `--name=NAME` name for shortcut
* `-i ICON`, `--icon=ICON` name of icon file
* `-f FOLDER`, `--folder=Folder` subfolder on desktop to put icon
* `-e EXE`, `--executable EXE` name of executable to use (python)
* `-t`, `--terminal` run script in a Terminal Window [True]
* `-g`, `--gui` run script as a GUI, with no Terminal Window [False]
* `-d`,` --desktop` create desktop shortcut [True]
* `-s`, `--startmenu` create Start Menu shortcut [True]
* `-w`, `--wxgui` run GUI version of pyshortcut
* `-b`, `--bootstrap` create a desktop shortcut to run GUI version of pyshortcut
Note that running in the Terminal is True by default, which means that each
time the shortcut is used to launch the application, a new Terminal or Command
window will be created for it. For many command-line applications, this is
appropriate. The extra Terminal or Command window may be unwanted for some GUI
applications, and can be disabled with the `-g` or `--gui` option.
## Making a shortcut for single python command
A common request and simple use-case for `pyshortcuts` is to wrap a single
python command. An example of this might look like this:
```
import sys
from pyshortcuts import make_shortcut
pycmd = "_ -m pip install --upgrade pyshortcuts"
make_shortcut(pycmd, name='Update Pyshortcuts')
```
Note that using `_` or `{}` as the command name will indicate that the
current Python executable should be be used. An example that includes
an icon is given in the examples folder.
The above could be done from the command line with
```
~> pyshortcut -n "Update Pyshortcuts" "_ -m pip install pyshortcuts"
```
## Note for running wxPython GUIs on macOS with Anaconda Python
If your application uses wxPython and you are running with Anaconda Python on
macOS, you may experience problems that your application does not start. If
you try to run your script from the command line, you may see the following
error message:
```
~> python my_wxpython_app.py
This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.
```
If you do see that, it can be fixed and your script run properly by adding
```
import wx
wx.PyApp.IsDisplayAvailable = lambda _: True
```
in your script before runnig your starting the `wxPython` `mainloop` event handler.
## `pyshortcut` GUI
In addition to the `pyshortcut` command-line program, there is a small GUI
application that provides a simple form to help the user browse for script
and icons, and set options before creating a shortcut or generating an
example Python script to create the shortcut.

This requires the `wxPython` package which can be installed using `pip` or
`conda` but is not automatically installed when installing `pyshortcuts`.
This application can be launched from the command line with
```
~> pyshortcut --wxgui
```
Of course, that command might be the sort of command you might want to be able
to launch by clicking on a desktop shortcut. We have just the tool for that! Doing
```
~> pyshortcut --bootstrap
```
will create a desktop shortcut with an icon of a ladder that will launch
the pyshortcut GUI. This essentially runs
```python
#!/usr/bin/env python
import os
import sys
from pyshortcuts import make_shortcut, platform
bindir = 'Scripts' if platform.startswith('win') else 'bin'
pyshortcut = os.path.normpath(os.path.join(sys.prefix, bindir, 'pyshortcut'))
scut = make_shortcut(f"{pyshortcut:s} --wxgui", name='PyShortcut', terminal=False)
```
The ladder icon was made by Left Martinez, and downloaded from
(https://www.iconfinder.com/iconsets/free-construction-tools)
pyshortcuts-1.9.5/doc/ 0000775 0000000 0000000 00000000000 14716541031 0014704 5 ustar 00root root 0000000 0000000 pyshortcuts-1.9.5/doc/Makefile 0000664 0000000 0000000 00000002751 14716541031 0016351 0 ustar 00root root 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
INSTALLDIR = /home/newville/public_html/pyshortcuts
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: html pdf all help clean dirhtml latex
all:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
pdf: latex
cd $(BUILDDIR)/latex && make all-pdf
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " pdf pdf from latex version"
@echo " all html, pdf, and doc.zip"
@echo " clean to remove all output"
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
@echo
@echo "Build finished; the LaTeX files are in _build/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
@echo "Running LaTeX files through pdflatex..."
make -C _build/latex all-pdf
@echo "pdflatex finished; the PDF files are in _build/latex."
clean:
-rm -rf _build/*
pyshortcuts-1.9.5/doc/_static/ 0000775 0000000 0000000 00000000000 14716541031 0016332 5 ustar 00root root 0000000 0000000 pyshortcuts-1.9.5/doc/_static/pyshortcutgui_screenshot.png 0000664 0000000 0000000 00001005055 14716541031 0024234 0 ustar 00root root 0000000 0000000 PNG
IHDR i IiCCPICC Profile HWXS[RIhH RK E*I ĐD.*v*Z Y+ZZ(bʛX{;79sJ;N
O*Euȓ#BXRX. QǗKqq rE*z q@σ x _*+ 3J<bLbgqgq&1n 4Ov3Գ
YGĮX@'8Qyy3xƙ1e
cu-*!\ެ[rC1ࠉdʚan̈RbĽX!~/!F"Ed59g )ܘh>#S΅H\M.45C8Sak|x2U\iEN[K$)%sƨ!fs6M3d#S+O(Qc2e{Y|^lH̍Qbg7f4#OE
S%IzNiAH47NcSJĦ/X %3yE p@(``ަ^K=x@h4C) &bDB Q
A!֪. S5[!Q V$ђ##:r:6Dk4!^ΐ%1J$q<ǣ5w/{cB!:p{xzX`55g|]3nY=<