Jump to content

Github Star - List and search your starred repositories in Github


yinan

Recommended Posts

Posted (edited)

Hi there, I am submitting my recently created workflow to the Workflow gallery with details to be reviewed:

 

- Say if you’re the author or submitting someone else’s workflow.

I'm the author

 

- Share a link to its thread on the Alfred Forum, if available.

 

 

- Share a link to its main page (e.g. GitHub).

https://github.com/yinan-c/alfred-github-star

 

- If it has dependencies, say what those are unless they are explicit in the About or README.

Runs a short python3 script, with no dependencies

 

- Provide any data necessary for review, testing, and extra screenshots

The workflow fetches data from api.github.com/users/{username}/starred with anonymous requests

CleanShot2023-05-21at11_21.41@2x.thumb.png.93f31a287f077beb2734cdd24671d112.png

 

- Provide screenshots, unless valid ones are in the About or README.

CleanShot2023-05-21at11_18.48@2x.thumb.png.979a1a92ebb67ad03df3ae640891c7a5.png

 

Edited by JoelC
Change links in text
Link to comment
Share on other sites

Posted (edited)

Thank you for the submission. A few things need changing:

  • You’re naming labels like variables, but labels are for humans. It’s for people to understand what options do. They should be something like:
    • Cache TTL
    • Username
    • Maximum Pages
  • It’s weird that that cache TTL is the top configuration option and is set in seconds. It would be better to have it in minutes (and do the calculation in code) and have it at the bottom (since it’s not that important). This is not a blocker, though.
  • Why is the maximum pages a negative number? That won’t make sense to most people.
  • You have to include libraries which don’t ship with macOS in the workflow or it won’t work out of the box. requests in particular.
  • Don’t add the Homebrew paths, Alfred already includes those.
  • Don’t add .pyenv paths. Those are specific to your setup and most people won’t have them.
  • What’s your theme? Naturally this isn’t a blocker, I’m asking for further screenshots.

 

Edited by vitor
Link to comment
Share on other sites

Posted (edited)

Hi! @vitor Thanks for your comments!

 

I've implemented those changes in a recent update.

- Changed tag name

- TTL set to minutes

- maximum pages default set to empty, instead of -1, to fetch all pages

- removed path configuration.

- added dependency in Readme and About page

 

Please take another look and welcome any more suggestions. Thanks.

Edited by yinan
Link to comment
Share on other sites

What I meant is that requests has to be included in the workflow itself. See it from the perspective of someone who doesn’t know how to use the Terminal.


To include a Python package with the workflow, use the --target option and set PYTHONPATH. StackOverflow has other options. Please make sure to install with /usr/bin/python3 so packages are built with the system python.

Link to comment
Share on other sites

Posted (edited)

Thanks, but how do I set PYTHONPATH to the workflow directory? should I just  put the following in script filter before running the python script, if dependency will be where I stored the library? Or should I add some configurations to get the current path in the python script?

 

export PYTHONPATH="${PYTHONPATH}:./dependency/"

Edited by yinan
Link to comment
Share on other sites

3 minutes ago, yinan said:

should I just  put the following in script filter before running the python script?

 

Precisely. But you should just need export PYTHONPATH='./dependency/' without the previous one.

Link to comment
Share on other sites

Hi @vitor, Thanks!

 

I've updated a new version of workflow in GitHub releases, it includes the `requests` library installed from the system python3 (`/usr/bin/python3`) and exported the PYTHONPATH.

Link to comment
Share on other sites

Did you remember to test locally after the update? It’s failing with:

 

Code 1: Traceback (most recent call last):
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.88EEEA65-EF63-41EA-BC22-427FE5189266/github-stars.py", line 3, in <module>
    import requests
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.88EEEA65-EF63-41EA-BC22-427FE5189266/dependency/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/Users/username/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.88EEEA65-EF63-41EA-BC22-427FE5189266/dependency/urllib3/__init__.py", line 38, in <module>
    raise ImportError(
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168

 

Fortunately it’s an easy fix. To install do instead: /usr/bin/python3 -m pip install requests 'urllib3<2' --target ./dependency'

Link to comment
Share on other sites

Posted (edited)

I did not notice the error, it worked on my machine. Thanks for pointing it out. I guess because if I have a brew installed python3, the Alfred environment will run python3 by default from brew path, which does not have this issue, but when I use

/usr/bin/python3 github-star.py

I got the same error as you did.

 

I fixed it with the command you provided and tested it now. The updated version on GitHub should be working now with both brew python3 and system python3. Thanks for your help.

Edited by yinan
Link to comment
Share on other sites

There are a couple of unsigned binaries shipping with charset_normaliser which make this not run on users machines with a warning. Fortunately they don’t need to be there and can just be deleted. It’s the two .so files (names start with md).

 

That seems to be the last remaining thing and then we can get this in.

Link to comment
Share on other sites

We have a winner! Thank you for the fast fixes, this will be live later today at https://alfred.app/workflows/yinanc/github-star/.

 

I have two quick suggestions, for a subsequent version, both related to copying the clone command:

  • Some people clone with SSH (git@github.com:yinan-c/alfred-github-star.git) instead of HTTPS (https://github.com/yinan-c/alfred-github-star.git). And GitHub also has a third option with their CLI (gh repo clone yinan-c/alfred-github-star). Having a popover button configuration controlling which method is used for copying would be useful.
  • Prefer with input as argv over with input as {query}. That way you don’t have to worry about escaping.
  • Instead of copying with AppleScript, you can simply echo it out then use the Copy to Clipboard to copy that.

None of those is imperative, though, just suggestions that occurred to me while testing.


Also, I forgot to ask earlier but is your theme available anywhere?


Have a great week!

Link to comment
Share on other sites

Thanks, I am glad the workflow got in and will be shared on the gallery. Thanks for your suggestions, I will definitely look into them in future updates!

 

5 minutes ago, vitor said:

Also, I forgot to ask earlier but is your theme available anywhere?

I downloaded this one and modified it a bit to what I like.

I haven't got the chance to upload it anywhere, but here it is, also there are two dark ones: https://www.alfredapp.com/extras/theme/wwK0gaGeKL/ and https://www.alfredapp.com/extras/theme/EXK6SGT2ki/

Probably I will also upload them on GitHub.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...