Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Utility] feat: add utilities to notify slack about a new library release. #6973

Closed
wants to merge 1 commit into from

Conversation

sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Feb 14, 2024

What does this PR do?

This is how such an automatic notification would look like (internal link): https://huggingface.slack.com/archives/C03HBN1C8CW/p1707889851090899.

image

Steps to create the webhook-enabled Slack Bot (documenting in case someone else finds it useful):

  • Go to the Slack API website and create a new app.
  • Choose the workspace you want to install your app to.
  • In the 'Add features and functionality' section, choose 'Incoming Webhooks'.
  • Activate incoming webhooks and create a new webhook for the channel you want to post messages to.
  • Copy the webhook URL; you'll use it in your Python script to send messages to Slack.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@sayakpaul
Copy link
Member Author

This is wrongly crafted. In its current form, the bot will always notify the channel within a fixed interval. We need to make it conditional on the PyPI release status instead. Will look into it.

@sayakpaul sayakpaul marked this pull request as draft February 14, 2024 08:24
@LysandreJik
Copy link
Member

cc @ydshieh who might have tips/comments about the Slack-related work (he's handling it from the transformers' POV)

@sayakpaul
Copy link
Member Author

@ydshieh a gentle ping in case you want to exchange notes :)

response = requests.get(url)
if response.status_code == 200:
data = response.json()
return {"tag_name": data["tag_name"], "url": data["html_url"]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return {"tag_name": data["tag_name"], "url": data["html_url"]}
return {"tag_name": data["tag_name"], "url": data["html_url"], "release_time" : data["published_at"}

we can maybe:

  1. extract the published time the latest release here
  2. compare with the current time and notify if it is less than 12 hours?

@ydshieh
Copy link
Contributor

ydshieh commented Mar 14, 2024

Hi @sayakpaul

I love the idea of having such notification!

In transformers, it uses from slack_sdk import WebClient and client.chat_postMessage, (it was that way before I joined), which is different from what you have done in this PR. So I won't have comments to provide here regarding this part.

As you know and mentioned by @yiyixuxu , the condition has to be adjusted. Also, at the end, we need to decide which libraries to watch for the notifications.

I would rather fail the script if the information could not be fetched instead of just printing a message.

@sayakpaul
Copy link
Member Author

Closing this with #7270.

@sayakpaul sayakpaul closed this Mar 14, 2024
@sayakpaul sayakpaul deleted the notify-slack-release branch March 14, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants