pyg4ometry icon indicating copy to clipboard operation
pyg4ometry copied to clipboard

Replace `print()` statements with `logging` module calls

Open gipert opened this issue 11 months ago • 5 comments

And uncomment this:

https://github.com/g4edge/pyg4ometry/blob/ebbcc37f1707c5b1cba8e41849d53d83c11b50a6/pyproject.toml#L120

gipert avatar Dec 19 '24 13:12 gipert

I already have a large patch for some other print calls, where I

  • replace them with logging
  • or with exceptions
  • or remove them entirely....

But removing all of them is a huge amount of work, so I stopped at some point.

ManuelHu avatar Dec 19 '24 14:12 ManuelHu

Do you have this WIP on some branch? Maybe you could open a draft PR and someone else can work on it at some point.

gipert avatar Dec 19 '24 14:12 gipert

not yet, but I will try to get it up in the near future.

ManuelHu avatar Dec 19 '24 14:12 ManuelHu

Happy to contribute to this once there is a WIP PR there is a mixture of IO, and there are some areas which logging is used others with a profusion of print. Moving to a more notebook environment, the printout is very annoying. I learned to program in the 80s and still love a print out, apologies.

stewartboogert avatar Dec 19 '24 15:12 stewartboogert

after #229, there are some parts that have not been converted from print to logging. Those are listed in pyproject.toml:

"src/pyg4ometry/gui/**" = ["T201"]
"src/pyg4ometry/{fluka,convert}/**" = ["T201"]
"src/pyg4ometry/{io,analysis,features}/**" = ["T201"]
"src/pyg4ometry/{freecad,pycgal,pyoce}/**" = ["T201"]
"src/pyg4ometry/visualisation/{UsdViewer,ViewerHierarchyBase}.py" = ["T201"]

this is all code that I personally do not use ever/very often, so I do not have a good understanding of it. After converting the files (switchting to logging calls, or adding noqa comments), the files should be removed from the exclusion list.

ManuelHu avatar Feb 04 '25 11:02 ManuelHu