Saravanan666/pypi-org huggingface dataset:
Package: slack-machine-plugins
slack-machine-pluginsUtility plugins for Slack-Machine, the sexy, simple, yet powerful and extendable Slack bot.pipinstallslack-machine-pluginscommanderCommander provides two classesCommandandCommandArgumentfor a declarative way to define chat commands and their arguments for input validation and error feedback for the user. Features include:Type and length validation for chat command arguments.Strict choices.Custom validation and error messages.Usage and error texts for user feedback.Example UsageTaken from test case, realistic example.# command definition####################frommachine_plugins.commanderimportCommand,CommandArgumentscale_cmd=Command(name='scale',description='Scale a deployment.',arguments=[CommandArgument(name='namespace',target_type=str,choices=['default','dev'],description='Namespace of the deployment.',),CommandArgument(name='deployment',validation=(lambdad:d.startswith('deployment-prefix-'),),description='Name of the deployment.',),CommandArgument(name='replicas',target_type=int,validation=(lambdar:2<=int(r)<=10,'You can not scale under 2 or above 10 replicas.'),),],)# command usage in slack-machine################################frommachine.plugins.baseimportMachineBasePluginfrommachine.plugins.decoratorsimportrespond_toclassDeploymentPlugin(MachineBasePlugin):@respond_to(regex=r'^scale ?(?P<args>.*)$')defscale(self,msg,args):errs=scale_cmd.errors(args)iferrs:resp='\n'.join(errs)msg.say(f'```{resp}```')return# input validation complete, do your thing e.g `scale(*args.split())`
Package: slack-magic
slack_magicdefines an IPython magic function to send notifications to a slack app when a process completes or fails.DescriptionInstall usingpip install slack_magicLoad the extension within Jupyter or IPython%load_ext slack_magicThe first time you run%notifyit will ask for your slack app webhook url. After that it will be stored in~/.slack_magic.Use the magic as either a cell or a line magic:%load_extslack_magic# Send a confirmation that a line has run%notify"Nothing wrong with this code"# Send traceback to slack when an error is raised%notify1/0# Send a confirmation that a cell has run%%notify"Nothing wrong with this code either"a=10b=144# Send traceback to slack when an error is raised in the cell%%notify"This won't fail""But the next line will"1/0
Package: slackmentions
slackmentionsProvides functions for dealing with mentions in slack messages.Installation$ pip install slackmentionsYou will also need theslackclientpackage for this to be
useful.UsageAvailable functions:findpeople:Finds username mentions in slack text and createsSlackPersonobjects
for those people. Returns a list of those SlackPerson objects.
This can be used to get more information about users or if the same text
will be processed multiple times.Arguments:text: text to find @ mentions in.userlist: output of slack api users.listsilent: slackperson.SlackDataError will be raised if a mention is found
in the text but not in the userlist. Setting to True will swallow this
error and ignore that mention.Returns: List of SlackPerson objects or empty list.mention_text:Replaces username mentions in text with user id mentions for tagging by
slack api message sending.Arguments:text: The text containing @ mentionspeople: A list of SlackPerson objects for people found in the text. If not
specified, one will be generated by passing text and userlist to
findpeople. Required if userlist is not provided.userlist: The json from slack api users.list. Required if people is not
provided.silent: slackperson.SlackDataError will be raised if a mention is found
in the text but not in the userlist. Setting to True will swallow this
error and ignore that mention. Only applies if userlist is specified, not
people.clean_text:Deletes @ mentions from text
Arguments:text: The text containing @ mentionspeople: A list of SlackPerson objects for people found in the text. If not
specified, one will be generated by passing text and userlist to
findpeople. Required if userlist is not provided.userlist: The json from slack api users.list. Required if people is not
provided.silent: slackperson.SlackDataError will be raised if a mention is found
in the text but not in the userlist. Setting to True will swallow this
error and ignore that mention. Only applies if userlist is specified, not
people.clean_all: set to true to ignore the user lists and people and just nuke
all the mentionsimport slackmentions
from slackclient import SlackClient

sc = SlackClient(os.environ['SLACK_API_TOKEN'])
userlist = sc.api_call('users.list')
text = 'hi @joe, could you tell @kathy to call me?'

