-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* doc: Contributing.md * fix: Revert change to scope.py * fix: Rename AWS credential envvars to avoid collisions
- Loading branch information
Showing
6 changed files
with
86 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# How to contribute to the Sentry Python SDK | ||
|
||
`sentry-sdk` is an ordinary Python package. You can install it with `pip | ||
install -e .` into some virtualenv, edit the sourcecode and test out your | ||
changes manually. | ||
|
||
## Running tests and linters | ||
|
||
Make sure you have `virtualenv` installed, and the Python versions you care | ||
about. You should have at least one version of Python 2 and Python 3 installed. | ||
|
||
You don't need to `workon` or `activate` anything, the `Makefile` will create | ||
one for you. | ||
|
||
* Running basic tests without integrations: `make test` (Python 2.7 and 3.7) | ||
* Running all tests: `make test-all` | ||
|
||
This really runs all tests, for all integrations, for all version | ||
combinations we care about. This is the closest you can get to the CI build, | ||
provided you have all relevant Python versions installed. | ||
|
||
* Running linting: `make check` or `make lint` | ||
* Running autoformatting: `make format` | ||
|
||
## Releasing a new version | ||
|
||
We use [craft](https://github.com/getsentry/craft#python-package-index-pypi) to | ||
release new versions. You need credentials for the `getsentry` PyPI user, and | ||
must have `twine` installed globally. | ||
|
||
The usual release process goes like this: | ||
|
||
1. Go through git log and write new entry into `CHANGELOG.md`, commit to master | ||
2. `craft p a.b.c` | ||
3. `craft pp a.b.c` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,59 @@ | ||
SHELL = /bin/bash | ||
|
||
dist: | ||
VENV_PATH = .venv | ||
|
||
.venv: | ||
virtualenv $(VENV_PATH) | ||
$(VENV_PATH)/bin/pip install tox | ||
|
||
dist: .venv | ||
rm -rf dist build | ||
python setup.py sdist bdist_wheel | ||
$(VENV_PATH)/bin/python setup.py sdist bdist_wheel | ||
|
||
.PHONY: dist | ||
|
||
.venv: | ||
@virtualenv .venv | ||
format: .venv | ||
$(VENV_PATH)/bin/tox -e linters --notest | ||
.tox/linters/bin/black . | ||
.PHONY: format | ||
|
||
test: .venv | ||
@pip install -r test-requirements.txt | ||
@pip install --editable . | ||
@pytest tests | ||
@$(VENV_PATH)/bin/tox -e py2.7,py3.7 | ||
.PHONY: test | ||
|
||
format: | ||
@black sentry_sdk tests | ||
.PHONY: format | ||
test-all: .venv | ||
@TOXPATH=$(VENV_PATH)/bin/tox sh ./scripts/runtox.sh | ||
.PHONY: test-all | ||
|
||
check: lint | ||
.PHONY: check | ||
|
||
tox-test: | ||
@sh ./scripts/runtox.sh | ||
.PHONY: tox-test | ||
lint: .venv | ||
@set -e && $(VENV_PATH)/bin/tox -e linters || ( \ | ||
echo "================================"; \ | ||
echo "Bad formatting? Run: make format"; \ | ||
echo "================================"; \ | ||
false) | ||
|
||
lint: | ||
@tox -e linters | ||
.PHONY: lint | ||
|
||
apidocs: | ||
@pip install pdoc==0.3.2 pygments | ||
@pdoc --overwrite --html --html-dir build/apidocs sentry_sdk | ||
apidocs: .venv | ||
@$(VENV_PATH)/bin/pip install --editable . | ||
@$(VENV_PATH)/bin/pip install pdoc==0.3.2 pygments | ||
@$(VENV_PATH)/bin/pdoc --overwrite --html --html-dir build/apidocs sentry_sdk | ||
.PHONY: apidocs | ||
|
||
install-zeus-cli: | ||
npm install -g @zeus-ci/cli | ||
.PHONY: install-zeus-cli | ||
|
||
travis-upload-docs: | ||
@pip install --editable . | ||
$(MAKE) apidocs | ||
travis-upload-docs: apidocs install-zeus-cli | ||
cd build/apidocs && zip -r gh-pages ./sentry_sdk | ||
$(MAKE) install-zeus-cli | ||
zeus upload -t "application/zip+docs" build/apidocs/gh-pages.zip \ | ||
|| [[ ! "$(TRAVIS_BRANCH)" =~ ^release/ ]] | ||
.PHONY: travis-upload-docs | ||
|
||
travis-upload-dist: dist | ||
$(MAKE) install-zeus-cli | ||
travis-upload-dist: dist install-zeus-cli | ||
zeus upload -t "application/zip+wheel" dist/* \ | ||
|| [[ ! "$(TRAVIS_BRANCH)" =~ ^release/ ]] | ||
.PHONY: travis-upload-dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
#!/bin/sh | ||
# Delete all AWS Lambda functions | ||
for func in $(aws lambda list-functions | jq .Functions[].FunctionName); do | ||
|
||
export AWS_ACCESS_KEY_ID="$SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID" | ||
export AWS_SECRET_ACCESS_KEY="$SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY" | ||
export AWS_IAM_ROLE="$SENTRY_PYTHON_TEST_AWS_IAM_ROLE" | ||
|
||
for func in $(aws lambda list-functions | jq -r .Functions[].FunctionName); do | ||
echo "Deleting $func" | ||
aws lambda delete-function --function-name $func | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
#!/bin/bash | ||
set -xe | ||
set -e | ||
|
||
if [ -z "$TOXPATH" ]; then | ||
TOXPATH=tox | ||
fi | ||
|
||
# Usage: sh scripts/runtox.sh py3.7 <pytest-args> | ||
# Runs all environments with substring py3.7 and the given arguments for pytest | ||
|
||
if [ -z "$1" ]; then | ||
if [ -z "$1" ] && [ -n "$TRAVIS_PYTHON_VERSION" ]; then | ||
searchstring="$(echo py$TRAVIS_PYTHON_VERSION | sed -e 's/pypypy/pypy/g' -e 's/-dev//g')" | ||
else | ||
searchstring="$1" | ||
fi | ||
|
||
exec tox -p auto -e $(tox -l | grep $searchstring | tr '\n' ',') -- "${@:2}" | ||
exec $TOXPATH -p auto -e $(tox -l | grep "$searchstring" | tr '\n' ',') -- "${@:2}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters