From e59151a619cf671edce74fe059e5f6248131c1b5 Mon Sep 17 00:00:00 2001 From: Konrad Dysput Date: Mon, 30 Sep 2024 19:44:59 +0200 Subject: [PATCH] Release 0.4.1 (#25) # 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 --- CHANGELOG.md | 6 ++++++ LICENSE | 2 +- MANIFEST.in | 1 + README.md | 25 +++++++++++++------------ backtracepython/version.py | 2 +- setup.py | 29 ++++++++++++++++++++++++++++- 6 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 MANIFEST.in diff --git a/CHANGELOG.md b/CHANGELOG.md index cb5bddd..d19bcf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). diff --git a/LICENSE b/LICENSE index 7ee393d..b1bb668 100644 --- a/LICENSE +++ b/LICENSE @@ -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"), diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..bb3ec5f --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include README.md diff --git a/README.md b/README.md index c2742c8..0273e7a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Documentation -https://support.backtrace.io/hc/en-us/articles/360040105992-Python-Integration-Guide +https://docs.saucelabs.com/error-reporting/language-integrations/python/ ## Installation @@ -12,13 +12,13 @@ https://support.backtrace.io/hc/en-us/articles/360040105992-Python-Integration-G 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" @@ -57,12 +57,13 @@ 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` @@ -70,26 +71,26 @@ Attributes are indexed and searchable. See also `addAnnotation` 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. @@ -97,7 +98,7 @@ Returns a list of attachment paths. 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()) @@ -118,7 +119,7 @@ Sends the error report to the endpoint specified in initialize. To run the test suite: -``` +```bash pytest ``` @@ -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/* ``` diff --git a/backtracepython/version.py b/backtracepython/version.py index 7c01207..9c12c21 100644 --- a/backtracepython/version.py +++ b/backtracepython/version.py @@ -1,7 +1,7 @@ class version: major = 0 minor = 4 - patch = 0 + patch = 1 version_string = "{}.{}.{}".format(version.major, version.minor, version.patch) diff --git a/setup.py b/setup.py index 055ba56..9075de4 100644 --- a/setup.py +++ b/setup.py @@ -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="team@backtrace.io", 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",