people = slackmentions.findpeople(text, userlist)
# people = [SlackPerson(userid='U0000001', username='joe'),
            SlackPerson(userid='U0000002', username='kathy')]
withmentions = slackmentions.mention_text(text, people=people)
# withmentions = 'hi <@U0000001>, could you please tell <@U0000002> to call
me?'
withmentions2 = slackmentions.mention_text(text, userlist=userlist)
assert withmentions = withmentions2

cleantext = slackmentions.clean_text(text, people=people)
# cleantext = 'hi, could you please tell to call me?'TestsThere are tests for each method with successes, errors raised, errors
swallowed, and missing keyword arguments. They can be run withpytest.
Package: slack-messenger
slack-messengerDescriptionTheslack-messengeris a simple package that helps send Slack Messages via Incoming Webhook URLs. For more information on how to create
a Slack App, and how to generate an incoming webhook URL please read the official Slack documentation onsending messages using Incoming Webhooks.How to use slack-messengerfromslack_messengerimportSlackMessenger# Create the SlackMessenger object with your Incoming Webhook URLurl="https://hooks.slack.com/services/<rest-of-the-webhook>"sm=SlackMessenger(slackbot_webhook_url=url)# Create your message, you can use the usual formatting and layout blocks available from Slackmessage="Hello Slack :alert-emoji:, this is sent from `slack messenger`"# The 'send_slack_msg' method will return a tuple with the first item boolean to represent if sending# the message was successful and the second item as a string of text indicating if the message was# successfully sent or failed along with the message content and error message in the event of failure.message_success,response_msg=sm.send_slack_msg(message=message)print(f"SUCCESS:{message_success}RESPONSE MSG:{response_msg}")# If you wish to include a slack formatted date and timestamp in your message you can call the below# method to return the slack date and include it in your message bodyslack_date=sm.get_slack_formatted_date_num_time_secs()Installing slack-messengerRequests is available on PyPI:$python-mpipinstallslack-messenger
Package: slackminion
slackminionA python bot framework for slackRunningIt is recommended that you set up a virtual environment in which to run slackminion. Install the app:$ pip installRun the application using the built-inslackminioncommand. Use a config.yaml to customize the plugins you wish to run. You can test your plugin configuration before running a live app:# Generate a plugin report:
$ slackminion --config config.yaml --test

# Run a live bot:
$ slackminion --config config.yamlSee the documentation for more information and details on how to write a plugin.Documentationhttp://slackminion.readthedocs.org/ContributingIt is recommended that you set up a virtual environment in which to run slackminion. Bootstrapping the application should be pretty straightforward:toxAll tests should pass before and after you make your commits.Python3 SupportAs of Version 0.10, slackminion requires Python >= 3.6.  This is due to both the upgrade of the slack client (which requires Python3), and the usage of async functions and f-strings within the slackminion code.  If you need Python 2.x, please pin version >= 0.9.x of slackminion.
Package: slackmojistats
SlackmojistatsDownload emojisQuickly download all your emojis from Slack and save them to a folder.
Makes aliases their own image with the aliased name.
Due to limitations with Slack'semoji.listendpoint, we're unable to save aliases to built-in emojis, such as aliases towhite_large_square.Installpip install slackmojistatsSample UsageSetSlack_API_TOKENenv var (or pass in via-aflag) withemoji.listandsearch.messagesaccess, then run a command from below:usage: slackmojistats [-h] [-a API_TOKEN] [-c {download}]
                      [-d DOWNLOAD_LOCATION]

optional arguments:
  -h, --help            show this help message and exit
  -a API_TOKEN, --api-token API_TOKEN
                        Slack api token to use; needs emoji.list and
                        search.messages privs. Defaults to Slack_API_TOKEN env
                        var.
  -c {download}, --action {download}
                        Which action to perform. Right now only download is
                        supported. Defaults to 'download'.
  -d DOWNLOAD_LOCATION, --download-location DOWNLOAD_LOCATION
                        Where to download emojis to. Will try and create the
                        dir if it doesn't exist. Only used with the `download`
                        action. Defaults to /tmp/Slack-emoji.TODOGet stats -- not supported right now due to emoji.list ratelimitReturns the top N most-used custom emojis in your Slack, via Slack's api:https://github.com/Slackapi/python-slackclient/tree/2.0.1
