clj-python / clj-python/libpython-clj

"auto flush" tty optionally

Open
#270 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
1.2k
Forks
74
PR merge metrics
No merged PRs in 30d

Description

The fix of #216 is not fully solving the issue.

using "libpythin-clj", there is so far no way to enforce "autoflush".
So when a third party python library does not explicitly flush, then we cannot force it.
And this can result in not seeing "debug outputs" on time for long running processes.
(in my tests they only came when the JVM proccess ends)

When using a normal "python" executable, there are some documented ways, but none of it is working with "libpython-clj".
(using "unbuffer" and similar tricks, like env varaibales: PYTHONUNBUFFERED=false)

On this branch https://github.com/behrica/libpython-clj/tree/auto-flush
I have a solution (so far hardcoded), which solves it.
It adds "flush" to each write.

This would need to be optional and configurable (eventually together with a way to configure as well the return value of "isatty" (which I did not need in my tests, false was working fine)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the auto-flush branch with the current libpython-clj implementation and review the fix for #216. Define how autoflush should be configured and verify it with a long-running process that writes through a third-party Python library; done means the option reliably flushes each write when enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.