From 10b1e14828ed1cd022ab972933f559f0ba0cd7ce Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 16:40:00 -0500 Subject: [PATCH 01/12] Added supported / tested frameworks and versions to README. --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59006709..5a476da6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Python notifier for reporting exceptions, errors, and log messages to [Rollbar]( - **Advanced search:** Filter items by many different properties. Learn more about search. - **Customizable notifications:** Rollbar supports several messaging and incident management tools where your team can get notified about errors and important events by real-time alerts. Learn more about Rollbar notifications. -## Versions Supported +## Python Versions Supported | PyRollbar Version | Python Version Compatibility | Support Level | |-------------------|-----------------------------------------------|---------------------| @@ -33,6 +33,26 @@ Python notifier for reporting exceptions, errors, and log messages to [Rollbar]( **Security Fixes Only** - We will only provide critical security fixes for the library. +## Frameworks Supported + +Generally, PyRollbar can be used with any Python framework. However, we have official support for the following frameworks: + +| Framework | Support Duration | Tested Versions | +|-----------|----------------------------|-----------------| +| Celery | Release +1 year | None | +| Django | Release or LTS end +1 year | 3.2, 4.2, 5.0 | +| FastAPI | Release +1 year | 0.101, 0.112 | +| Flask | Release +1 year | 1.1, 2.3, 3.0 | +| Pyramid | Release +1 year | 1.10, 2.0 | + +Official support means that we ship and maintain integrations for these frameworks. It also means that we test against these frameworks as part of our CI pipeline. + +Generally, we will support the last year of releases for a framework. If a framework has a defined support period (including LTS releases), we will support the release for the duration of that period plus one year. + +### Community Supported + +There are also a number of community-supported integrations available. For more information, see the [Python SDK docs](https://docs.rollbar.com/docs/python-community-supported-sdks). + ## Setup Instructions 1. [Sign up for a Rollbar account](https://rollbar.com/signup) From 0d3b1112cd8b2278bf4694392b9c7fede2cdf1c7 Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 16:40:52 -0500 Subject: [PATCH 02/12] Updated frameworks in GitHub Actions CI test workflow. --- .github/workflows/ci.yml | 70 ++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59a77d18..2f7116fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,47 +14,49 @@ jobs: matrix: python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11] framework: + - NONE - FLASK_VERSION=1.1.4 - - FLASK_VERSION=2.2.3 - - DJANGO_VERSION=1.11.29 - - DJANGO_VERSION=2.2.28 - - DJANGO_VERSION=3.2.18 - - DJANGO_VERSION=4.0.10 - - DJANGO_VERSION=4.1.7 + - FLASK_VERSION=2.3.3 + - FLASK_VERSION=3.0.3 + - DJANGO_VERSION=3.2.25 + - DJANGO_VERSION=4.2.15 + - DJANGO_VERSION=5.0.8 - TWISTED_VERSION=20.3.0 - TWISTED_VERSION=21.7.0 - TWISTED_VERSION=22.10.0 - PYRAMID_VERSION=1.10.8 - - STARLETTE_VERSION=0.12.13 httpx==0.18.1 python-multipart==0.0.5 - - STARLETTE_VERSION=0.14.2 httpx==0.18.1 python-multipart==0.0.5 - - FASTAPI_VERSION=0.40.0 httpx==0.18.1 python-multipart==0.0.5 - - FASTAPI_VERSION=0.50.0 httpx==0.18.1 python-multipart==0.0.5 - - FASTAPI_VERSION=0.63.0 httpx==0.18.1 python-multipart==0.0.5 + - PYRAMID_VERSION=2.0.2 + - STARLETTE_VERSION=0.30.0 httpx==0.24.1 python-multipart==0.0.9 + - STARLETTE_VERSION=0.38.2 httpx==0.27.0 python-multipart==0.0.9 + - FASTAPI_VERSION=0.101.1 httpx==0.24.1 python-multipart==0.0.9 + - FASTAPI_VERSION=0.112.1 httpx==0.27.0 python-multipart==0.0.9 exclude: # Test frameworks on the python versions they support, according to pypi registry # Flask - - framework: FLASK_VERSION=2.2.3 + - framework: FLASK_VERSION=2.3.3 python-version: 3.6 + - framework: FLASK_VERSION=2.3.3 + python-version: 3.7 + - framework: FLASK_VERSION=3.0.3 + python-version: 3.6 + - framework: FLASK_VERSION=3.0.3 + python-version: 3.7 # Django - - framework: DJANGO_VERSION=1.11.29 - python-version: 3.8 - - framework: DJANGO_VERSION=1.11.29 - python-version: 3.9 - - framework: DJANGO_VERSION=1.11.29 - python-version: '3.10' - - framework: DJANGO_VERSION=1.11.29 + - framework: DJANGO_VERSION=3.2.25 python-version: 3.11 - - framework: DJANGO_VERSION=4.0.10 + - framework: DJANGO_VERSION=4.2.15 python-version: 3.6 - - framework: DJANGO_VERSION=4.0.10 + - framework: DJANGO_VERSION=4.2.15 python-version: 3.7 - - framework: DJANGO_VERSION=4.1.7 - python-version: 3.5 - - framework: DJANGO_VERSION=4.1.7 + - framework: DJANGO_VERSION=5.0.8 python-version: 3.6 - - framework: DJANGO_VERSION=4.1.7 + - framework: DJANGO_VERSION=5.0.8 python-version: 3.7 + - framework: DJANGO_VERSION=5.0.8 + python-version: 3.8 + - framework: DJANGO_VERSION=5.0.8 + python-version: 3.9 # Twisted - framework: TWISTED_VERSION=20.3.0 @@ -62,6 +64,24 @@ jobs: - framework: TWISTED_VERSION=22.10.0 python-version: 3.6 + # Starlette + - framework: STARLETTE_VERSION=0.30.0 httpx==0.24.1 python-multipart==0.0.9 + python-version: 3.6 + - framework: STARLETTE_VERSION=0.30.0 httpx==0.24.1 python-multipart==0.0.9 + python-version: 3.7 + - framework: STARLETTE_VERSION=0.38.2 httpx==0.27.0 python-multipart==0.0.9 + python-version: 3.6 + - framework: STARLETTE_VERSION=0.38.2 httpx==0.27.0 python-multipart==0.0.9 + python-version: 3.7 + + # FastAPI + - framework: FASTAPI_VERSION=0.101.1 httpx==0.24.1 python-multipart==0.0.9 + python-version: 3.6 + - framework: FASTAPI_VERSION=0.112.1 httpx=0.27.0 python-multipart==0.0.9 + python-version: 3.6 + - framework: FASTAPI_VERSION=0.112.1 httpx=0.27.0 python-multipart==0.0.9 + python-version: 3.7 + steps: - uses: actions/checkout@v2 with: From 1e8d4e8f05547a962f43c1a74a4ccc9cb338184e Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 16:42:00 -0500 Subject: [PATCH 03/12] Updated tests to be compatible with new framework versions. --- rollbar/lib/transforms/__init__.py | 2 ++ rollbar/test/fastapi_tests/test_logger.py | 5 +++-- rollbar/test/fastapi_tests/test_middleware.py | 8 +++++--- rollbar/test/starlette_tests/test_logger.py | 5 +++-- rollbar/test/starlette_tests/test_middleware.py | 8 +++++--- rollbar/test/starlette_tests/test_requests.py | 5 +++-- rollbar/test/test_rollbar.py | 12 +++++++----- rollbar/test/utils.py | 4 ++++ 8 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 rollbar/test/utils.py diff --git a/rollbar/lib/transforms/__init__.py b/rollbar/lib/transforms/__init__.py index 3f1b8802..4923b9c3 100644 --- a/rollbar/lib/transforms/__init__.py +++ b/rollbar/lib/transforms/__init__.py @@ -34,6 +34,8 @@ def transform(obj, transforms, key=None, batch_transforms=False): transforms = [BatchedTransform(transforms)] for transform in transforms: + if not isinstance(transform, Transform): + continue obj = _transform(obj, transform, key=key) return obj diff --git a/rollbar/test/fastapi_tests/test_logger.py b/rollbar/test/fastapi_tests/test_logger.py index 49a4a8a6..99a8d9a2 100644 --- a/rollbar/test/fastapi_tests/test_logger.py +++ b/rollbar/test/fastapi_tests/test_logger.py @@ -38,6 +38,7 @@ def test_should_add_framework_version_to_payload(self, mock_send_payload, *mocks app = FastAPI() app.add_middleware(LoggerMiddleware) + app.build_middleware_stack() rollbar.report_exc_info() @@ -70,10 +71,10 @@ def test_should_store_current_request(self, store_current_request): 'client': ['testclient', 50000], 'headers': [ (b'host', b'testserver'), - (b'user-agent', b'testclient'), - (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), + (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), + (b'user-agent', b'testclient'), ], 'http_version': '1.1', 'method': 'GET', diff --git a/rollbar/test/fastapi_tests/test_middleware.py b/rollbar/test/fastapi_tests/test_middleware.py index c49336e4..023754a0 100644 --- a/rollbar/test/fastapi_tests/test_middleware.py +++ b/rollbar/test/fastapi_tests/test_middleware.py @@ -16,6 +16,7 @@ import rollbar from rollbar.lib._async import AsyncMock from rollbar.test import BaseTest +from rollbar.test.utils import get_public_attrs ALLOWED_PYTHON_VERSION = sys.version_info >= (3, 6) @@ -152,6 +153,7 @@ def test_should_add_framework_version_to_payload(self, mock_send_payload, *mocks app = FastAPI() app.add_middleware(ReporterMiddleware) + app.build_middleware_stack() rollbar.report_exc_info() @@ -272,10 +274,10 @@ def test_should_store_current_request(self, store_current_request): 'client': ['testclient', 50000], 'headers': [ (b'host', b'testserver'), - (b'user-agent', b'testclient'), - (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), + (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), + (b'user-agent', b'testclient'), ], 'http_version': '1.1', 'method': 'GET', @@ -324,7 +326,7 @@ def test_should_return_current_request(self): async def read_root(original_request: Request): request = get_current_request() - self.assertEqual(request, original_request) + self.assertEqual(get_public_attrs(request), get_public_attrs(original_request)) client = TestClient(app) client.get('/') diff --git a/rollbar/test/starlette_tests/test_logger.py b/rollbar/test/starlette_tests/test_logger.py index 3ed51e68..5981e5cb 100644 --- a/rollbar/test/starlette_tests/test_logger.py +++ b/rollbar/test/starlette_tests/test_logger.py @@ -38,6 +38,7 @@ def test_should_add_framework_version_to_payload(self, mock_send_payload, *mocks app = Starlette() app.add_middleware(LoggerMiddleware) + app.build_middleware_stack() rollbar.report_exc_info() @@ -67,10 +68,10 @@ def test_should_store_current_request(self, store_current_request): 'client': ['testclient', 50000], 'headers': [ (b'host', b'testserver'), - (b'user-agent', b'testclient'), - (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), + (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), + (b'user-agent', b'testclient'), ], 'http_version': '1.1', 'method': 'GET', diff --git a/rollbar/test/starlette_tests/test_middleware.py b/rollbar/test/starlette_tests/test_middleware.py index 7c9f6554..e7415af0 100644 --- a/rollbar/test/starlette_tests/test_middleware.py +++ b/rollbar/test/starlette_tests/test_middleware.py @@ -16,6 +16,7 @@ import rollbar from rollbar.lib._async import AsyncMock from rollbar.test import BaseTest +from rollbar.test.utils import get_public_attrs ALLOWED_PYTHON_VERSION = sys.version_info >= (3, 6) @@ -138,6 +139,7 @@ def test_should_add_framework_version_to_payload(self, mock_send_payload, *mocks app = Starlette() app.add_middleware(ReporterMiddleware) + app.build_middleware_stack() rollbar.report_exc_info() @@ -243,10 +245,10 @@ def test_should_store_current_request(self, store_current_request): 'client': ['testclient', 50000], 'headers': [ (b'host', b'testserver'), - (b'user-agent', b'testclient'), - (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), + (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), + (b'user-agent', b'testclient'), ], 'http_version': '1.1', 'method': 'GET', @@ -290,7 +292,7 @@ def test_should_return_current_request(self): async def root(original_request): request = get_current_request() - self.assertEqual(request, original_request) + self.assertEqual(get_public_attrs(request), get_public_attrs(original_request)) return PlainTextResponse('OK') diff --git a/rollbar/test/starlette_tests/test_requests.py b/rollbar/test/starlette_tests/test_requests.py index 75bacb1d..09b0c292 100644 --- a/rollbar/test/starlette_tests/test_requests.py +++ b/rollbar/test/starlette_tests/test_requests.py @@ -10,6 +10,7 @@ import unittest from rollbar.test import BaseTest +from rollbar.test.utils import get_public_attrs ALLOWED_PYTHON_VERSION = sys.version_info >= (3, 6) @@ -49,7 +50,7 @@ def test_should_accept_request_param(self): stored_request = store_current_request(request) - self.assertEqual(request, stored_request) + self.assertEqual(get_public_attrs(request), get_public_attrs(stored_request)) def test_should_accept_scope_param_if_http_type(self): from starlette.requests import Request @@ -81,7 +82,7 @@ def test_should_accept_scope_param_if_http_type(self): request = store_current_request(scope, receive) - self.assertEqual(request, expected_request) + self.assertEqual(get_public_attrs(request), get_public_attrs(expected_request)) def test_should_not_accept_scope_param_if_not_http_type(self): from rollbar.contrib.starlette.requests import store_current_request diff --git a/rollbar/test/test_rollbar.py b/rollbar/test/test_rollbar.py index 3107e9e4..35b69766 100644 --- a/rollbar/test/test_rollbar.py +++ b/rollbar/test/test_rollbar.py @@ -20,6 +20,7 @@ from rollbar.lib import string_types from rollbar.test import BaseTest +from rollbar.test.utils import get_public_attrs try: eval(""" @@ -173,6 +174,7 @@ def test_starlette_request_data_with_consumed_body(self): body = b'body body body' scope = { 'type': 'http', + 'client': ('127.0.0.1', 1453), 'headers': [ (b'content-type', b'text/html'), (b'content-length', str(len(body)).encode('latin-1')), @@ -410,7 +412,7 @@ def test_get_request_starlette_middleware(self): def root(starlette_request): current_request = rollbar.get_request() - self.assertEqual(current_request, starlette_request) + self.assertEqual(get_public_attrs(current_request), get_public_attrs(starlette_request)) return PlainTextResponse("bye bye") @@ -437,7 +439,7 @@ def test_get_request_starlette_logger(self): def root(starlette_request): current_request = rollbar.get_request() - self.assertEqual(current_request, starlette_request) + self.assertEqual(get_public_attrs(current_request), get_public_attrs(starlette_request)) return PlainTextResponse("bye bye") @@ -465,7 +467,7 @@ def test_get_request_fastapi_middleware(self): def root(param, fastapi_request: Request): current_request = rollbar.get_request() - self.assertEqual(current_request, fastapi_request) + self.assertEqual(get_public_attrs(current_request), get_public_attrs(fastapi_request)) root = fastapi_add_route_with_request_param( app, root, '/{param}', 'fastapi_request' @@ -492,7 +494,7 @@ def test_get_request_fastapi_logger(self): def root(fastapi_request: Request): current_request = rollbar.get_request() - self.assertEqual(current_request, fastapi_request) + self.assertEqual(get_public_attrs(current_request), get_public_attrs(fastapi_request)) root = fastapi_add_route_with_request_param( app, root, '/{param}', 'fastapi_request' @@ -523,7 +525,7 @@ def test_get_request_fastapi_router(self): def root(fastapi_request: Request): current_request = rollbar.get_request() - self.assertEqual(current_request, fastapi_request) + self.assertEqual(get_public_attrs(current_request), get_public_attrs(fastapi_request)) root = fastapi_add_route_with_request_param( app, root, '/{param}', 'fastapi_request' diff --git a/rollbar/test/utils.py b/rollbar/test/utils.py new file mode 100644 index 00000000..88294592 --- /dev/null +++ b/rollbar/test/utils.py @@ -0,0 +1,4 @@ +from collections.abc import Mapping + +def get_public_attrs(obj: Mapping) -> dict: + return {k: obj[k] for k in obj if not k.startswith('_')} From cb3e5c53658a7ec6bedd05cb4f46a1d5cffadb0c Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 16:50:16 -0500 Subject: [PATCH 04/12] Fixed set framework CI step. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f7116fb..0a54b2f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,7 @@ jobs: run: pip install immutables==0.19 - name: Set the framework + if: ${{ matrix.framework != 'NONE' }} run: echo ${{ matrix.framework }} >> $GITHUB_ENV - name: Install Flask From 4f0ed56b235dd497e911dfccc5dc52228f1b2a6b Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 16:57:08 -0500 Subject: [PATCH 05/12] Excluded FastAPI on Python 3.7. --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a54b2f2..6d2fd8a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,8 @@ jobs: # FastAPI - framework: FASTAPI_VERSION=0.101.1 httpx==0.24.1 python-multipart==0.0.9 python-version: 3.6 + - framework: FASTAPI_VERSION=0.101.1 httpx==0.24.1 python-multipart==0.0.9 + python-version: 3.7 - framework: FASTAPI_VERSION=0.112.1 httpx=0.27.0 python-multipart==0.0.9 python-version: 3.6 - framework: FASTAPI_VERSION=0.112.1 httpx=0.27.0 python-multipart==0.0.9 From 4c0076f2c9634f18a6fdf5d218c353617ef0da6b Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 16:58:15 -0500 Subject: [PATCH 06/12] Fixed #423 requset._form may be None. --- rollbar/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollbar/__init__.py b/rollbar/__init__.py index 905fd9a5..078a3078 100644 --- a/rollbar/__init__.py +++ b/rollbar/__init__.py @@ -1372,7 +1372,7 @@ def _build_starlette_request_data(request): 'params': dict(request.path_params), } - if hasattr(request, '_form'): + if hasattr(request, '_form') and request._form is not None: request_data['POST'] = { k: v.filename if isinstance(v, UploadFile) else v for k, v in request._form.items() From 8bd7a84ede7c53f4bb51cd5b52fdedede85869ac Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 17:06:09 -0500 Subject: [PATCH 07/12] Fixed CI test package version syntax. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d2fd8a2..5df9d370 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,9 +79,9 @@ jobs: python-version: 3.6 - framework: FASTAPI_VERSION=0.101.1 httpx==0.24.1 python-multipart==0.0.9 python-version: 3.7 - - framework: FASTAPI_VERSION=0.112.1 httpx=0.27.0 python-multipart==0.0.9 + - framework: FASTAPI_VERSION=0.112.1 httpx==0.27.0 python-multipart==0.0.9 python-version: 3.6 - - framework: FASTAPI_VERSION=0.112.1 httpx=0.27.0 python-multipart==0.0.9 + - framework: FASTAPI_VERSION=0.112.1 httpx==0.27.0 python-multipart==0.0.9 python-version: 3.7 steps: From 69d1f3b2a983ec6b090c9f4ac5fcf331b378ee52 Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 30 Aug 2024 17:06:54 -0500 Subject: [PATCH 08/12] Fixed Starlette request object missing client.host. --- rollbar/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rollbar/__init__.py b/rollbar/__init__.py index 078a3078..d2c82edd 100644 --- a/rollbar/__init__.py +++ b/rollbar/__init__.py @@ -1772,4 +1772,8 @@ def _wsgi_extract_user_ip(environ): def _starlette_extract_user_ip(request): + if not hasattr(request, 'client'): + return _extract_user_ip_from_headers(request) + if not hasattr(request.client, 'host'): + return _extract_user_ip_from_headers(request) return request.client.host or _extract_user_ip_from_headers(request) From c7658286adfc69f54b1afb6ca9e97096e19699c7 Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 13 Sep 2024 15:51:33 -0500 Subject: [PATCH 09/12] Replaced setup.py with pyproject.toml. --- pyproject.toml | 54 ++++++++++++++++++++++++++++++++++ setup.py | 79 -------------------------------------------------- 2 files changed, 54 insertions(+), 79 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9595f351 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,54 @@ +[project] +name = "rollbar" +dynamic = ["version"] +description = "Easy and powerful exception tracking with Rollbar. Send messages and exceptions with arbitrary context, get back aggregates, and debug production issues quickly." +readme = "README.md" +license = {file = "LICENSE"} +maintainers = [{name = "Rollbar, Inc.", email = "support@rollbar.com"}] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: AsyncIO", + "Framework :: Bottle", + "Framework :: Django", + "Framework :: Flask", + "Framework :: Pylons", + "Framework :: Pyramid", + "Framework :: Twisted", + "Intended Audience :: Developers", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Software Development", + "Topic :: Software Development :: Bug Tracking", + "Topic :: Software Development :: Testing", + "Topic :: Software Development :: Quality Assurance", + "Topic :: System :: Logging", + "Topic :: System :: Monitoring", +] +requires-python = ">=3.6" +dependencies = [ + "requests>=0.12.1", +] + +[project.urls] +Homepage = "https://rollbar.com/" +Documentation = "https://docs.rollbar.com/docs/python" +Changes = "https://github.com/rollbar/pyrollbar/blob/master/CHANGELOG.md" +Source = "https://github.com/rollbar/pyrollbar/" + +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.dynamic] +version = {attr = "rollbar.__version__"} diff --git a/setup.py b/setup.py deleted file mode 100644 index 87f4fc1a..00000000 --- a/setup.py +++ /dev/null @@ -1,79 +0,0 @@ -import re -import os.path -from setuptools import setup, find_packages - -HERE = os.path.abspath(os.path.dirname(__file__)) - -README_PATH = os.path.join(HERE, 'README.md') -try: - with open(README_PATH) as fd: - README = fd.read() -except IOError: - README = '' - -INIT_PATH = os.path.join(HERE, 'rollbar/__init__.py') -with open(INIT_PATH) as fd: - INIT_DATA = fd.read() - VERSION = re.search(r"^__version__ = ['\"]([^'\"]+)['\"]", INIT_DATA, re.MULTILINE).group(1) - -tests_require = [ - 'webob', - 'blinker', - 'httpx', - 'aiocontextvars; python_version == "3.6"' -] - -setup( - name='rollbar', - packages=find_packages(), - version=VERSION, - entry_points={ - 'paste.filter_app_factory': [ - 'pyramid=rollbar.contrib.pyramid:create_rollbar_middleware' - ], - 'console_scripts': ['rollbar=rollbar.cli:main'] - }, - description='Easy and powerful exception tracking with Rollbar. Send ' - 'messages and exceptions with arbitrary context, get back ' - 'aggregates, and debug production issues quickly.', - long_description=README, - long_description_content_type="text/markdown", - author='Rollbar, Inc.', - author_email='support@rollbar.com', - test_suite='rollbar.test.discover', - url='http://github.com/rollbar/pyrollbar', - classifiers=[ - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3 :: Only", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Framework :: AsyncIO", - "Framework :: Bottle", - "Framework :: Django", - "Framework :: Flask", - "Framework :: Pylons", - "Framework :: Pyramid", - "Framework :: Twisted", - "Intended Audience :: Developers", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Software Development", - "Topic :: Software Development :: Bug Tracking", - "Topic :: Software Development :: Testing", - "Topic :: Software Development :: Quality Assurance", - "Topic :: System :: Logging", - "Topic :: System :: Monitoring", - ], - install_requires=[ - 'requests>=0.12.1', - ], - tests_require=tests_require, -) From 6f56942d5b261f3e6c811dc4cb1f1dcb44c2a3c0 Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 13 Sep 2024 15:52:18 -0500 Subject: [PATCH 10/12] Moved testing from setup.py to tox. --- .github/workflows/ci.yml | 5 ++++- .gitignore | 1 + tox.ini | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tox.ini diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5df9d370..28b033bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,5 +132,8 @@ jobs: if: ${{ contains(matrix.framework, 'FASTAPI_VERSION') }} run: pip install fastapi==$FASTAPI_VERSION + - name: Install Tox + run: pip install tox + - name: Run tests - run: python setup.py test + run: tox diff --git a/.gitignore b/.gitignore index f82be943..4cbc538a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ Pipfile Pipfile.lock .pytest_cache/ .python-version +.tox/ diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..52a2a955 --- /dev/null +++ b/tox.ini @@ -0,0 +1,10 @@ +[tox] +requires = tox>=4 + +[testenv] +deps = webob + blinker + httpx + aiocontextvars; python_version == "3.6" +description = run unit tests +commands = python -m unittest rollbar.test.discover From 0f00667c49fe0d8b3a7e678e194682e684e51c43 Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 13 Sep 2024 15:57:29 -0500 Subject: [PATCH 11/12] Updated tox min version to 3 to support Python 3.6. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 52a2a955..e535f841 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -requires = tox>=4 +requires = tox>=3 [testenv] deps = webob From c7130d559405df9c96b873a6287723654ac992d9 Mon Sep 17 00:00:00 2001 From: Daniel Morell Date: Fri, 13 Sep 2024 16:20:29 -0500 Subject: [PATCH 12/12] Moved Python 3.6 tests out of tox. --- .github/workflows/ci.yml | 9 +++++++-- tox.ini | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28b033bc..dbf2cc00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,7 +97,7 @@ jobs: - name: Install Python 3.6 dependencies if: ${{ contains(matrix.python-version, '3.6') }} # typing-extensions dropped support for Python 3.6 in version 4.2 - run: pip install "typing-extensions<4.2" requests==2.27.0 blinker==1.5 immutables==0.19 + run: pip install "typing-extensions<4.2" requests==2.27.0 blinker==1.5 immutables==0.19 webob blinker httpx aiocontextvars - name: Install Python 3.7 dependencies if: ${{ contains(matrix.python-version, '3.7') }} @@ -135,5 +135,10 @@ jobs: - name: Install Tox run: pip install tox - - name: Run tests + - name: Run tests (skip on Python 3.6) + if: ${{ !contains(matrix.python-version, '3.6') }} run: tox + + - name: Run tests (Python 3.6) + if: ${{ contains(matrix.python-version, '3.6') }} + run: python -m unittest rollbar.test.discover diff --git a/tox.ini b/tox.ini index e535f841..a05ac4b2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,9 @@ [tox] -requires = tox>=3 +requires = tox>=4 [testenv] deps = webob blinker httpx - aiocontextvars; python_version == "3.6" description = run unit tests commands = python -m unittest rollbar.test.discover