Package: slackmq
SlackMQSlack can do the heavy lifting of a simple Message Queue. When a message is received,
it is "locked" while being processed. This keeps other worker bots from processing the
message simultaneously.SlackMQ is suited to high latency message queuing applications due to rate limiting.
For a minimalist architecture, leverage the power of SlackMQ and a Slack bot becomes
highly available out of the box.To install:pip install slackmqThe Slack API allows pins to be added once per message per channel. Also, reactions
and stars can be added to a message once per bot. For example, a person or bot cannot
pin a message that has already been pinned. A user or bot cannot give a post a thumbs
up twice. In the UI, if you try, the action is revoked. In the API, an exception is
thrown.Slack can be made to behave like a basic Message Queuing system by using pins to
acknowledge (lock) and unacknowledge a message, as demonstrated in the diagram above.
Using pins is ideal as this allows "unlimited" bot workers. The Slack RTM API also
allows a bot to connect multiple times. With this account concurrency, this method
limits the bot to 16 concurrent workers. You may find using a combination of pins,
stars and reactions more reliable for low latency messages.To use SlackMQ, wrap the post acknowledgement around a bot action. Below is an example
of how a bot (using the slackbot library) uses SlackMQ to pull from the "queue", i.e,
the channel.fromslackmqimportslackmqfromslackbot.botimportlisten_toimportsocketAPI_TOKEN='SLACK-BOT-API-TOKEN'@listen_to('hello')defhelloworld(message):post=slackmq(API_TOKEN,message.body['channel'],message.body['ts'])ifpost.ack():message.send('Hello from{}.'.format(socket.gethostname()))post.unack()Implementation ExamplesTroupe, which is a group of Slack bots working together to control and operate a smart
home implements SlackMQ.See Troupe's source code for an insight into SlackMQ usage:https://github.com/meltaxa/troupe.Another implementation of SlackMQ is to perform DevOps manoeuvres, such as
Remote Management, Continuous Delivery, Canary Deployments and Rolling Updates. In the
Troupe example, a Federation of Slack bots can self-update with zero downtime using the
SlackMQ library. Watch The Travelling DevOps Troupe in action:
Package: slackn
slackNPython Boilerplate contains all the boilerplate you need to create a Python package.Free software: MIT licenseDocumentation:https://slackn.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2020-06-22)First release on PyPI.
Package: slack-notification
Slack-NotificationA simple way to send slack notificationInstallpip install -i slack-notificationUsagefromslack_notification.slack_notificationimportSlackNotificationCHANNEL="YOUR_CHANNEL"#example TXXXXXXXXXX/BXXXXXXXX/NXXXXXXXXXX"slack=SlackNotification(CHANNEL)message="YOUR_MESSAGE"response=slack.notify(message)
Package: slack-notifications-datateam
Slack notifitacionsSlack callback function to send alerts to any channel. It can be use for various errors on critical pieces of data pipelines.InstallTo install it is neccessary python 3.6 or greater, so review itpython3 --versionThen just need to type thispip3 install slack-notifications-datateamTest itTo test it you can use the following codetest_slack.py, just need to replacewebhook_urlandtextvaluesfromslack_notificationsimportslack_messageswebhook_url='https://hooks.slack.com/services/T00XXXXXX/B000XXXXXXX/XXXxxXXXXxXX0'text="Testing slack package. No need to investigate"slack_messages.send_message(webhook_url=webhook_url,text=text)And the just execute it
Package: slack_notifier
Event listener for Supervisord that sends notifications to Slack via Web APIInstallationpip install slack_notifierTestsTesting is set up usingpy.testand coverage is handled with thepytest-covplugin.Run your tests withpy.testin the root directory.Coverage is ran by default and is set in thepytest.inifile.
To see an html output of coverage openhtmlcov/index.htmlafter running the tests.Travis CIThere is a.travis.ymlfile that is set up to run your tests for python 2.7
and python 3.2, should you choose to use it.Set upAdd the following tosupervisord.conf:[eventlistener:slack_notifier]command=/path/to/slack_notifier -t=%AUTH_TOKEN% -c=%CHANNEL_NAME% -aevents=PROCESS_STATEOptions-p -- specify a supervisor process_name. Notify when the process goes to
      any of the 'followed' states.  If this process is part of a group, it
      can be specified using the 'process_name:group_name' syntax.

