Skip to content

Commit a39f72e

Browse files
ariostasianna
andauthored
chore: warn about switching to writing RNTuples by default (#1488)
* Added warning about behavior change * Show warning only once --------- Co-authored-by: Ianna Osborne <[email protected]>
1 parent ee0ca89 commit a39f72e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
124124
filterwarnings = [
125125
"error",
126126
"default:module 'sre_.*' is deprecated:DeprecationWarning",
127-
"ignore:unclosed transport <asyncio.sslproto._SSLProtocolTransport" # https://github.com/aio-libs/aiohttp/issues/1115
127+
"ignore:unclosed transport <asyncio.sslproto._SSLProtocolTransport", # https://github.com/aio-libs/aiohttp/issues/1115
128+
"ignore: .*will default to writing RNTuples.*:FutureWarning"
128129
]
129130
log_cli_level = "info"
130131
markers = [

src/uproot/writing/identify.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"""
1818
from __future__ import annotations
1919

20+
import warnings
2021
from collections.abc import Mapping
2122

2223
import numpy
@@ -26,6 +27,9 @@
2627
import uproot.pyroot
2728
import uproot.writing._cascadetree
2829

30+
# To keep track of whether we've warned about switching to writing RNTuple by default
31+
_warned_rntuple_by_default = False
32+
2933

3034
def add_to_directory(obj, name, directory, streamers):
3135
"""
@@ -148,6 +152,16 @@ def add_to_directory(obj, name, directory, streamers):
148152
is_ttree = True
149153

150154
if is_ttree:
155+
global _warned_rntuple_by_default # noqa: PLW0603
156+
if not _warned_rntuple_by_default:
157+
warnings.warn(
158+
"Starting in version 5.7.0, Uproot will default to writing RNTuples instead of TTrees. "
159+
"You will need to use `mktree` to create to explicitly create a TTree. "
160+
"Please update your code accordingly.",
161+
FutureWarning,
162+
stacklevel=4,
163+
)
164+
_warned_rntuple_by_default = True
151165
tree = directory.mktree(name, metadata)
152166
tree.extend(data)
153167

0 commit comments

Comments
 (0)