Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request]: Please make rich logging library an optional dependency #1342

Open
3 tasks done
lucasgadams opened this issue Jun 24, 2024 · 1 comment
Open
3 tasks done
Assignees

Comments

@lucasgadams
Copy link

What were you trying to do?

The inclusion of the rich library can disrupt an applications normal logging. Most libraries that utilize rich make it an optional dependency and then if the package is installed will use it automatically (see httpx, structlog). For a production setting, most do not want any "rich" output, and while in ocrmypdf you can disable the progress bar from printing, you can't uninstall rich because it is a primary dependency and is imported into the package. Ideally we can make this an optional dependency so I can leave it out from our production installs. Thanks!

Where are you installing/running from?

PyPI (pip, poetry, pipx, etc.)

OCRmyPDF version

16.4.0

What operating system are you working on?

Linux

Operating system details and version

No response

Simple sanity checks

  • Operating system is currently supported by its vendor (not end of life)
  • Python version is compatible with OCRmyPDF
  • This issue is not about a specific input file

Relevant log output

No response

@lucasgadams lucasgadams added the triage Issue needs triage label Jun 24, 2024
@jbarlow83 jbarlow83 added enhancement and removed triage Issue needs triage labels Jun 26, 2024
@jbarlow83
Copy link
Collaborator

ocrmypdf is first and foremost a command line application. Many users don't know that it's implemented in Python and don't necessarily care. They install using $somepackagemanager install ocrmypdf.

Your two examples, httpx and structlog, are both Python libraries consumed mainly using import, with optional CLI components that I wasn't aware of till now. Their CLI use case is a minority of users; for ocrmypdf it's the vast majority. I checked httpie, another CLI first program, and found it also brings in rich by default.

I would accept a PR that would make ocrmypdf work if rich happens to not be installed, but I'm not quite prepared to support removing it as a default when installed with pip install ocrmypdf. Requiring something like pip install ocrmypdf[cli] would inconvenience the vast majority of users. The default configuration in the PR needs to remain the best UX for the majority of users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants