Skip to content

Commit

Permalink
Updates contributors and example
Browse files Browse the repository at this point in the history
This should really be two commits but it's late.

Updates contributors and people using Hamilton.

Updates the slack example giving it a README
and a notebook.
  • Loading branch information
skrawcz committed Apr 8, 2024
1 parent ad83adc commit 698d21d
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ Hamilton is released under the [BSD 3-Clause Clear License](https://github.com/D
* [KI-Insurance](https://www.ki-insurance.com/)
* [Ascena Retail](https://www.ascena.com/)
* [Opendoor](https://www.opendoor.com/)
* [NaroHQ](https://www.narohq.com/)
* [Rippling](https://www.rippling.com/)
* [AB-InBev](https://www.ab-inbev.com/)
* [EquipmentShare](https://www.equipmentshare.com/)
* [Everstream.ai](https://www.everstream.ai/)
* [Flectere](https://flectere.net/)
* [F33.ai](https://f33.ai/)

To add your company, make a pull request to add it here.

Expand Down Expand Up @@ -444,6 +451,10 @@ If you do not wish to participate, one can opt-out with one of the following met
- Bryan Galindo (@bryangalindo)
- Jordan Smith (@JoJo10Smith)
- Roel Bertens (@roelbertens)
- Swapnil Delwalkar (@swapdewalkar)
- Fran Boon (@flavour)
- Tom Barber (@buggtb)
- Konstantin Tyapochkin (@tyapochkin)

## Bug Hunters/Special Mentions
- Nils Olsson (@nilsso)
Expand All @@ -463,3 +474,5 @@ If you do not wish to participate, one can opt-out with one of the following met
- Anup Joseph (@AnupJoseph)
- Jan Hurst (@janhurst)
- Flavia Santos (@flaviassantos)
- Nicolas Huray (@nhuray)
- Manabu Niseki (@ninoseki)
6 changes: 6 additions & 0 deletions examples/slack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Slack notifier example

This example demonstrates how to use the Slack notifier.

Fill in the details in `slack_notification_example.py` and then
run it `python slack_notification_example.py`. You should see a message in your Slack channel.
98 changes: 98 additions & 0 deletions examples/slack/notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "initial_id",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"!pip install \"sf-hamilton[slack]\""
]
},
{
"cell_type": "code",
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"from hamilton import driver\n",
"from hamilton.plugins.h_slack import SlackNotifier\n",
"\n",
"# load magic\n",
"%load_ext hamilton.plugins.jupyter_magic"
],
"metadata": {
"collapsed": false
},
"id": "e88039e484e64415"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"%%cell_to_module -m example_module\n",
"def test_function() -> pd.DataFrame:\n",
" raise Exception(\"test exception\")\n",
" return pd.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})"
],
"metadata": {
"collapsed": false
},
"id": "444cc24511d338a3"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"# SLACK DETAILS FOR YOU TO FILL IN\n",
"api_key = \"YOUR_API_KEY\"\n",
"channel = \"YOUR_CHANNEL\""
],
"metadata": {
"collapsed": false
},
"id": "98b516f88f03981c"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"dr = (\n",
" driver.Builder()\n",
" .with_modules(example_module)\n",
" .with_adapters(SlackNotifier(api_key=api_key, channel=channel))\n",
" .build()\n",
")\n",
"print(dr.execute([\"test_function\"]))"
],
"metadata": {
"collapsed": false
},
"id": "48fdfb26417eeb26"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
1 change: 1 addition & 0 deletions examples/slack/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sf-hamilton[slack]

0 comments on commit 698d21d

Please sign in to comment.