Skip to main content

Alfred Workflow Packager

Copyright 2016-2024 Caleb Evans
Released under the MIT license

Alfred Workflow Packager is a command-line utility which makes the process of packaging and exporting an Alfred workflow incredibly quick and easy. The utility supports Alfred 3 and up, on projects running Python 3 (Python 2 is no longer supported).

Setup

You can install the utility via pip3, either globally or within a virtualenv:

pip3 install alfred-workflow-packager

Usage

1. Create configuration file

Once you've installed AWP, you must configure it for every project where you wish to use it. To do so, create a packager.json file in the root directory of your project; this file configures AWP for that particular project.

Example

{
  "export_files": [
    "Fruit.alfredworkflow"
  ],
  "bundle_id": "com.yourname.fruit",
  "readme": "README.txt",
  "resources": [
      "icon.png",
      "src/*.py",
      "src/data/*.json"
  ]
}

Required settings

export_files

The paths of the exported workflows (relative to your project directory).

bundle_id

The unique bundle ID of your workflow. You must have one set in the installed workflow, or AWP will not be able to find your workflow when packaging.

resources

A list of zero or more files/folder patterns representing files or folders to copy from your project to the installed workflow. The directory structures and filenames are preserved when copying.

Local project:

- icon.png
- fruit
    - apple.py
    - banana.applescript
    - orange.php

Installed workflow (before running utility):

- info.plist
- special_file.json

packager.json resources:

[
    "icon.png",
    "fruit/*.json"
]

Installed workflow (after running utility):

- info.plist
- icon.png
- special_file.json
- fruit
    - apple.py
    - banana.applescript
    - orange.php

Note that files and folders already present in the installed workflow are not touched if they are not in the resources list.

Optional settings

readme

The path to the README file to use for this workflow; the About this Workflow field in your workflow is populated with the contents of this file.

2. Run utility

You can run the utility via the awp command:

awp

Running awp will copy those project resources listed in packager.json to the installed workflow (in their respective locations), but only if their contents or permissions have changed. If you ever need to ignore this equality check, you can force the copying of all files/directories by passing --force / -f.

awp --force
awp -f

Setting the workflow version

Passing the --version option (also -v) to awp allows you to set the version of the installed workflow directly. I highly recommend using semantic versioning to version your workflow releases.

awp --version 1.2.0
awp -v 1.2.0

Exporting the workflow

When you're pleased with your work and you're ready to publish a new release, you can export the installed workflow to your project directory by passing the --export flag (or -e) to awp.

awp --export
awp -e

Note that you can set the version and export the workflow simultaneously:

awp -v 1.2.0 -e

New in AWP v1.1.0: If you wish to temporarily export the workflow to a different file (different from export_files in packager.json), you can pass one or more optional paths to --export:

awp -v 1.3.0-beta.1 -e ~/Desktop/fruit-beta-alfred-5.alfredworkflow

4. Configure workflow objects

The last important step is to update any script objects in your workflow (i.e. objects of type Script Filter, Run Script, etc.) to reference the files copied to the installed workflow directory.

You should set the Language to /bin/bash and use the appropriate shell command to call your script. Use "$@" if your input is passed as argv, or "{query}" if your input is passed as {query}.

Python

/usr/bin/python3 -m fruit.apple "$@"
/usr/bin/python3 -m fruit.apple "{query}"

AppleScript

/usr/bin/osascript fruit/banana.applescript "$@"
/usr/bin/osascript fruit/banana.applescript "{query}"

PHP

/usr/bin/php fruit/orange.php "$@"
/usr/bin/php fruit/orange.php "{query}"

Metadata

Release files for alfred-workflow-packager 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alfred-workflow-packager 3.1.1
File Size Uploaded
alfred-workflow-packager-3.1.1.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alfred-workflow-packager 3.1.1
File Interpreter ABI Platform
alfred_workflow_packager-3.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / alfred-workflow-packager-3.1.1.tar.gz

Download URL alfred-workflow-packager-3.1.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
37b95f1ede430fb8255f2ecf28a9fa538f02a73e6adf1bcf1f8ad756e6e2cb75
BLAKE2b-256 checksum
How to use checksums
61134b32b5144599f0d3e0c8219670a292f353abbd14474ab9681e8a0935c2ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / alfred_workflow_packager-3.1.1-py3-none-any.whl

Download URL alfred_workflow_packager-3.1.1-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38d8b79b06fa07427ad26052cae102fdba1bcd3ffc2cf9ed1bc526192011666f
BLAKE2b-256 checksum
How to use checksums
06324bf2538d0e98b675c1ddc4b4a5c60740a9c59743dd72cc4fde2bb899e2a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page