Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3603881
Removed support for Python 3.6/3.7 missing ContextVar
danielmorell Jan 9, 2026
2414d2a
Initial work on adding typing.
danielmorell Jan 16, 2026
4813578
Merge branch 'master' into added/typehints
danielmorell Jan 16, 2026
57d5945
Added type stubs and typed imports where possible ignored the rest
danielmorell Feb 21, 2026
eb58125
Merge branch 'master' into added/typehints
danielmorell Apr 17, 2026
93194dc
Merge branch 'master' into added/typehints
danielmorell Apr 17, 2026
9ef5009
Added initial round of typehints
danielmorell Apr 17, 2026
158f79e
Fixed missing route passed to app init.
danielmorell May 1, 2026
2312565
Fixed check_level function to allow custom levels.
danielmorell May 1, 2026
a8102b7
Removed commented code.
danielmorell May 1, 2026
83434fc
Address review comments.
danielmorell May 8, 2026
a02b8c0
Fixed deprecated Starlette routing in tests.
danielmorell May 8, 2026
1a3c08d
More code review fixes.
danielmorell May 8, 2026
e15edf1
Removed unnecessary missing contextvar test.
danielmorell May 8, 2026
6318c76
Addressed code review comments.
danielmorell May 8, 2026
3fe9121
Dropped support for Python 3.9
danielmorell May 15, 2026
f347608
Updated 3.9 Unions and Optional to modern syntax
danielmorell May 15, 2026
50e8438
Moved type only imports to behind typing.TYPE_CHECKING.
danielmorell May 15, 2026
fba47bd
Require mypy < 2.0 until it is more stable.
danielmorell May 15, 2026
944c701
Fixed FastAPI tests skipped because of incorrect version.
danielmorell May 16, 2026
2557198
Fixed tests and addressed review comments.
danielmorell May 16, 2026
98944e5
Fixed httpx JSON encoding in FastAPI tests.
danielmorell May 16, 2026
ed68dc9
Fixed adjustment to JSON body in FastAPI tests.
danielmorell May 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, '3.10', 3.11, 3.12, 3.13, 3.14]
python-version: ['3.10', 3.11, 3.12, 3.13, 3.14]
framework:
- NONE
- FLASK_VERSION=2.3.3
Expand All @@ -23,12 +23,6 @@ jobs:
- PYRAMID_VERSION=2.0.2
- FASTAPI_VERSION=0.115.1 httpx==0.27.2 python-multipart==0.0.12
- FASTAPI_VERSION=0.118.3 httpx==0.28.1 python-multipart==0.0.20
exclude:
# Test frameworks on the python versions they support, according to pypi registry

# Django
- framework: DJANGO_VERSION=5.2.7
python-version: 3.9

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -73,3 +67,28 @@ jobs:

- name: Run tests
run: pytest

types:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', 3.11, 3.12, 3.13, 3.14]

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
pip install --group test .
pip install --group type .


- name: Check Types
run: mypy
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Python notifier for reporting exceptions, errors, and log messages to [Rollbar](

| PyRollbar Version | Python Version Compatibility | Support Level |
|-------------------|-----------------------------------------------|---------------------|
| 1.4.0 | 3.9, 3.10, 3.11, 3.12, 3.13, 3.14 | Full |
| 1.4.0 | 3.10, 3.11, 3.12, 3.13, 3.14 | Full |
| 0.16.3 | 2.7, 3.4, 3.5, 3.6, 3.7. 3.8, 3.9, 3.10, 3.11 | Security Fixes Only |

#### Support Level Definitions
Expand Down
23 changes: 21 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -39,19 +38,36 @@
"Topic :: System :: Logging",
"Topic :: System :: Monitoring",
]
requires-python = ">=3.9"
requires-python = ">=3.10"
Comment thread
danielmorell marked this conversation as resolved.
dependencies = [
"requests>=0.12.1",
"typing_extensions; python_version < \"3.11\""
]