-a -- Notify about ALL processes.  Overrides any -p
      parameters passed in the same crashmail process invocation.

-e -- follow only transitions to these events. This overrides event list in
      config.py

-c -- Channel to send notifications to. Can be either:
      '#public_channel',
      '@private_group',
      'CHANNEL_ID',

-t -- Web API auth tokenThe-pand-eoptions may be specified more than once, allowing for
specification of multiple processes and events.  Specifying-aoverrides any
selection of-p.LicenseReleased under the MIT License:http://www.opensource.org/licenses/mit-license.php
Package: slack-oauth-store
slack-OAuth-storeA wapper class of FileInstallationStore to support encryption at restExample with Boltfrom slack_installation_store import EncryptedFileInstallationStore
from asyncio.log import logger
import os
import logging
from slack_bolt import App
from slack_bolt.oauth.oauth_settings import OAuthSettings
from slack_sdk.oauth.state_store import FileOAuthStateStore

logging.basicConfig(level=logging.DEBUG)

oauth_settings=OAuthSettings(
    client_id=os.environ.get("SLACK_CLIENT_ID"),
    client_secret=os.environ.get("SLACK_CLIENT_SECRET"),
    scopes=os.environ.get("SLACK_SCOPES","").split(','),
    user_scopes=[],
    install_path="/slack/install",\
    installation_store=EncryptedFileInstallationStore(base_dir="./data/installations", encryption_key=os.environ.get("SLACK_INSTALL_STORE_KEY")),
    state_store=FileOAuthStateStore(expiration_seconds=600, base_dir="./data/states")
)

# Initializes app with your bot oauth settings
app = App(
    signing_secret=os.environ["SLACK_SIGNING_SECRET"],
    oauth_settings=oauth_settings
)

@app.event("app_mention")
def event_test(body, say, logger):
    logger.info(body)
    say("Hello")

# Start your app
if __name__ == "__main__":
    app.start(port=int(os.environ.get("PORT", 3000)))Seehttps://github.com/slackapi/python-slack-sdk
