Skip to content

Commit

Permalink
Alfred 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed May 6, 2019
2 parents cf025f8 + 00622cd commit ea26f14
Show file tree
Hide file tree
Showing 62 changed files with 3,305 additions and 2,172 deletions.
14 changes: 8 additions & 6 deletions README_PYPI.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

A helper library for writing `Alfred 2 and 3`_ workflows.
A helper library for writing `Alfred 2, 3 and 4`_ workflows.

Supports macOS 10.6+ and Python 2.6 and 2.7 (Alfred 3 is 10.9+/2.7 only).
Supports macOS 10.7+ and Python 2.7 (Alfred 3 is 10.9+/2.7 only).

Alfred-Workflow is designed to take the grunt work out of writing a workflow.

It gives you the tools to create a fast and featureful Alfred workflow from an API, application or library in minutes.
It gives you the tools to create a fast and featureful Alfred workflow from an
API, application or library in minutes.

http://www.deanishe.net/alfred-workflow/

Expand Down Expand Up @@ -109,8 +110,9 @@ Download the ``alfred-workflow-X.X.X.zip`` file from the `GitHub releases`_
page and extract the ZIP to the root directory of your workflow (where
``info.plist`` is).

Alternatively, you can download `the source code`_ from the `GitHub repository`_
and copy the ``workflow`` subfolder to the root directory of your workflow.
Alternatively, you can download `the source code`_ from the
`GitHub repository`_ and copy the ``workflow`` subfolder to the root
directory of your workflow.

Your workflow directory should look something like this (where
``yourscript.py`` contains your workflow code and ``info.plist`` is
Expand Down Expand Up @@ -140,7 +142,7 @@ http://www.deanishe.net/alfred-workflow/.

.. _v2 branch: https://github.com/deanishe/alfred-workflow/tree/v2
.. _requests: http://docs.python-requests.org/en/latest/
.. _Alfred 2 and 3: http://www.alfredapp.com/
.. _Alfred 2, 3 and 4: http://www.alfredapp.com/
.. _GitHub releases: https://github.com/deanishe/alfred-workflow/releases
.. _the source code: https://github.com/deanishe/alfred-workflow/archive/master.zip
.. _GitHub repository: https://github.com/deanishe/alfred-workflow
Expand Down
Binary file removed alfred-workflow-1.36.zip
Binary file not shown.
Binary file added alfred-workflow-1.37.zip
Binary file not shown.
18 changes: 13 additions & 5 deletions bin/testone
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ testone <package.name> <tests/test_script.py>...
Run test script(s) with coverage for one package.
Usage:
testone <package.name> <test_script.py>...
testone [-v|-V] <package.name> <test_script.py>...
testone -h
Options:
-h Show this message and exit.
-v verbose output
-V very verbose output
-h show this message and exit
Example:
testone workflow.notify tests/test_notify.py
Expand Down Expand Up @@ -44,13 +46,19 @@ function success() {
printf "${green}$@${nc}\n"
}


while getopts ":h" opt; do
vopts=
while getopts ":hvV" opt; do
case $opt in
h)
usage
exit 0
;;
v)
vopts="-v"
;;
V)
vopts="-vv"
;;
\?)
log "Invalid option: -$OPTARG"
exit 1
Expand All @@ -71,7 +79,7 @@ package="$1"
shift

# Run tests
pytest --cov="${package}" "$@"
pytest $vopts --cov="${package}" "$@"
# ret1=$?
ret1=${PIPESTATUS[0]}

Expand Down
Binary file modified docs/Alfred-Workflow.docset.zip
Binary file not shown.
5 changes: 4 additions & 1 deletion docs/api/updates.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ on how to enable automatic updates in your workflow.
Helpers
^^^^^^^

.. autoclass:: Download
:members:

.. autoclass:: Version
:members:

.. autofunction:: download_workflow
.. autofunction:: retrieve_download


.. _GitHub releases: https://help.github.com/categories/85/articles
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from datetime import date
# import sphinx_bootstrap_theme
# import sphinx_rtd_theme
import sys
Expand Down Expand Up @@ -58,7 +59,7 @@

# General information about the project.
project = u'Alfred-Workflow'
copyright = u' 2013–2017 Dean Jackson'
copyright = u' 2013–{} Dean Jackson'.format(date.today().year)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
48 changes: 27 additions & 21 deletions docs/guide/update.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,34 @@ Alfred's default installation mechanism.

.. important::

Releases marked as ``pre-release`` on GitHub will be ignored unless the
Releases marked ``Pre-release`` on GitHub will be ignored unless the
``workflow:prereleases`` :ref:`magic argument <magic-arguments>` has
been enabled or the ``prereleases`` key is set to ``True`` in the
``update_settings`` :class:`dict`.


Supporting Alfred 2 and Alfred 3
--------------------------------
Supporting multiple Alfred versions
-----------------------------------

Workflows created *or edited* in Alfred 3 are fundamentally incompatible
with Alfred 2, even if no Alfred 3-only features are used.
Workflows created *or edited* in any version of Alfred are fundamentally
incompatible with earlier versions, even if no new features are used.

If you want to make a new release of an existing workflow that breaks
compatibility with Alfred 2, it's important that you use the alternate
``.alfred3workflow`` file extension for your release binaries to prevent Alfred
2 installations trying to update themselves to death.