[dependency-groups]
test = [
"blinker",
"httpx",
"pytest",
"python-multipart",
"webob",

Check warning on line 53 in pyproject.toml

View check run for this annotation

Claude / Claude Code Review

Missing 'packaging' in test dependency group

Test file `rollbar/test/fastapi_tests/test_routing.py:6` directly imports `from packaging.version import Version` (new in this PR for the version comparison fix), but `packaging` is not declared in the `test` dependency group in `pyproject.toml`. This currently works only transitively because pytest declares `packaging>=22` as a runtime requirement; declaring direct imports as direct deps is the same hygiene the PR already applied for `typing_extensions` (added to runtime deps because the PR new
Comment on lines 47 to 53
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Test file rollbar/test/fastapi_tests/test_routing.py:6 directly imports from packaging.version import Version (new in this PR for the version comparison fix), but packaging is not declared in the test dependency group in pyproject.toml. This currently works only transitively because pytest declares packaging>=22 as a runtime requirement; declaring direct imports as direct deps is the same hygiene the PR already applied for typing_extensions (added to runtime deps because the PR newly imports it). One-line fix: add "packaging", to the test group around line 48.

Extended reasoning...

What the bug is

This PR's rollbar/test/fastapi_tests/test_routing.py newly imports from packaging.version import Version at line 6 — the import replaces an earlier lexicographic fastapi.__version__ >= '0.41.0' comparison with a proper Version(...) comparison (line 13), and is also used inside test_should_send_payload_with_request_body to gate on Version(httpx_version) >= Version('0.28.0'). The test dependency group in pyproject.toml (lines 47–54), however, lists only:

test = ["blinker", "httpx", "pytest", "python-multipart", "webob"]

No packaging entry.

Why it works today (and the refutation)

A refuting verifier correctly pointed out that pytest declares packaging>=22 as a hard runtime dependency, so any environment that installs the test group transitively pulls packaging. CI therefore never sees an ImportError. That argument is accurate, and is exactly why this is filed as a nit rather than normal severity — there is no current breakage and the practical risk is near-zero because pytest has required packaging for many releases.

Why it's still worth flagging

The same PR explicitly applied the opposite convention one section above: it added typing_extensions; python_version < "3.11" to the runtime dependencies list (pyproject.toml:44) precisely because the PR newly introduced from typing_extensions import Unpack in rollbar/__init__.py. The 'if you directly import it, declare it' rule is therefore the rule this PR itself sets. Leaving packaging as a transitive-only dep contradicts that rule by one line in the same file.

Relying on transitive dependencies for direct imports is a well-known anti-pattern (PEP 508 / packaging best practices). The failure mode is small but real: if pytest ever drops its packaging dep (theoretical, but not impossible across major-version bumps), or if a downstream user installs the test target with a minimal resolver, the import fails at collection time because the import is at module scope and pytest evaluates it before any skipUnless guard runs.

How to fix

Single-line change in pyproject.toml around line 48:

test = [
    "blinker",
    "httpx",
    "packaging",
    "pytest",
    "python-multipart",
    "webob",
]

Step-by-step proof

  1. Read rollbar/test/fastapi_tests/test_routing.py:6from packaging.version import Version. Unconditional, module-scope import (pytest collection alone triggers it).
  2. Read rollbar/test/fastapi_tests/test_routing.py:13ALLOWED_FASTAPI_VERSION = Version(fastapi.__version__) >= Version('0.41.0'). Confirms the import is actually used.
  3. Read pyproject.toml:47-54test group has blinker, httpx, pytest, python-multipart, webob. No packaging.
  4. Read pyproject.toml:42-45 — runtime dependencies now includes typing_extensions; python_version < "3.11". Confirms this PR's own convention: 'direct import → direct declaration'.
  5. packaging is currently available in every test environment only because pytest (in the test group) declares Requires-Dist: packaging>=22 in its METADATA. That is a transitive guarantee, not a direct one.

]

type = [
"bottle",
"djangorestframework-stubs[compatible-mypy]",
"django-stubs",
"fastapi",
"mypy ~= 1.20.2",
"pyramid",
"quart",
"sanic",
"starlette",
"tornado",
"twisted",
"uvicorn",
]
Comment thread
danielmorell marked this conversation as resolved.

[project.urls]
Homepage = "https://rollbar.com/"
Documentation = "https://docs.rollbar.com/docs/python"
Expand All @@ -64,6 +80,9 @@
[project.entry-points."paste.filter_app_factory"]
pyramid = "rollbar.contrib.pyramid:create_rollbar_middleware"

[tool.mypy]
packages = ["rollbar"]

[tool.pytest]
testpaths = [
"rollbar/test",
Expand Down
Loading
Loading