Skip to content

Commit

Permalink
Release 0.4.1 (#25)
Browse files Browse the repository at this point in the history
# Why

This pull request releases the backtrace-python library.

In order to create a valid release, I'm also updating the package
description that will be visible in pypi:
https://pypi.org/project/backtracepython/#description
  • Loading branch information
konraddysput authored Sep 30, 2024
1 parent eb05a6e commit e59151a
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 0.4.1

- Added support for annotations in the client API (#23),
- Dropped environment variable as a default annotation (#23),
- Added an exit_timeout parameter, that allows to wait until events are processed before exit (#24).

# Version 0.4.0

- Changed a submission flow - from spawning and sending data from a process to background thread(#19).
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016 Backtrace I/O, Inc.
Copyright (c) 2024 Backtrace I/O, Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.md
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

## Documentation

https://support.backtrace.io/hc/en-us/articles/360040105992-Python-Integration-Guide
https://docs.saucelabs.com/error-reporting/language-integrations/python/

## Installation

### Requirements

This module supports Python 2, Python 3, and PyPy.

```
```bash
python -m pip install backtracepython
```

## Basic Usage

```python
```bash
import backtracepython as bt
bt.initialize(
    endpoint="https://submit.backtrace.io/{universe}/{token}/json"
Expand Down Expand Up @@ -57,47 +57,48 @@ except:
- context_line_count  - Defaults to 200 . When an error is reported, this many lines above and below each stack function are included in the report.
- tab_width  - Defaults to 8.  If there are any hard tabs in the source code, it is unclear how many spaces they should be indented to correctly display the source code. Therefore the error report can override this number to specify how many spaces a hard tab should be represented by when viewing source code.
- collect_source_code - Default to True. By default Backtrace client collects corresponded source code and send it with the report. If set to False, the source code will not be collected.
- exit_timeout - Default to 4. Backtrace sends data asynchronously in the background thread. The exit_timeout describes how many time the thread has to finish working before application exit.

### bt.BacktraceReport

Create a report object that you can later choose whether or not to send. This may be useful to track something like a request.

`report.set_attribute(key, value) `
`report.set_attribute(key, value)`
Adds an attribute to a specific report. Valid types for value are str, float, int, and bool.
Attributes are indexed and searchable. See also `addAnnotation`

`report.set_dict_attributes(dict)`

Adds all key-value pairs of dict into the report recursively.

`report.get_attributes() `
`report.get_attributes()`

Returns all report attributes.

`report.set_annotation(key, value) `
`report.set_annotation(key, value)`

Adds an annotation to a specific report. Annotations, unlike attributes, are not indexed and searchable. However, they are available for inspection when you view a specific report.

key - String which is the name of the annotation.
value - Any type which is JSON-serializable.

`report.set_dict_annotations(dict) `
`report.set_dict_annotations(dict)`

Adds all key-value pairs of dict into the report.

`report.add_attachment(attachment_path) `
`report.add_attachment(attachment_path)`

Adds an attachment to the report.

`report.get_attachments() `
`report.get_attachments()`

Returns a list of attachment paths.

`report.set_exception(ExceptionType, exception, traceback)`

error  is an Error object. Backtrace will extract information from this object such as the error message and stack trace and send this information along with the report.

`report.capture_last_exception() `
`report.capture_last_exception()`

This is the same as report.set_exception(\*sys.exc_info())

Expand All @@ -118,7 +119,7 @@ Sends the error report to the endpoint specified in initialize.

To run the test suite:

```
```bash
pytest
```

Expand All @@ -135,7 +136,7 @@ test suite with all of them:
2. Update version number in backtracepython module.
3. Tag the version in git.

```
```bash
python3 setup.py bdist_wheel --universal
twine upload dist/*
```
2 changes: 1 addition & 1 deletion backtracepython/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class version:
major = 0
minor = 4
patch = 0
patch = 1


version_string = "{}.{}.{}".format(version.major, version.minor, version.patch)
29 changes: 28 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,50 @@
#!/usr/bin/env python

import os

from setuptools import find_packages, setup

current_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(current_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()


setup(
name="backtracepython",
version="0.4.0",
version="0.4.1",
description="Backtrace.io error reporting tool for Python",
author="Backtrace.io",
author_email="[email protected]",
packages=find_packages(),
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
license="MIT",
test_suite="tests",
url="https://github.com/backtrace-labs/backtrace-python",
install_requires=["six", "simplejson", "requests"],
extras_require={
"test": ["pytest"],
},
project_urls={
"Homepage": "https://backtrace.io",
"Source": "https://github.com/backtrace-labs/backtrace-python",
"Changelog": "https://github.com/backtrace-labs/backtrace-python/blob/master/CHANGELOG.md",
"Documentation": "https://docs.saucelabs.com/error-reporting/language-integrations/python/",
},
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4",
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Bug Tracking",
"Topic :: System :: Monitoring",
"Environment :: Console",
"Environment :: Web Environment",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down

0 comments on commit e59151a

Please sign in to comment.