From f09ea20cf51f53e5e489815fe06fc8be611e063e Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Fri, 17 Feb 2023 14:23:59 +0100 Subject: [PATCH 1/3] Add deprecation warning for EventStore based I/O --- include/podio/ASCIIWriter.h | 3 ++- include/podio/EventStore.h | 3 ++- include/podio/IMetaDataProvider.h | 3 ++- include/podio/IReader.h | 3 ++- include/podio/PythonEventStore.h | 3 ++- include/podio/ROOTWriter.h | 3 ++- include/podio/SIOWriter.h | 3 ++- include/podio/TimedWriter.h | 3 ++- include/podio/utilities/Deprecated.h | 7 +++++++ 9 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 include/podio/utilities/Deprecated.h diff --git a/include/podio/ASCIIWriter.h b/include/podio/ASCIIWriter.h index 9916e6819..54fd2040b 100644 --- a/include/podio/ASCIIWriter.h +++ b/include/podio/ASCIIWriter.h @@ -2,6 +2,7 @@ #define PODIO_ASCIIWRITER_H #include "podio/EventStore.h" +#include "podio/utilities/Deprecated.h" #include #include @@ -30,7 +31,7 @@ struct ColWriter : public ColWriterBase { typedef std::map FunMap; -class ASCIIWriter { +class DEPR_EVTSTORE ASCIIWriter { public: ASCIIWriter(const std::string& filename, EventStore* store); diff --git a/include/podio/EventStore.h b/include/podio/EventStore.h index e84b7e57e..f8ee70dc4 100644 --- a/include/podio/EventStore.h +++ b/include/podio/EventStore.h @@ -13,6 +13,7 @@ #include "podio/GenericParameters.h" #include "podio/ICollectionProvider.h" #include "podio/IMetaDataProvider.h" +#include "podio/utilities/Deprecated.h" /** This is an *example* event store @@ -33,7 +34,7 @@ class IReader; typedef std::map RunMDMap; typedef std::map ColMDMap; -class EventStore : public ICollectionProvider, public IMetaDataProvider { +class DEPR_EVTSTORE EventStore : public ICollectionProvider, public IMetaDataProvider { public: /// Make non-copyable EventStore(const EventStore&) = delete; diff --git a/include/podio/IMetaDataProvider.h b/include/podio/IMetaDataProvider.h index ca735b7ec..20f1941b0 100644 --- a/include/podio/IMetaDataProvider.h +++ b/include/podio/IMetaDataProvider.h @@ -2,6 +2,7 @@ #define PODIO_IMETADATAPROVIDER_H #include "podio/GenericParameters.h" +#include "podio/utilities/Deprecated.h" namespace podio { @@ -9,7 +10,7 @@ namespace podio { * @author F. Gaede, DESY * @date Apr 2020 */ -class IMetaDataProvider { +class DEPR_EVTSTORE IMetaDataProvider { public: /// destructor diff --git a/include/podio/IReader.h b/include/podio/IReader.h index 12fcb6944..13553bf87 100644 --- a/include/podio/IReader.h +++ b/include/podio/IReader.h @@ -2,6 +2,7 @@ #define PODIO_IREADER_H #include "podio/podioVersion.h" +#include "podio/utilities/Deprecated.h" #include #include @@ -22,7 +23,7 @@ class CollectionBase; class CollectionIDTable; class GenericParameters; -class IReader { +class DEPR_EVTSTORE IReader { public: virtual ~IReader() = default; /// Read Collection of given name diff --git a/include/podio/PythonEventStore.h b/include/podio/PythonEventStore.h index 5ab68f15e..8ae4d5140 100644 --- a/include/podio/PythonEventStore.h +++ b/include/podio/PythonEventStore.h @@ -4,12 +4,13 @@ #include "podio/EventStore.h" #include "podio/GenericParameters.h" #include "podio/IReader.h" +#include "podio/utilities/Deprecated.h" #include namespace podio { -class PythonEventStore { +class DEPR_EVTSTORE PythonEventStore { public: /// constructor from filename PythonEventStore(const char* filename); diff --git a/include/podio/ROOTWriter.h b/include/podio/ROOTWriter.h index 6ba79d06e..6751809ae 100644 --- a/include/podio/ROOTWriter.h +++ b/include/podio/ROOTWriter.h @@ -4,6 +4,7 @@ #include "podio/CollectionBase.h" #include "podio/CollectionBranches.h" #include "podio/EventStore.h" +#include "podio/utilities/Deprecated.h" #include "TBranch.h" @@ -18,7 +19,7 @@ class TFile; class TTree; namespace podio { -class ROOTWriter { +class DEPR_EVTSTORE ROOTWriter { public: ROOTWriter(const std::string& filename, EventStore* store); diff --git a/include/podio/SIOWriter.h b/include/podio/SIOWriter.h index af2a9ffff..29ce0bc7d 100644 --- a/include/podio/SIOWriter.h +++ b/include/podio/SIOWriter.h @@ -4,6 +4,7 @@ #include "podio/CollectionBase.h" #include "podio/EventStore.h" #include "podio/SIOBlock.h" +#include "podio/utilities/Deprecated.h" // SIO specific includes #include @@ -15,7 +16,7 @@ // forward declarations namespace podio { -class SIOWriter { +class DEPR_EVTSTORE SIOWriter { public: SIOWriter(const std::string& filename, EventStore* store); diff --git a/include/podio/TimedWriter.h b/include/podio/TimedWriter.h index 32660408c..90e154273 100644 --- a/include/podio/TimedWriter.h +++ b/include/podio/TimedWriter.h @@ -3,6 +3,7 @@ #include "podio/BenchmarkRecorder.h" #include "podio/BenchmarkUtil.h" +#include "podio/utilities/Deprecated.h" #include #include @@ -10,7 +11,7 @@ namespace podio { template -class TimedWriter { +class DEPR_EVTSTORE TimedWriter { using ClockT = benchmark::ClockT; public: diff --git a/include/podio/utilities/Deprecated.h b/include/podio/utilities/Deprecated.h new file mode 100644 index 000000000..566bca814 --- /dev/null +++ b/include/podio/utilities/Deprecated.h @@ -0,0 +1,7 @@ +#ifndef PODIO_UTILITIES_DEPRECATED_H +#define PODIO_UTILITIES_DEPRECATED_H + +#define DEPR_EVTSTORE \ + [[deprecated("The EventStore based I/O model is deprecated and will be removed. Switch to the Frame based model.")]] + +#endif // PODIO_UTILITIES_DEPRECATED_H From b95f72629e7d85dd36458ab589da92fe26d082c7 Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Fri, 17 Feb 2023 14:36:04 +0100 Subject: [PATCH 2/3] Add deprecation warning for EventStore python bindings --- python/podio/EventStore.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/podio/EventStore.py b/python/podio/EventStore.py index c1a2df3d4..d2df33cbe 100644 --- a/python/podio/EventStore.py +++ b/python/podio/EventStore.py @@ -1,7 +1,10 @@ """Python EventStore for reading files with podio generated datamodels""" +import warnings +warnings.warn("The EventStore based I/O model is deprecated and will be removed. Switch to the Frame based model.", + FutureWarning) -from ROOT import gSystem +from ROOT import gSystem # pylint: disable=wrong-import-position gSystem.Load("libpodioPythonStore") # noqa: E402 from ROOT import podio # noqa: E402 # pylint: disable=wrong-import-position From 7668f6b764b61fadd6c81fb167e0ec5afea6ad0a Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Fri, 17 Feb 2023 15:10:15 +0100 Subject: [PATCH 3/3] Make CI pass while deprecation warnings are in --- .github/workflows/edm4hep.yaml | 2 +- .github/workflows/key4hep.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/ubuntu.yml | 2 +- .pre-commit-config.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/edm4hep.yaml b/.github/workflows/edm4hep.yaml index 827a513bf..188c56f64 100644 --- a/.github/workflows/edm4hep.yaml +++ b/.github/workflows/edm4hep.yaml @@ -46,7 +46,7 @@ jobs: cmake -DENABLE_SIO=ON \ -DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror " \ + -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror -Wno-error=deprecated-declarations " \ -DUSE_EXTERNAL_CATCH2=ON \ -DBUILD_TESTING=OFF\ -G Ninja .. diff --git a/.github/workflows/key4hep.yml b/.github/workflows/key4hep.yml index 824d135b8..f831301fe 100644 --- a/.github/workflows/key4hep.yml +++ b/.github/workflows/key4hep.yml @@ -29,7 +29,7 @@ jobs: cmake -DENABLE_SIO=ON \ -DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror " \ + -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror -Wno-error=deprecated-declarations " \ -DUSE_EXTERNAL_CATCH2=ON \ -G Ninja .. echo "::endgroup::" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 24849718b..a57fa321a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: cmake -DENABLE_SIO=${{ matrix.sio }} \ -DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror " \ + -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror -Wno-error=deprecated-declarations " \ -DUSE_EXTERNAL_CATCH2=OFF \ -G Ninja .. echo "::endgroup::" diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 8aea735f3..16ae05bee 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -29,7 +29,7 @@ jobs: cmake -DENABLE_SIO=${{ matrix.sio }} \ -DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror " \ + -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always -Werror -Wno-error=deprecated-declarations " \ -DUSE_EXTERNAL_CATCH2=OFF \ -DPODIO_SET_RPATH=ON \ -G Ninja .. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5e0928466..48edb8d6b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: hooks: - id: clang-tidy name: clang-tidy - entry: clang-tidy -warnings-as-errors='*' -p compile_commands.json + entry: clang-tidy -warnings-as-errors='*,-clang-diagnostic-deprecated-declarations' -p compile_commands.json types: [c++] exclude: (tests/(datamodel|src)/.*(h|cc)|podioVersion.in.h) language: system