
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Simplest Alfred Client that I use my own projects.
pip install alfred5
requirements.txt
to src
foldersalfred5
via
pip install alfred5 --target=src/libs
main.py
import sys
sys.path.insert(0, "src/libs")
--target
for ex .
use WorkflowClient.run(packagedir=".")
requirements.txt
file in src
vscode
, add the code that below to .vscode/settings.json
to debug your file
{
"python.analysis.extraPaths": [
"./src/libs"
],
"python.analysis.exclude": [
"./src/libs"
]
}
SnippetsClient
API create custom snippets programmaicallyWorkflowClient
API create custom alfred workflow
requirements.txt
file for your python project to let alfred5
installs them if needed 🙃from requirements.txt
do all import packages inside main
- Use global
keyword to access imported packages globally
client.query
is the query stringclient.page_count
is the page count for pagination resultsalfred5
to requirements.txt
WorkflowClient.log
to log your message to alfred debugger
WorkflowClient(main, cache=True)
method to use caching system
db/results.yml
also you can see it from workflow debug panelfrom re import sub
from urllib.parse import quote_plus
import sys
sys.path.insert(0, "src/libs")
from alfred5 import WorkflowClient
async def main(client: WorkflowClient):
# To auto install requirements all import operation must be in here
global get
from requests import get
query = client.query
client.log(f"my query: {query}") # use it to see your log in workflow debug panel
# (use cache=True) Use cache system to quick response instead of old style that below
# if client.load_cached_response():
# return
char_count = str(len( query))
word_count = str(len(query.split(" ")))
line_count = str(len(query.split("\n")))
encoded_string = quote_plus(query)
remove_dublication = " ".join(dict.fromkeys(query.split(" ")))
upper_case = query.upper()
lower_case = query.lower()
capitalized = query.capitalize()
template = sub(r"[a-zA-Z0-9]", "X", query)
client.add_result(encoded_string, "Encoded", arg=encoded_string)
client.add_result(remove_dublication, "Remove dublication", arg=remove_dublication)
client.add_result(upper_case, "Upper Case", arg=upper_case)
client.add_result(lower_case, "Lower Case", arg=lower_case)
client.add_result(capitalized, "Capitalized", arg=capitalized)
client.add_result(template, "Template", arg=template)
client.add_result(char_count, "Characters", arg=char_count)
client.add_result(word_count, "Words", arg=word_count)
client.add_result(line_count, "Lines", arg=line_count)
# (use cache=True) to cache result for query instead of old style that below
# if u work with static results (not dynamic; coin price etc.)
# client.cache_response()
if __name__ == "__main__":
WorkflowClient.run(main) # WorkflowClient.run(main, cache=True)
Copyright 2023 Yunus Emre Ak ~ YEmreAk.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
FAQs
Simple python wrapper for alfred5 workflow / snippets
We found that alfred5 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.