You can have both an ``.alfredworkflow`` file and an ``.alfred3workflow`` file
in the same release. If Alfred-Workflow is running under Alfred 3, it will
prefer the ``.alfred3workflow`` if present. Under Alfred 2, or if the release
contains no ``.alfred3workflow`` file, Alfred-Workflow will use the
``.alfredworkflow`` file.
compatibility with older versions of Alfred, it's important that you use
an appropriate alternate versions-specific file extension to
hide the files from older versions. That means, use
``.alfred3workflow`` for workflows compatible with Alfred 3+,
``.alfred4workflow`` for workflows compatible with Alfred 4+, and so
on.

Files with extensions that have a higher version number than the running
version of Alfred are ignored by the updater. ``.alfredworkflow`` files
are installed regardless of the Alfred version.

You can have both an ``.alfredworkflow`` file and an ``.alfred4workflow`` file
in the same release. If Alfred-Workflow is running under Alfred 4, it will
prefer the ``.alfred4workflow`` if present. Under Alfred 3, or if the release
contains no ``.alfred4workflow`` file, the ``.alfredworkflow`` file is used.

There may only be one file of each type, however, or the release will be
considered invalid.
Expand All @@ -80,11 +86,11 @@ Configuration
To use self-updating, you must pass a :class:`dict` as the ``update_settings``
argument to :class:`Workflow`. It **must** have the key/value
pair ``github_slug``, which is your username and the name of the
workflow's repo in the format ``username/reponame``. The version number of the currently
installed workflow must also be specified (see below). There are several ways
to specify the version number of your workflow:
workflow's repo in the format ``username/reponame``. The version number
of the currently installed workflow must also be specified (see below). There
are several ways to specify the version number of your workflow:

1. In Alfred 3, use the Workflow Version field in the workflow
1. In Alfred 3+, use the Workflow Version field in the workflow
configuration sheet. This saves the version number in ``info.plist``.
:class:`Workflow` will retrieve the version from the
environment variables set by Alfred when it runs your workflow (or by
Expand Down Expand Up @@ -181,9 +187,9 @@ number format and associated features.

.. note::

Alfred-Workflow will automatically check in the background if a newer
version of your workflow is available, but will *not* automatically inform
the user nor download and install the update.
Alfred-Workflow will automatically check in the background if a newer
version of your workflow is available, but will *not* automatically inform
the user nor download and install the update.


Usage
Expand Down
15 changes: 7 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Welcome to Alfred-Workflow
Go to :ref:`quickindex`.


Alfred-Workflow is a Python helper library for `Alfred 2 and 3`_ workflow
Alfred-Workflow is a Python helper library for `Alfred 2, 3 and 4`_ workflow
authors, developed and hosted on `GitHub`_.

Alfred workflows typically take user input, fetch data from the Web or
elsewhere, filter them and display results to the user. Alfred-Workflow takes
care of a lot of the details for you, allowing you to concentrate your efforts
on your workflow's functionality.

Alfred-Workflow supports macOS 10.6+ (Python 2.6 and 2.7).
Alfred-Workflow supports macOS 10.7+ (Python 2.7).


Features
Expand All @@ -41,12 +41,12 @@ Features
debugging and management of the workflow


Alfred 3-only features
----------------------
Alfred 3+ features
------------------

- Set :ref:`workflows variables <workflow-variables>` from code
- Advanced modifiers
- Alfred 3-only updates (won't break Alfred 2 installs)
- Alfred version-aware updates (ignores incompatible updates)
- :ref:`Automatic re-running of Script Filters <guide-rerun>`.


Expand All @@ -65,7 +65,7 @@ box (changing ``API_KEY``):
import sys
from workflow import Workflow, ICON_WEB, web
# To use Alfred 3's feedback mechanism:
# To use Alfred 3+ feedback mechanism:
# from workflow import Workflow3
API_KEY = 'your-pinboard-api-key'
Expand Down Expand Up @@ -103,5 +103,4 @@ Pinboard item in Alfred to open it in your browser.

.. _GitHub: https://github.com/deanishe/alfred-workflow/
.. _requests: http://docs.python-requests.org/en/latest/
.. _Alfred 2 and 3: https://www.alfredapp.com/

.. _Alfred 2, 3 and 4: https://www.alfredapp.com/
2 changes: 1 addition & 1 deletion extras/alabaster
6 changes: 3 additions & 3 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e git+https://github.com/deanishe/alabaster/@a5ec3ee9827bcebe6112fb1b4319443a340a33c5#egg=alabaster
Sphinx==1.6.5
sphinxcontrib-napoleon==0.6.1
doc2dash==2.2.0
doc2dash==2.3.0
Sphinx==1.8.5
sphinxcontrib-napoleon==0.7
17 changes: 9 additions & 8 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pyobjc-core==4.0.1
pyobjc-framework-Cocoa==4.0.1
pytest==3.3.0
pytest-cov==2.5.1
pytest-httpbin==0.3.0
pytest-localserver==0.4.1
tox==2.9.1
twine==1.9.1
pyobjc-framework-Cocoa==5.2
pytest==4.4.1
pytest-cov==2.7.1
pytest-httpbin==1.0.0
pytest-localserver==0.5.0
tox==3.9.0
twine==1.13.0
flake8==3.7.7
flake8-docstrings==1.3.0
Loading

0 comments on commit ea26f14

Please sign in to comment.