Package: slackoff
OverviewSlackoff is a quick way to sign out of a company Slack workspace at the end of the day to improve one's work-life balance. It can also be used to sign out of "fun" Slack workspaces to avoid distractions during normal working hours.SetupRequirementsmacOS (for AppleScript)Slack for MacPython 3.10+InstallationInstall this tool globally withpipx(or pip):$pipxinstallslackoffor add it to yourPoetryproject:$poetryaddslackoffUsageAfter installation, automatically sign out of a Slack workspace:$slackoffMyCompanyWorkspaceor sign back in:$slackoffSlackoff will remember the last workspace used and attempt to toggle appropriately.Additional OptionsTo explicitly attempt to sign in or out, include the corresponding flag:$slackoff--signin
$slackoff--signoutView the help for more options:$slackoff--help
Package: slackops
SlackOpsPost process information to the slack without clogging up the channel with a bunch of messages. Easily update status, see when operation started / finished and how much time it took.Installation$pipinstallslackopsTable of contentsBasic usageSimple messageFormatting. Default and persistent valuesAWS LambdaBasic usageimportslackopsslack=slackops.Operation(token=SLACK_BOT_TOKEN,channel=CHANNEL_NAME)slack.start("Application update","Backup")slack.update("2. Updating application")slack.update("3. Healthchecks")slack.finish("4. Application successfully updated!")Operation statuses also posted to thread:Simple messageNote: any formatting you see in 'Message' template (header, text, context), can also be used with 'Operation' template you seen before.slack=slackops.Message(token=SLACK_BOT_TOKEN,channel=CHANNEL_NAME)slack.post(text="Example message",severity="error",# info | success | warning | errorheader="Header",context=["from ip: 192.162.1.1"],)Formatting. Default and persistent valuesYou can set default values:slack.tmpl.default.set(context=["default context - from ip: 192.162.1.1"])slack.tmpl.default.set(severity="success")slack.post("If no value is passed, the default value will be used (if available).")And persistent values:slack.tmpl.persistent.set(header="API event: ")slack.tmpl.persistent.set(text="*Details:*\n")slack.post("username: haru\n",header="new user!")AWS LambdaTo use 'Operation' template beetwen different lamdas, you can do following:Export in first lambda:packed_operation=slack.pack()And import in second lambda:slack=slackops.Operation(packed_operation=packed_operation)
Package: slackperson
slackpersonA simple class (SlackPerson) for retrieving and storing information about a
person in your slack channel from the slack api.Installation$ pip install slackpersonYou will also need theslackclientpackage.UsageTheSlackPersonclass can be initialized with the from_userlist method
that allows you to supply a username or userid and the output of the
users.list method to get data about a user.After initialization, an instance ofSlackPersonwill have these
attributes:username: the username supplied at instantiation (if username was supplied
with preceeding ‘@’, it will be stripped off.)userid: the internal id of the user (this is useful for tagging in api
generated messages.email: the user’s account email address in slackfname: the user’s first namelname: the user’s last nameteam: the user’s team idImport and use theSlackPersonclass:from slackperson import SlackPerson
from slackclient import SlackClient

sc = SlackClient(os.environ['SLACK_API_TOKEN'])
userlist = sc.api_call('users.list')
me = SlackPerson.from_userlist('myusername', userlist)Ifmyusernameis a member of your channel (i.e. on the userlist), the
objectmewill now have all of the SlackPerson attributes. If not, it
will raiseSlackDataError. It will also raiseSlackDataErrorif the
userlist is malformed in any way.TestsThere is a test case for a successful creation of a SlackPerson object and
for the cases where exceptions should be raised. They are unittests so they
can be run with unittest discovery orpytest.
Package: slack-proxy-server
slack_proxy_serverTemplate for python package which use Jenkins, Docker, Py-test …Free software: MIT licenseDocumentation:https://pypkg-reference.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theyujinrobot/yujin-pythonproject template.History0.1.1 (2019-11-06)First commit.
Package: slack-pull-reminder
Posts a Slack reminder with a list of open pull requests for an
organization.Installation$pipinstallslack-pull-reminderUsageslack-pull-reminder is configured using environment variables:RequiredSLACK_API_TOKENGITHUB_API_TOKENORGANIZATION: The GitHub organization you want pull request
reminders for.OptionalIGNORE_WORDS: A comma-separated list of words that will cause a pull request to be ignored.REPOSITORIES: A comma-separated list of repository names to check, where all other repositories in the organization are ignored. All repositories are checked by default.USERNAMES: A comma-separated list of GitHub usernames to filter pull requests by, where all other users are ignored. All users in the organization are included by default.SLACK_CHANNEL: The Slack channel you want the reminders to be posted in, defaults to #general.Example$ORGANIZATION="orgname"SLACK_API_TOKEN="token"GITHUB_API_TOKEN="token"slack-pull-reminderCronjobAs slack-pull-reminder only runs once and exits, it’s recommended to run
it regularly using for example a cronjob.Example that runs slack-pull-reminder every day at 10:00:010***ORGANIZATION="orgname"SLACK_API_TOKEN="token"GITHUB_API_TOKEN="token"slack-pull-reminderLicense(The MIT License)Copyright (c) Martin Ekmail@ekmartin.comPermission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package: slackpush
SlackPush - Logging to Slack made easySlackPush provides a wrapper on requests to push messages, logs, exceptions and attachments to slack.
It also supports basic formating: Bold and Perforated.InstallationTo get started, clone the repository and runpip install slackpushUsageImport the SlackPush object.from slackpush import SlackPushInitialise SlackPush object with a webhook_url and channel to be posted in. To know more about incoming webhooks readhere.slackpush = SlackPush(webhook_url= <your webhook_url>, channel=<your channel>)Push messages/ logs usingsend_messagemethod.slackpush.send_message('It is up and running')Similarly you can push specific exceptions as alerts to slack usingsend_exceptionmethod. This pushes the whole stack trace of the error to slack.try:
    < your code here>
except Exception as e:
    slackpush.send_exception(e)To send attachments to slack, you need to pass Slack OAuth token. More details can be foundhere.Note:See that the token has relevant persmissions to post the attachementTo add token to the object useadd_tokenmethod. To send an attachment to Slack:slackpush.send_attachment(<path to attachment>)