Skip to content

fix: restore print after fenn run#175

Open
sanmaxdev wants to merge 1 commit into
pyfenn:mainfrom
sanmaxdev:fix/restore-print-after-run
Open

fix: restore print after fenn run#175
sanmaxdev wants to merge 1 commit into
pyfenn:mainfrom
sanmaxdev:fix/restore-print-after-run

Conversation

@sanmaxdev

@sanmaxdev sanmaxdev commented Jun 24, 2026

Copy link
Copy Markdown

What does this PR do?

Restores Python's original print after Fenn.run() finishes, including when the entrypoint raises unexpectedly. User print() calls are still captured by the Fenn logger while the entrypoint is running, but exception handlers and code after run() now use normal stdout behavior again.

This also clears the configured log file paths when the logger closes so later standalone CLI logging cannot write to stale per-run files.

Issue link

Fixes #171

Checklist before merging

  • My commit history follows the conventional commits specification
  • Each commit represents a single, coherent unit of work
  • My changes are covered by unit tests
  • Unit tests successfully run locally
  • I have formatted Python code with the configured formatter
  • I have checked static type hinting with the configured pre-commit hook
  • I have added/updated necessary documentation, if required
  • I have checked for and resolved any merge conflicts
  • I have performed a self-review of my code

Additional notes

Validation run:

  • python -m pytest tests/unit/test_print_redirection.py tests/unit/cli/test_run_command.py tests/unit/utils/test_utils.py -q — 16 passed
  • python -m pytest tests/unit -q --ignore=tests/unit/vision --ignore=tests/unit/nn — 411 passed, 1 skipped
  • pre-commit run --files fenn/utils/logging.py fenn/core/fenn.py tests/unit/test_print_redirection.py — passed
  • git diff --cached --check — passed before commit

@ApusBerliozi

Copy link
Copy Markdown
Contributor

Yo @sanmaxdev, thanks for the PR

Please, write to an issue first next time, so there are no misunderstandings between contributors

@ApusBerliozi ApusBerliozi requested a review from blkdmr June 25, 2026 06:30
@ApusBerliozi ApusBerliozi added the bug Something isn't working label Jun 25, 2026
@sanmaxdev

Copy link
Copy Markdown
Author

Got it, thanks. I’ll open an issue first next time before sending a PR.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirect exceptions to original print

2 participants