I used to think that I had matured. That I should stop letting my emotions get the better of me. Turns out there's only so much one can bottle up before it snaps.

Allow me to introduce you folks to this wonderful piece of software: PaddleOCR (https://github.com/PaddlePaddle/...). At this time I'll gladly take any free OCR library that isn't Tesseract. I saw the thing, thought: "Heh. 3 lines quick start. Cool.", and the accuracy is decent. I thought it was a treasure trove that I could shill to other people. That was before I found out how shit of a package it is.

First test, I found out that logging is enabled by default. Sure, logging is good. But I was already rocking my own logger, and I wanted it to shut the fuck up about its log because it was noise to the stuffs I actually wanted to log. Could not intercept its logging events, and somehow just importing it set the global logging level from INFO to DEBUG. Maybe it's Python's quirk, who knows. Check the source code, ah, the constructors gaves `show_log` arg to control logging. The fuck? Why? Why not let the user opt into your logs? Why is the logging on by default?

But sure, it's just logging. Surely, no big deal. SURELY, it's got decent documentation that is easily searchable. Oh, oh sweet summer child, there ain't. Docs are just some loosely bundled together Markdowns chucked into /doc. Hey, docs at least. Surely, surely there's something somewhere about all the args to the OCRer constructor somewhere. NOPE! Turns out, all the args, you gotta reference its `--help` switch on the command line. And like all "good" software from academia, unless you're part of academia, it's obtuse as fuck. Fine, fuck it, back to /doc, and it took me 10 minutes of rummaging to find the correct Markdown file that describes the params. And good-fucking-luck to you trying to translate all them command line args into Python constructor params.

"But PTH, you're overreacting!". No, fuck you, I'm not. Guess whose code broke today because of a 4th number version bump. Yes, you are reading correctly: My code broke, because of a 4th number version bump, from, to, introducing a breaking change. Why? Because apparently, upstream decided to nest the OCR result in another layer. Fuck knows why. They did change the doc. Guess what they didn't do. PROVIDING, A DAMN, RELEASE NOTE. Checked their repo, checked their tags, nothing marking any releases from the 3rd number. All releases goes straight to PyPI, quietly, silently, like a moron. And bless you if you tell me "Well you should have reviewed the docs". If you do that for your project, for all of your dependencies, my condolences.

Could I just fix it? Yes. Without ranting? Yes. But for fuck sake if you're writing software for a wide audience you're kinda expected to be even more sane in your software's structure and release conventions. Not this. And note: The people writing this, aren't random people without coding expertise. But man they feel like they are.

  • 0
    Python has a full logging implementation in the stdlib...

    Constructor injection is wrong on so many levels in python for logging.
  • 0
    @IntrusionCM I get that from time to time when I mention "I use a custom logger". I don't mind using stdlib's logging, but it tends to get pushed down the list because it looks intimidating to get pretty logging going. `loguru` for me these days.

    I will get around to learning `logging` some day.
  • 0
    @PythonTryHard what I meant (sorry for being bit unclear) is that dependency injection for configuring logging is an anti pattern imho in python.

    Dependency injection is an object oriented pattern which makes imho less sense in python - even less to inject not an object, but rather a variable for configuring...

    I would expect a global variable or a global configuration possibility.

    Afaik loguru is just the logging implementation on steroids (not saying it's what I would use nor that it's bad) - you still can e.g. set in your library a global logger variable, get that and use it to reconfigure the logger.

    Sorry, brain fried, hope it makes sense.
  • 1
    @IntrusionCM Ah, I see. Thank you for your clarification!
  • 1
    Welcome to open source, where the commands are made up and the documentation doesn't matter!
  • 0
    Why not tesseract? Is it so shitty?
Add Comment