From 2c4d80969197213c89137aa0fc996ac7c28bc7be Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Sun, 5 Nov 2023 10:52:21 +0100 Subject: [PATCH] Decouple generation tools and files from the rest of podio python files --- python/CMakeLists.txt | 5 +++++ python/podio/__init__.py | 2 -- python/podio/test_ClassDefinitionValidator.py | 4 ++-- python/podio/test_DataModelJSONEncoder.py | 4 ++-- python/podio/test_MemberParser.py | 2 +- python/podio_class_generator.py | 4 ++-- python/podio_gen/__init__.py | 0 python/{podio => podio_gen}/generator_utils.py | 0 python/{podio => podio_gen}/podio_config_reader.py | 2 +- python/podio_schema_evolution.py | 2 +- tools/podio-vis | 2 +- 11 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 python/podio_gen/__init__.py rename python/{podio => podio_gen}/generator_utils.py (100%) rename python/{podio => podio_gen}/podio_config_reader.py (99%) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 5952f8959..76381dbc8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -23,6 +23,11 @@ else() ) endif() +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/podio_gen + DESTINATION ${podio_PYTHON_INSTALLDIR} + REGEX __pycache__ EXCLUDE + ) + #--- install templates --------------------------------------------------------- install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/templates DESTINATION ${podio_PYTHON_INSTALLDIR}) diff --git a/python/podio/__init__.py b/python/podio/__init__.py index 1414f58be..9de945d4a 100644 --- a/python/podio/__init__.py +++ b/python/podio/__init__.py @@ -3,8 +3,6 @@ from .__version__ import __version__ -from .podio_config_reader import * # noqa: F403, F401 - import ROOT # pylint: disable=wrong-import-order # Track whether we were able to dynamially load the library that is built by diff --git a/python/podio/test_ClassDefinitionValidator.py b/python/podio/test_ClassDefinitionValidator.py index c1b9d4cd1..42ad5903a 100644 --- a/python/podio/test_ClassDefinitionValidator.py +++ b/python/podio/test_ClassDefinitionValidator.py @@ -8,8 +8,8 @@ import unittest from copy import deepcopy -from podio.podio_config_reader import ClassDefinitionValidator, MemberVariable, DefinitionError -from podio.generator_utils import DataModel +from podio_gen.podio_config_reader import ClassDefinitionValidator, MemberVariable, DefinitionError +from podio_gen.generator_utils import DataModel def make_dm(components, datatypes, options=None): diff --git a/python/podio/test_DataModelJSONEncoder.py b/python/podio/test_DataModelJSONEncoder.py index b63ff22f0..b69055681 100644 --- a/python/podio/test_DataModelJSONEncoder.py +++ b/python/podio/test_DataModelJSONEncoder.py @@ -3,8 +3,8 @@ import unittest -from podio.generator_utils import DataModelJSONEncoder -from podio.podio_config_reader import MemberParser +from podio_gen.generator_utils import DataModelJSONEncoder +from podio_gen.podio_config_reader import MemberParser def get_member_var_json(string): diff --git a/python/podio/test_MemberParser.py b/python/podio/test_MemberParser.py index d99cd11d2..b860dc833 100644 --- a/python/podio/test_MemberParser.py +++ b/python/podio/test_MemberParser.py @@ -6,7 +6,7 @@ import unittest -from podio.podio_config_reader import MemberParser, DefinitionError +from podio_gen.podio_config_reader import MemberParser, DefinitionError class MemberParserTest(unittest.TestCase): diff --git a/python/podio_class_generator.py b/python/podio_class_generator.py index ad4cd5185..14d96f606 100755 --- a/python/podio_class_generator.py +++ b/python/podio_class_generator.py @@ -16,8 +16,8 @@ from podio_schema_evolution import DataModelComparator # dealing with cyclic imports from podio_schema_evolution import RenamedMember, root_filter, RootIoRule -from podio.podio_config_reader import PodioConfigReader -from podio.generator_utils import DataType, DefinitionError, DataModelJSONEncoder +from podio_gen.podio_config_reader import PodioConfigReader +from podio_gen.generator_utils import DataType, DefinitionError, DataModelJSONEncoder THIS_DIR = os.path.dirname(os.path.abspath(__file__)) TEMPLATE_DIR = os.path.join(THIS_DIR, 'templates') diff --git a/python/podio_gen/__init__.py b/python/podio_gen/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/python/podio/generator_utils.py b/python/podio_gen/generator_utils.py similarity index 100% rename from python/podio/generator_utils.py rename to python/podio_gen/generator_utils.py diff --git a/python/podio/podio_config_reader.py b/python/podio_gen/podio_config_reader.py similarity index 99% rename from python/podio/podio_config_reader.py rename to python/podio_gen/podio_config_reader.py index 303632367..b7e3790b0 100644 --- a/python/podio/podio_config_reader.py +++ b/python/podio_gen/podio_config_reader.py @@ -6,7 +6,7 @@ import warnings import yaml -from podio.generator_utils import MemberVariable, DefinitionError, BUILTIN_TYPES, DataModel +from podio_gen.generator_utils import MemberVariable, DefinitionError, BUILTIN_TYPES, DataModel class MemberParser: diff --git a/python/podio_schema_evolution.py b/python/podio_schema_evolution.py index e2b7a916f..b2c3b082b 100755 --- a/python/podio_schema_evolution.py +++ b/python/podio_schema_evolution.py @@ -5,7 +5,7 @@ import yaml -from podio.podio_config_reader import PodioConfigReader +from podio_gen.podio_config_reader import PodioConfigReader # @TODO: not really a good class model here diff --git a/tools/podio-vis b/tools/podio-vis index 032feb96e..667b5feab 100755 --- a/tools/podio-vis +++ b/tools/podio-vis @@ -4,7 +4,7 @@ import sys import argparse import yaml -from podio.podio_config_reader import PodioConfigReader +from podio_gen.podio_config_reader import PodioConfigReader try: from graphviz import Digraph except ImportError: