An alfred workflow to search for Python packages in pypi and get the latest version number of a package.
- Python 3
- Alfred Powerpack
Download the workflow here.
Since pypi doesn't provide an API to search for packages and it recommends using https://pypi.org/simple/
instead, this workflow fetches the list of Python packages when it's used for the first time (~22MB will be downloaded). This list gets stored as a JSON file in the workflow's directory and will be used to search for packages. To update this list you can use pypi-fetch
keyword.
Use pypi <package-name>
keyword (as shown in the demo above).
The first three results will have an up-to-date latest version
and summary
(fetched from pypi in real time). Other items in the list will only have the name
(fetched from the local JSON file to prevent rate limit on pypi).
Hitting enter
will copy the latest version number of the package to the clipboard (0.101.0
in the demo above).
Holding Option
while hitting Enter
will open the package's page on pypi in the default browser.
Use pypi <package-name>/
to view a list of the latest versions of a package:
Hitting enter
in this list will copy the version number to the clipboard.
This is my first attempt to create an alfred workflow. Let me know in the issues of this repo if you have any solutions for the following TODO items, or if you can help with improving this workflow.
- Display a
fetching packages ...
message whenpypi-fetch
keywords is used and the list is being downloaded. - Get the details of all packages in the search results in an efficient way (without requiring user to wait for the all requests to be finished and without rate limiting on pypi).
- Display other details of the package (repo url, documentation url, etc).