cms-sw / cmssw

CMS Offline Software
http://cms-sw.github.io/
Apache License 2.0
1.08k stars 4.32k forks source link

imp module is deprecated in python3 #46113

Open makortel opened 1 month ago

makortel commented 1 month ago

(kind of continuation of https://github.com/cms-sw/cmssw/issues/34489)

The imp module is deprecated in python3, and its use leads to a warning printout

 DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp

The following files import imp https://github.com/cms-sw/cmssw/blob/393dfc8c101a1cb66d516875657023569c8277bb/Alignment/HIPAlignmentAlgorithm/scripts/batchHippy.py#L5 https://github.com/cms-sw/cmssw/blob/393dfc8c101a1cb66d516875657023569c8277bb/CalibMuon/DTCalibration/python/Workflow/Crabtools/crabFunctions.py#L11 https://github.com/cms-sw/cmssw/blob/393dfc8c101a1cb66d516875657023569c8277bb/PhysicsTools/Heppy/python/utils/cmsswPreprocessor.py#L5 https://github.com/cms-sw/cmssw/blob/393dfc8c101a1cb66d516875657023569c8277bb/PhysicsTools/Heppy/test/crab/heppy_crab_script.py#L25 https://github.com/cms-sw/cmssw/blob/393dfc8c101a1cb66d516875657023569c8277bb/PhysicsTools/HeppyCore/python/framework/heppy_loop.py#L11 https://github.com/cms-sw/cmssw/blob/393dfc8c101a1cb66d516875657023569c8277bb/PhysicsTools/HeppyCore/python/framework/looper.py#L9 https://github.com/cms-sw/cmssw/blob/393dfc8c101a1cb66d516875657023569c8277bb/PhysicsTools/HeppyCore/scripts/heppy_batch.py#L6

cmsbuild commented 1 month ago

cms-bot internal usage

cmsbuild commented 1 month ago

A new Issue was created by @makortel.

@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

makortel commented 1 month ago

assign Alignment/HIPAlignmentAlgorithm, CalibMuon/DTCalibration, PhysicsTools/Heppy, PhysicsTools/HeppyCore

cmsbuild commented 1 month ago

New categories assigned: alca,analysis

@tvami,@atpathak,@perrotta,@consuegs you have been requested to review this Pull request/Issue and eventually sign? Thanks

tvami commented 1 month ago

hi @arizzi, @gpetruc is Heppy still used for anything? I see updates that are back to like 6 years ago. If it's not used at all, maybe we should consider removing the package?

makortel commented 1 month ago

Mhm, my earlier git grep was insufficient. Here are more hits

Calibration/EcalAlCaRecoProducers/test/alcaSkimming.py:import os, sys, imp, re
CalibMuon/DTCalibration/python/Workflow/tools.py:import os,sys,imp

Geometry/CMSCommonData/test/dd4hep/runlegacy.py:import os, sys, imp, re
Geometry/ForwardCommonData/test/g4OverlapCheckHFNoseDD4hep_cfg.py:import os, sys, imp, re
Geometry/ForwardCommonData/test/g4OverlapCheckHFNoseDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalCellDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalDD4hep_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalEEDD4hep_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalEEDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalGeometryDD4hep_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalGeometryDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalHEmixDD4hep_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalHEmixDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalHEsilDD4hep_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalHEsilDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalWaferDD4hep_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpHGCalWaferDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/dumpTBModuleDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/g4OverlapCheckLayer_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/runHGCalDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/runHGCalTestDD4hep_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/runHGCalTestDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/testHGCGeometry_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/testHGCalPartialWaferTester_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/testHGCalScintID_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/testHGCalV17Shift_cfg.py:import os, sys, imp, re, random
Geometry/HGCalCommonData/test/python/testHGCalValidHex_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/testHGCalValidity_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/testHGCalWaferID_cfg.py:import os, sys, imp, re
Geometry/HGCalCommonData/test/python/testHGCalWafer_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalCellDumpDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalCorner_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeomCheck_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeomLocatorSc_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeomLocator_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeometryCheck_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeometryMouseBite_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeometryNewCorners_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeometryRotCheck_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeometryRotTest_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalGeometry_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalWaferInFileCheck_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalWaferInFileTest_cfg.py:import os, sys, imp, re
Geometry/HGCalGeometry/test/python/testHGCalWaferTypeTester_cfg.py:import os, sys, imp, re
Geometry/HGCalTBCommonData/test/python/dumpHGCalTB_cfg.py:import os, sys, imp, re
Geometry/HGCalTBCommonData/test/python/dumpTBModuleDDD_cfg.py:import os, sys, imp, re
Geometry/HGCalTBCommonData/test/python/g4OverlapCheck_cfg.py:import os, sys, imp, re
Geometry/HGCalTBCommonData/test/python/testHGCalTBNumbering_cfg.py:import os, sys, imp, re
Geometry/HcalCommonData/test/python/dumpGeometryDD4hep_cfg.py:import os, sys, imp, re
Geometry/HcalCommonData/test/python/dumpGeometryDDD_cfg.py:import os, sys, imp, re
Geometry/HcalCommonData/test/python/runHcalParametersFromDD4hepAnalyzer_cfg.py:import os, sys, imp, re
Geometry/HcalCommonData/test/python/runHcalParametersFromDDDAnalyzer_cfg.py:import os, sys, imp, re
Geometry/HcalCommonData/test/python/runHcalSimNumberingDDDTester_cfg.py:import os, sys, imp, re
Geometry/HcalCommonData/test/python/testHitRelabeller_cfg.py:import os, sys, imp, re
Geometry/TrackerCommonData/test/python/run21flat.py:import os, sys, imp, re

FWCore/ParameterSet/python/TreeCrawler.py:import sys, os, inspect, copy, struct, dis, imp

HLTrigger/Configuration/test/add/tracingImport.py:import sys, imp,
HLTrigger/Tools/python/PDRates.py:import sys, imp

PhysicsTools/Heppy/scripts/cmsBatch.py:import os, sys,  imp, re, pprint, string, time,shutil,copy,pickle,math

SimG4CMS/Calo/test/python/Gen_MinBias.py:import os, sys, imp, re, random
SimG4CMS/Calo/test/python/Gen_SingleMuon.py:import os, sys, imp, re, random
SimG4CMS/Calo/test/python/Sim2026_cfg.py:import os, sys, imp, re, random
SimG4CMS/Calo/test/python/SimRun3_cfg.py:import os, sys, imp, re, random
SimG4CMS/Calo/test/python/minbias.py:import os, sys, imp, re
SimG4CMS/Calo/test/python/minbias2026_cfg.py:import os, sys, imp, re
SimG4CMS/Calo/test/python/runHGC1_cfg.py:import os, sys, imp, re
SimG4CMS/Calo/test/python/testHGCalMouseBite_cfg.py:import os, sys, imp, re
SimG4CMS/Calo/test/python/ttbar.py:import os, sys, imp, re

Validation/HGCalValidation/scripts/testHGCalCellHitSum_cfg.py:import os, sys, imp, re
Validation/HGCalValidation/scripts/testHGCalDigi_cfg.py:import os, sys, imp, re, random
Validation/HGCalValidation/scripts/testHGCalMTRecoStudy_cfg.py:import os, sys, imp, re
Validation/HGCalValidation/scripts/testHGCalReco_cfg.py:import os, sys, imp, re, random
Validation/HGCalValidation/scripts/testHGCalSimSingleMuonPt100_cfg.py:import os, sys, imp, re, random
Validation/HGCalValidation/scripts/testHGCalSimTTBar_cfg.py:import os, sys, imp, re, random
Validation/HGCalValidation/test/python/protoValid_cfg.py:import os, sys, imp, re
makortel commented 1 month ago

assign geometry, upgrade, core, hlt, simulation, dqm

cmsbuild commented 1 month ago

New categories assigned: geometry,upgrade,core,hlt,simulation,dqm

@Dr15Jones,@Dr15Jones,@Martin-Grunewald,@mmusich,@civanch,@civanch,@bsunanda,@makortel,@makortel,@mdhildreth,@mdhildreth,@rvenditti,@syuvivida,@tjavaid,@nothingface0,@antoniovagnerini,@smuzaffar,@srimanob,@subirsarkar,@Moanwar,@kpedro88,@kpedro88 you have been requested to review this Pull request/Issue and eventually sign? Thanks

makortel commented 1 month ago

The import imp will fail in Python 3.12.

mmusich commented 1 month ago

+hlt

tvami commented 1 month ago

+analysis