Skip to content

fix: suppress CLI noise from tests and workspace scripts #1209

@Jammy2211

Description

@Jammy2211

Overview

Running unit tests, integration tests, and workspace scripts produces noisy stderr/stdout from third-party libraries (JAX CUDA plugin warnings, SQLAlchemy relationship warnings), stray print() calls in library code, and verbose INFO-level logging. This clutters output and makes it hard to spot real problems. This task systematically finds and fixes these noise sources across all PyAuto repos, and creates a /cli_noise_clean skill to re-audit periodically.

Plan

  • Add filterwarnings to pyproject.toml in all 5 library repos to suppress known benign warnings (JAX CUDA, SQLAlchemy overlaps, numba caching)
  • Fix the root cause of SQLAlchemy relationship warnings in PyAutoFit's Fit class
  • Audit and convert stray print() calls in library code to logging.debug() or remove
  • Set default logging level to WARNING for library loggers during test runs via conftest.py
  • Run representative workspace scripts (simulators + modeling with TEST_MODE=2) to catch JAX/runtime noise that only appears during real execution
  • Add JAX-specific filters for compilation warnings, XLA backend messages, and numpy deprecation warnings triggered through JAX
  • Create a /cli_noise_clean skill for periodic re-auditing
Detailed implementation plan

Affected Repositories

  • PyAutoFit (primary)
  • PyAutoConf
  • PyAutoArray
  • PyAutoGalaxy
  • PyAutoLens
  • autolens_workspace (scripts for noise audit)
  • autogalaxy_workspace (scripts for noise audit)

Work Classification

Library (with workspace script auditing)

Branch Survey

Repository Current Branch Dirty?
PyAutoConf main clean
PyAutoFit main clean
PyAutoArray main 2 modified
PyAutoGalaxy main clean
PyAutoLens main 1 modified

Suggested branch: feature/cli-noise-clean
Worktree root: ~/Code/PyAutoLabs-wt/cli-noise-clean/

Implementation Steps

  1. pytest filterwarnings — Add to [tool.pytest.ini_options] in each repo's pyproject.toml:

    • ignore::DeprecationWarning:jax
    • ignore:cuda_plugin_extension:UserWarning:jax_plugins
    • ignore:relationship.*will copy column:sqlalchemy.exc.SAWarning
    • Additional filters discovered during workspace script runs
  2. Fix SQLAlchemy relationship overlapsPyAutoFit/autofit/database/model/fit.py (lines 330-344): add overlaps parameter to arrays and hdus relationships

  3. Audit print() statements — Scan library code for print() producing test noise:

    • PyAutoFit/autofit/non_linear/analysis/analysis.py (VRAM profiling)
    • PyAutoFit/autofit/aggregator/aggregator.py
    • PyAutoArray/autoarray/mask/ derivation files
    • Convert to logger.debug() or remove if debug leftovers
  4. Logging level in conftest.py — Add logging.getLogger("autoarray").setLevel(logging.WARNING) etc. to root conftest.py in each repo

  5. Workspace script noise audit — Run with PYAUTO_TEST_MODE=2 PYAUTO_WORKSPACE_SMALL_DATASETS=1:

    • autolens_workspace/*/simulator.py scripts
    • autolens_workspace/*/modeling.py scripts
    • autogalaxy_workspace equivalents
    • Capture stderr, parse for JAX compilation warnings, XLA messages, numpy deprecation warnings
  6. JAX-specific filters — Based on modeling run output, add filters for JAX compilation warnings, XLA backend messages, numpy deprecation warnings via JAX's numpy shim

  7. Create /cli_noise_clean skill — Skill with modes:

    • /cli_noise_clean — full audit (pytest + workspace scripts)
    • /cli_noise_clean pytest — pytest-only
    • /cli_noise_clean scripts — workspace scripts only

Key Files

  • */pyproject.toml — pytest warning filters
  • PyAutoFit/autofit/database/model/fit.py — SQLAlchemy relationship fix
  • */conftest.py — logging level configuration
  • admin_jammy/skills/cli_noise_clean/SKILL.md — new skill

Original Prompt

Click to expand starting prompt

When we run unit tests, integration tests, scripts and other things we get noise on the command
line due to libraries versions, badly formatted docstrings and other issues.

Can you do a full run through of different scripts over the projects, find this noise and gradually fix
the issues as they crop up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions