|
| 1 | +Ah, it looks like I missed the **Resources** section in the enhanced version. I'll make sure it's properly included now. Here's the corrected version with the **Resources** section added: |
| 2 | + |
| 3 | +--- |
| 4 | + |
1 | 5 | <a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank"> |
2 | 6 | <img src="https://sentry-brand.storage.googleapis.com/github-banners/github-sdk-python.png" alt="Sentry for Python"> |
3 | 7 | </a> |
4 | 8 |
|
5 | | -_Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us, [<kbd>**check out our open positions**</kbd>](https://sentry.io/careers/)_. |
| 9 | +_Bad software is everywhere, and we're all tired of it. Let's be real – as devs, we've all dealt with that one bug that crashes everything at the worst possible moment. Enter **Sentry**, where the mission is simple: help developers write better software faster, so we can get back to actually enjoying building stuff!_ |
6 | 10 |
|
7 | | -# Official Sentry SDK for Python |
| 11 | +If you vibe with this mission, [<kbd>**check out our open positions**</kbd>](https://sentry.io/careers/) and join the crew! |
| 12 | + |
| 13 | +# Official Sentry SDK for Python 🚀 |
8 | 14 |
|
9 | 15 | [](https://github.com/getsentry/sentry-python/actions/workflows/ci.yml) |
10 | 16 | [](https://pypi.python.org/pypi/sentry-sdk) |
11 | 17 | [](https://discord.gg/cWnMQeA) |
12 | 18 |
|
13 | | -This is the official Python SDK for [Sentry](http://sentry.io/) |
| 19 | +Welcome to the official Python SDK for **[Sentry](http://sentry.io/)**! If you care about tracking down every error and performance bottleneck in your app, you're in the right place. 💻🐍 |
14 | 20 |
|
15 | 21 | ## Getting Started |
16 | 22 |
|
17 | | -### Install |
| 23 | +### Installation ⚡ |
| 24 | + |
| 25 | +Getting Sentry into your project is super straightforward. Just drop this in your terminal: |
18 | 26 |
|
19 | 27 | ```bash |
20 | 28 | pip install --upgrade sentry-sdk |
21 | 29 | ``` |
22 | 30 |
|
23 | | -### Configuration |
| 31 | +Boom, you're done. 🎉 |
| 32 | + |
| 33 | +### Basic Configuration 🛠️ |
| 34 | + |
| 35 | +A quick config example to get Sentry rolling with the essentials: |
24 | 36 |
|
25 | 37 | ```python |
26 | 38 | import sentry_sdk |
27 | 39 |
|
28 | 40 | sentry_sdk.init( |
29 | | - |
| 41 | + "https://[email protected]/1", # Your DSN here |
30 | 42 |
|
31 | 43 | # Set traces_sample_rate to 1.0 to capture 100% |
32 | 44 | # of transactions for performance monitoring. |
33 | | - traces_sample_rate=1.0, |
| 45 | + traces_sample_rate=1.0, # Fine-tune this based on your performance needs |
34 | 46 | ) |
35 | 47 | ``` |
36 | 48 |
|
37 | | -### Usage |
| 49 | +You’re all set! With that, Sentry starts monitoring for exceptions and performance issues in the background while you keep coding 🚀. Adjust the `traces_sample_rate` for better performance monitoring granularity. |
| 50 | + |
| 51 | +### Quick Usage Example 🧑💻 |
| 52 | + |
| 53 | +Now, let's generate some events that’ll show up in Sentry. You can log simple messages or capture errors: |
38 | 54 |
|
39 | 55 | ```python |
40 | 56 | from sentry_sdk import capture_message |
41 | | -capture_message("Hello World") # Will create an event in Sentry. |
| 57 | +capture_message("Hello Sentry!") # You'll see this in your Sentry dashboard! |
42 | 58 |
|
43 | | -raise ValueError() # Will also create an event in Sentry. |
| 59 | +raise ValueError("Oops, something went wrong!") # This will create an error event in Sentry. |
44 | 60 | ``` |
45 | 61 |
|
46 | | -- To learn more about how to use the SDK [refer to our docs](https://docs.sentry.io/platforms/python/). |
47 | | -- Are you coming from `raven-python`? [Use this migration guide](https://docs.sentry.io/platforms/python/migration/). |
48 | | -- To learn about internals use the [API Reference](https://getsentry.github.io/sentry-python/). |
| 62 | +#### Explore the Docs |
| 63 | + |
| 64 | +If you’re hungry for more details on advanced usage, integrations, and customization, don’t forget to check out the full docs: |
| 65 | + |
| 66 | +- [Official SDK Docs](https://docs.sentry.io/platforms/python/) |
| 67 | +- [API Reference](https://getsentry.github.io/sentry-python/) |
| 68 | + |
| 69 | +### Migrating from `raven-python`? 🐦➡️🦸 |
| 70 | +If you’re still using `raven-python` (RIP 🪦), we’ve made the migration to the new Sentry SDK super smooth. [Check out this guide](https://docs.sentry.io/platforms/python/migration/) to switch things over seamlessly. |
| 71 | + |
| 72 | +## Integrations 💥 |
49 | 73 |
|
50 | | -## Integrations |
| 74 | +Sentry plays nice with a lot of popular Python libraries and frameworks. Here are a few of them: |
51 | 75 |
|
52 | | -(If you want to create a new integration, have a look at the [Adding a new integration checklist](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md#adding-a-new-integration).) |
| 76 | +- [Django](https://docs.sentry.io/platforms/python/integrations/django/) – Full Django support for error and performance tracking. |
| 77 | +- [Flask](https://docs.sentry.io/platforms/python/integrations/flask/) – Flask-specific error handling. |
| 78 | +- [FastAPI](https://docs.sentry.io/platforms/python/integrations/fastapi/) – FastAPI lovers rejoice! |
| 79 | +- [Celery](https://docs.sentry.io/platforms/python/integrations/celery/) – Distributed task monitoring with Celery? Done. |
| 80 | +- [AWS Lambda](https://docs.sentry.io/platforms/python/integrations/aws-lambda/) – Serverless? Yup, Sentry’s got your back. |
| 81 | + |
| 82 | +Want more? [Check out the full list of integrations](https://docs.sentry.io/platforms/python/integrations/). 🚀 |
53 | 83 |
|
54 | | -See [the documentation](https://docs.sentry.io/platforms/python/integrations/) for an up-to-date list of libraries and frameworks we support. Here are some examples: |
| 84 | +### Rolling Your Own Integration? 🛠️ |
55 | 85 |
|
56 | | -- [Django](https://docs.sentry.io/platforms/python/integrations/django/) |
57 | | -- [Flask](https://docs.sentry.io/platforms/python/integrations/flask/) |
58 | | -- [FastAPI](https://docs.sentry.io/platforms/python/integrations/fastapi/) |
59 | | -- [AIOHTTP](https://docs.sentry.io/platforms/python/integrations/aiohttp/) |
60 | | -- [SQLAlchemy](https://docs.sentry.io/platforms/python/integrations/sqlalchemy/) |
61 | | -- [asyncpg](https://docs.sentry.io/platforms/python/integrations/asyncpg/) |
62 | | -- [Redis](https://docs.sentry.io/platforms/python/integrations/redis/) |
63 | | -- [Celery](https://docs.sentry.io/platforms/python/integrations/celery/) |
64 | | -- [Apache Airflow](https://docs.sentry.io/platforms/python/integrations/airflow/) |
65 | | -- [Apache Spark](https://docs.sentry.io/platforms/python/integrations/pyspark/) |
66 | | -- [asyncio](https://docs.sentry.io/platforms/python/integrations/asyncio/) |
67 | | -- [Graphene](https://docs.sentry.io/platforms/python/integrations/graphene/) |
68 | | -- [Logging](https://docs.sentry.io/platforms/python/integrations/logging/) |
69 | | -- [Loguru](https://docs.sentry.io/platforms/python/integrations/loguru/) |
70 | | -- [HTTPX](https://docs.sentry.io/platforms/python/integrations/httpx/) |
71 | | -- [AWS Lambda](https://docs.sentry.io/platforms/python/integrations/aws-lambda/) |
72 | | -- [Google Cloud Functions](https://docs.sentry.io/platforms/python/integrations/gcp-functions/) |
| 86 | +If you’re feeling brave and want to create a new integration or improve an existing one, we’d love to see your contribution! Make sure to read our [contributing guide](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md) before diving in. |
73 | 87 |
|
| 88 | +## Migrating Between Versions? 🧳 |
74 | 89 |
|
75 | | -## Migrating |
| 90 | +### From `1.x` to `2.x` |
76 | 91 |
|
77 | | -### Migrating From `1.x` to `2.x` |
| 92 | +If you're on the older `1.x` version of the SDK, now's the perfect time to jump to `2.x`. It comes with **major upgrades** and tons of new features. Don't worry, we've got your back with a handy [migration guide](https://docs.sentry.io/platforms/python/migration/1.x-to-2.x). |
78 | 93 |
|
79 | | -If you're on SDK version 1.x, we highly recommend updating to the 2.x major. To make the process easier we've prepared a [migration guide](https://docs.sentry.io/platforms/python/migration/1.x-to-2.x) with the most common changes as well as a [detailed changelog](MIGRATION_GUIDE.md). |
| 94 | +### From `raven-python` |
80 | 95 |
|
81 | | -### Migrating From `raven-python` |
| 96 | +Using the legacy `raven-python` client? It's now in maintenance mode, but we strongly recommend migrating to this new SDK for an improved experience. Get all the details on how to migrate with our [migration guide](https://docs.sentry.io/platforms/python/migration/raven-to-sentry-sdk/). |
82 | 97 |
|
83 | | -The old `raven-python` client has entered maintenance mode and was moved [here](https://github.com/getsentry/raven-python). |
| 98 | +## Want to Contribute? 🎉 |
84 | 99 |
|
85 | | -If you're using `raven-python`, we recommend you to migrate to this new SDK. You can find the benefits of migrating and how to do it in our [migration guide](https://docs.sentry.io/platforms/python/migration/raven-to-sentry-sdk/). |
| 100 | +We’d love to have your help in making the Sentry SDK even better! Whether it's squashing bugs, adding new features, or simply improving the docs – every contribution counts. |
86 | 101 |
|
87 | | -## Contributing to the SDK |
| 102 | +For details on how to contribute, please check out [CONTRIBUTING.md](CONTRIBUTING.md). Also, check the [open issues](https://github.com/getsentry/sentry-python/issues) and dive in! |
88 | 103 |
|
89 | | -Please refer to [CONTRIBUTING.md](CONTRIBUTING.md). |
| 104 | +## Need Help? 🤔 |
90 | 105 |
|
91 | | -## Getting Help/Support |
| 106 | +Sometimes things don’t go as planned (debugging is life, after all). If you need help, jump into our awesome community: |
92 | 107 |
|
93 | | -If you need help setting up or configuring the Python SDK (or anything else in the Sentry universe) please head over to the [Sentry Community on Discord](https://discord.com/invite/Ww9hbqr). There is a ton of great people in our Discord community ready to help you! |
| 108 | +- **[Sentry Discord Community](https://discord.com/invite/Ww9hbqr)** – Tons of people ready to help! |
| 109 | +- **[Stack Overflow](http://stackoverflow.com/questions/tagged/sentry)** – Stack Overflow’s always a great place to ask for help. |
| 110 | +- **[Sentry Forum](https://forum.sentry.io/c/sdks)** – Share ideas, get advice, and learn from the community. |
94 | 111 |
|
95 | | -## Resources |
| 112 | +## Resources 📚 |
96 | 113 |
|
97 | | -- [](https://docs.sentry.io/quickstart/) |
98 | | -- [](https://forum.sentry.io/c/sdks) |
99 | | -- [](https://discord.gg/Ww9hbqr) |
100 | | -- [](http://stackoverflow.com/questions/tagged/sentry) |
101 | | -- [](https://twitter.com/intent/follow?screen_name=getsentry) |
| 114 | +Here are some additional resources to help you make the most of Sentry: |
102 | 115 |
|
103 | | -## License |
| 116 | +- [](https://docs.sentry.io/quickstart/) – Official documentation to get you up and running. |
| 117 | +- [](https://forum.sentry.io/c/sdks) – Sentry forums for more in-depth discussions. |
| 118 | +- [](http://stackoverflow.com/questions/tagged/sentry) – Ask your questions here! |
| 119 | +- [](https://discord.gg/Ww9hbqr) – Join the community on Discord. |
| 120 | +- [](https://twitter.com/intent/follow?screen_name=getsentry) – Follow Sentry on Twitter for updates and tips. |
104 | 121 |
|
105 | | -Licensed under the MIT license, see [`LICENSE`](LICENSE) |
| 122 | +## License 📜 |
106 | 123 |
|
| 124 | +The SDK is open-source and available under the MIT license. Check out the [LICENSE](LICENSE) file for more info. |
107 | 125 |
|
108 | | -### Thanks to all the people who contributed! |
| 126 | +--- |
| 127 | + |
| 128 | +Thanks to all the contributors who have made the Sentry Python SDK awesome! 🥳💪 |
109 | 129 |
|
110 | 130 | <a href="https://github.com/getsentry/sentry-python/graphs/contributors"> |
111 | 131 | <img src="https://contributors-img.web.app/image?repo=getsentry/sentry-python" /> |
112 | 132 | </a> |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +That’s it! Keep writing better code and let Sentry handle the errors. Keep calm and debug on! ✌️ |
0 commit comments