ninia / jep

Embed Python in Java
Other
1.3k stars 147 forks source link

Implement `isatty` method in StreamRedirect #357

Closed jonathanindig closed 2 years ago

jonathanindig commented 2 years ago

The isatty() function can be used to check whether a file object is interactive.

By default, sys.stdout and sys.stderr implement this method, so some Python libraries assume it will always be present and call sys.stdout.isatty() without checking to see whether it's implemented.

Technically, at least as far as I am able to tell, there is no strict definition of what a Python "file object" is, so callers should really be checking whether the out file in question has the isatty attribute. Unfortunately, they often don't.

We ran into this issue in Polynote and implemented isatty in our own wrapper. I figured it makes sense to implement it in your wrapper as well.

jonathanindig commented 2 years ago

Thank you for the review! If it's not too much to ask, it would be great to get this and #353 in some sort of release (4.0.1?) given their low risk. Is there anything I could do to help with that? Of course totally your call, just trying to avoid having to fork Jep internally if at all possible.

bsteffensmeier commented 2 years ago

If it's not too much to ask, it would be great to get this and #353 in some sort of release (4.0.1?) given their low risk. Is there anything I could do to help with that? Of course totally your call, just trying to avoid having to fork Jep internally if at all possible.

@ndjensen just identified several things that could cause us problems in python 3.11(#354, #355, #356). If those changes end up small I would like to get them in 4.0.1 also.

I'd also like to test out Java 17 before a release since that is the new LTS and if there are any issues there it would need another release.

I'll have more time at the end of the month so I am thinking of releasing 4.0.1 around new years if that helps you.