Skip to content

Commit f6d3adc

Browse files
authored
docs(readme): Updated readme so it does not look abandoned anymore. (#1319)
* docs(readme): Updated readme so it does not look abandoned anymore. * docs(contribution): Updated contribution guide
1 parent cdfab0d commit f6d3adc

File tree

2 files changed

+192
-47
lines changed

2 files changed

+192
-47
lines changed

CONTRIBUTING.md

Lines changed: 115 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,109 @@
1-
# How to contribute to the Sentry Python SDK
1+
# Contributing to Sentry SDK for Python
22

3-
`sentry-sdk` is an ordinary Python package. You can install it with `pip
4-
install -e .` into some virtualenv, edit the sourcecode and test out your
5-
changes manually.
3+
We welcome contributions to python-sentry by the community. See the [Contributing to Docs](https://docs.sentry.io/contributing/) page if you want to fix or update the documentation on the website.
64

7-
## Community
5+
## How to report a problem
86

9-
The public-facing channels for support and development of Sentry SDKs can be found on [Discord](https://discord.gg/Ww9hbqr).
7+
Please search the [issue tracker](https://github.com/getsentry/sentry-python/issues) before creating a new issue (a problem or an improvement request). Please also ask in our [Sentry Community on Discord](https://discord.com/invite/Ww9hbqr) before submitting a new issue. There is a ton of great people in our Discord community ready to help you!
108

11-
## Running tests and linters
9+
If you feel that you can fix or implement it yourself, please read a few paragraphs below to learn how to submit your changes.
1210

13-
Make sure you have `virtualenv` installed, and the Python versions you care
14-
about. You should have Python 2.7 and the latest Python 3 installed.
11+
## Submitting changes
1512

16-
We have a `Makefile` that is supposed to help people get started with hacking
17-
on the SDK without having to know or understand the Python ecosystem. You don't
18-
need to `workon` or `bin/activate` anything, the `Makefile` will do everything
19-
for you. Run `make` or `make help` to list commands.
13+
- Setup the development environment.
14+
- Clone sentry-python and prepare necessary changes.
15+
- Add tests for your changes to `tests/`.
16+
- Run tests and make sure all of them pass.
17+
- Submit a pull request, referencing any issues it addresses.
18+
19+
We will review your pull request as soon as possible.
20+
Thank you for contributing!
21+
22+
## Development environment
23+
24+
### Clone the repo:
25+
26+
```bash
27+
git clone git@github.com:getsentry/sentry-python.git
28+
```
29+
30+
Make sure that you have Python 3 installed. Version 3.7 or higher is required to run style checkers on pre-commit. On macOS, we recommend using brew to install Python. For Windows, we recommend an official python.org release.
31+
32+
### Create a virtual environment:
33+
34+
```bash
35+
cd sentry-python
36+
37+
python -m venv .env
38+
39+
source .env/bin/activate
40+
41+
pip install -e .
42+
```
43+
44+
**Hint:** Sometimes you need a sample project to run your new changes to sentry-python. In this case install the sample project in the same virtualenv and you should be good to go because the ` pip install -e .` from above installed your local sentry-python in editable mode. So you can just hack away!
45+
46+
### Install coding style pre-commit hooks:
47+
48+
```bash
49+
cd sentry-python
50+
51+
pip install -r linter-requirements.txt
52+
53+
pip install pre-commit
54+
55+
pre-commit install
56+
```
57+
58+
That's it. You should be ready to make changes, run tests, and make commits! If you experience any problems, please don't hesitate to ping us in our [Discord Community](https://discord.com/invite/Ww9hbqr).
59+
60+
## Running tests
61+
62+
We have a `Makefile` to help people get started with hacking on the SDK
63+
without having to know or understand the Python ecosystem.
64+
Run `make` or `make help` to list commands.
65+
66+
So the simplest way to run tests is:
67+
68+
```bash
69+
cd sentry-python
70+
71+
make tests
72+
```
73+
74+
This will use [Tox](https://tox.wiki/en/latest/) to run our whole test suite
75+
under Python 2.7 and Python 3.7.
2076

2177
Of course you can always run the underlying commands yourself, which is
2278
particularly useful when wanting to provide arguments to `pytest` to run
23-
specific tests. If you want to do that, we expect you to know your way around
24-
Python development. To get started, clone the SDK repository, cd into it, set
25-
up a virtualenv and run:
79+
specific tests:
80+
81+
```bash
82+
cd sentry-python
2683

27-
# This is "advanced mode". Use `make help` if you have no clue what's
28-
# happening here!
84+
# create virtual environment
85+
python -m venv .env
2986

30-
pip install -e .
31-
pip install -r test-requirements.txt
87+
# activate virtual environment
88+
source .env/bin/activate
3289

33-
pytest tests/
90+
# install sentry-python
91+
pip install -e .
92+
93+
# install requirements
94+
pip install -r test-requirements.txt
95+
96+
# run tests
97+
pytest tests/
98+
```
99+
100+
If you want to run the tests for a specific integration you should do so by doing this:
101+
102+
```bash
103+
pytest -rs tests/integrations/flask/
104+
```
105+
106+
**Hint:** Tests of integrations need additional dependencies. The switch `-rs` will show you why tests where skipped and what dependencies you need to install for the tests to run. (You can also consult the [tox.ini](tox.ini) file to see what dependencies are installed for each integration)
34107

35108
## Releasing a new version
36109

@@ -48,42 +121,48 @@ The usual release process goes like this:
48121

49122
1. Write the integration.
50123

51-
* Instrument all application instances by default. Prefer global signals/patches instead of configuring a specific instance. Don't make the user pass anything to your integration for anything to work. Aim for zero configuration.
124+
- Instrument all application instances by default. Prefer global signals/patches instead of configuring a specific instance. Don't make the user pass anything to your integration for anything to work. Aim for zero configuration.
52125

53-
* Everybody monkeypatches. That means:
126+
- Everybody monkeypatches. That means:
54127

55-
* Make sure to think about conflicts with other monkeypatches when monkeypatching.
128+
- Make sure to think about conflicts with other monkeypatches when monkeypatching.
56129

57-
* You don't need to feel bad about it.
130+
- You don't need to feel bad about it.
58131

59-
* Avoid modifying the hub, registering a new client or the like. The user drives the client, and the client owns integrations.
132+
- Avoid modifying the hub, registering a new client or the like. The user drives the client, and the client owns integrations.
60133

61-
* Allow the user to disable the integration by changing the client. Check `Hub.current.get_integration(MyIntegration)` from within your signal handlers to see if your integration is still active before you do anything impactful (such as sending an event).
134+
- Allow the user to disable the integration by changing the client. Check `Hub.current.get_integration(MyIntegration)` from within your signal handlers to see if your integration is still active before you do anything impactful (such as sending an event).
62135

63136
2. Write tests.
64137

65-
* Think about the minimum versions supported, and test each version in a separate env in `tox.ini`.
138+
- Think about the minimum versions supported, and test each version in a separate env in `tox.ini`.
66139

67-
* Create a new folder in `tests/integrations/`, with an `__init__` file that skips the entire suite if the package is not installed.
140+
- Create a new folder in `tests/integrations/`, with an `__init__` file that skips the entire suite if the package is not installed.
68141

69142
3. Update package metadata.
70143

71-
* We use `extras_require` in `setup.py` to communicate minimum version requirements for integrations. People can use this in combination with tools like Poetry or Pipenv to detect conflicts between our supported versions and their used versions programmatically.
144+
- We use `extras_require` in `setup.py` to communicate minimum version requirements for integrations. People can use this in combination with tools like Poetry or Pipenv to detect conflicts between our supported versions and their used versions programmatically.
72145

73-
Do not set upper-bounds on version requirements as people are often faster in adopting new versions of a web framework than we are in adding them to the test matrix or our package metadata.
146+
Do not set upper-bounds on version requirements as people are often faster in adopting new versions of a web framework than we are in adding them to the test matrix or our package metadata.
74147

75148
4. Write the [docs](https://github.com/getsentry/sentry-docs). Answer the following questions:
76149

77-
* What does your integration do? Split in two sections: Executive summary at top and exact behavior further down.
150+
- What does your integration do? Split in two sections: Executive summary at top and exact behavior further down.
78151

79-
* Which version of the SDK supports which versions of the modules it hooks into?
152+
- Which version of the SDK supports which versions of the modules it hooks into?
80153

81-
* One code example with basic setup.
154+
- One code example with basic setup.
82155

83-
* Make sure to add integration page to `python/index.md` (people forget to do that all the time).
156+
- Make sure to add integration page to `python/index.md` (people forget to do that all the time).
84157

85-
Tip: Put most relevant parts wrapped in `<!--WIZARD-->..<!--ENDWIZARD-->` tags for usage from within the Sentry UI.
158+
Tip: Put most relevant parts wrapped in `<!--WIZARD-->..<!--ENDWIZARD-->` tags for usage from within the Sentry UI.
86159

87160
5. Merge docs after new version has been released (auto-deploys on merge).
88161

89162
6. (optional) Update data in [`sdk_updates.py`](https://github.com/getsentry/sentry/blob/master/src/sentry/sdk_updates.py) to give users in-app suggestions to use your integration. May not be applicable or doable for all kinds of integrations.
163+
164+
## Commit message format guidelines
165+
166+
See the documentation on commit messages here:
167+
168+
https://develop.sentry.dev/commit-messages/#commit-message-format

README.md

Lines changed: 77 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,98 @@
66

77
_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/)_
88

9-
# sentry-python - Sentry SDK for Python
9+
# Official Sentry SDK for Python
1010

1111
[![Build Status](https://travis-ci.com/getsentry/sentry-python.svg?branch=master)](https://travis-ci.com/getsentry/sentry-python)
1212
[![PyPi page link -- version](https://img.shields.io/pypi/v/sentry-sdk.svg)](https://pypi.python.org/pypi/sentry-sdk)
1313
[![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/cWnMQeA)
1414

15-
This is the next line of the Python SDK for [Sentry](http://sentry.io/), intended to replace the `raven` package on PyPI.
15+
This is the official Python SDK for [Sentry](http://sentry.io/)
16+
17+
---
18+
19+
## Migrate From sentry-raven
20+
21+
The old `raven-python` client has entered maintenance mode and was moved [here](https://github.com/getsentry/raven-python).
22+
23+
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/).
24+
25+
## Getting Started
26+
27+
### Install
28+
29+
```bash
30+
pip install --upgrade sentry-sdk
31+
```
32+
33+
### Configuration
1634

1735
```python
18-
from sentry_sdk import init, capture_message
36+
import sentry_sdk
1937

20-
init("https://mydsn@sentry.io/123")
38+
sentry_sdk.init(
39+
"https://12927b5f211046b575ee51fd8b1ac34f@o1.ingest.sentry.io/1",
2140

22-
capture_message("Hello World") # Will create an event.
41+
# Set traces_sample_rate to 1.0 to capture 100%
42+
# of transactions for performance monitoring.
43+
# We recommend adjusting this value in production.
44+
traces_sample_rate=1.0,
45+
)
46+
```
2347

24-
raise ValueError() # Will also create an event.
48+
### Usage
49+
50+
```python
51+
from sentry_sdk import capture_message
52+
capture_message("Hello World") # Will create an event in Sentry.
53+
54+
raise ValueError() # Will also create an event in Sentry.
2555
```
2656

2757
- To learn more about how to use the SDK [refer to our docs](https://docs.sentry.io/platforms/python/)
28-
- Are you coming from raven-python? [Use this cheatsheet](https://docs.sentry.io/platforms/python/migration/)
58+
- Are you coming from raven-python? [Use this migration guide](https://docs.sentry.io/platforms/python/migration/)
2959
- To learn about internals use the [API Reference](https://getsentry.github.io/sentry-python/)
3060

31-
# Contributing to the SDK
61+
## Integrations
62+
63+
- [Django](https://docs.sentry.io/platforms/python/guides/django/)
64+
- [Flask](https://docs.sentry.io/platforms/python/guides/flask/)
65+
- [Bottle](https://docs.sentry.io/platforms/python/guides/bottle/)
66+
- [AWS Lambda](https://docs.sentry.io/platforms/python/guides/aws-lambda/)
67+
- [Google Cloud Functions](https://docs.sentry.io/platforms/python/guides/gcp-functions/)
68+
- [WSGI](https://docs.sentry.io/platforms/python/guides/wsgi/)
69+
- [ASGI](https://docs.sentry.io/platforms/python/guides/asgi/)
70+
- [AIOHTTP](https://docs.sentry.io/platforms/python/guides/aiohttp/)
71+
- [RQ (Redis Queue)](https://docs.sentry.io/platforms/python/guides/rq/)
72+
- [Celery](https://docs.sentry.io/platforms/python/guides/celery/)
73+
- [Chalice](https://docs.sentry.io/platforms/python/guides/chalice/)
74+
- [Falcon](https://docs.sentry.io/platforms/python/guides/falcon/)
75+
- [Quart](https://docs.sentry.io/platforms/python/guides/quart/)
76+
- [Sanic](https://docs.sentry.io/platforms/python/guides/sanic/)
77+
- [Tornado](https://docs.sentry.io/platforms/python/guides/tornado/)
78+
- [Tryton](https://docs.sentry.io/platforms/python/guides/tryton/)
79+
- [Pyramid](https://docs.sentry.io/platforms/python/guides/pyramid/)
80+
- [Logging](https://docs.sentry.io/platforms/python/guides/logging/)
81+
- [Apache Airflow](https://docs.sentry.io/platforms/python/guides/airflow/)
82+
- [Apache Beam](https://docs.sentry.io/platforms/python/guides/beam/)
83+
- [Apache Spark](https://docs.sentry.io/platforms/python/guides/pyspark/)
84+
85+
## Contributing to the SDK
86+
87+
Please refer to [CONTRIBUTING.md](CONTRIBUTING.md).
88+
89+
## Getting help/support
90+
91+
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!
92+
93+
## Resources
3294

33-
Please refer to [CONTRIBUTING.md](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md).
95+
- [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/quickstart/)
96+
- [![Forum](https://img.shields.io/badge/forum-sentry-green.svg)](https://forum.sentry.io/c/sdks)
97+
- [![Discord](https://img.shields.io/discord/621778831602221064)](https://discord.gg/Ww9hbqr)
98+
- [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](http://stackoverflow.com/questions/tagged/sentry)
99+
- [![Twitter Follow](https://img.shields.io/twitter/follow/getsentry?label=getsentry&style=social)](https://twitter.com/intent/follow?screen_name=getsentry)
34100

35-
# License
101+
## License
36102

37-
Licensed under the BSD license, see [`LICENSE`](https://github.com/getsentry/sentry-python/blob/master/LICENSE)
103+
Licensed under the BSD license, see [`LICENSE`](LICENSE)

0 commit comments

Comments
 (0)