Skip to content

Conversation

@nsheff
Copy link
Contributor

@nsheff nsheff commented Nov 5, 2025

This commit addresses namespace pollution and improves tool compatibility by replacing all wildcard imports with explicit imports in the looper package.

Benefits:

  • Enables mkdocstrings documentation generation
  • Improves code clarity by making dependencies explicit
  • Follows PEP 8 best practices
  • Reduces namespace pollution

All changes are backwards compatible and maintain existing functionality.

…tibility

This commit addresses namespace pollution and improves tool compatibility by
replacing all wildcard imports with explicit imports in the looper package.

Changes:
- looper/looper.py: Removed unused 'from peppy.const import *', replaced
  wildcard imports with explicit imports for exceptions and constants
- looper/__init__.py: Removed unused 'from .const import *'
- looper/utils.py: Replaced 'from typing import *', 'from peppy.const import *',
  and 'from .const import *' with explicit imports
- looper/conductor.py: Replaced 'from typing import *' and 'from .const import *'
  with explicit imports, removed duplicate PipelineLevel import
- looper/cli_pydantic.py: Replaced all wildcard imports with explicit imports,
  removed unused 'from .parser_types import *'
- looper/project.py: Replaced 'from .exceptions import *' and 'from .utils import *'
  with explicit imports
- looper/pipeline_interface.py: Replaced 'from .const import *' with explicit imports
- looper/plugins.py: Replaced 'from .const import *' with explicit imports
- looper/processed_project.py: Removed unused 'from eido.const import *' and
  'from eido.exceptions import *'

Benefits:
- Enables mkdocstrings documentation generation
- Improves code clarity by making dependencies explicit
- Follows PEP 8 best practices
- Reduces namespace pollution

All changes are backwards compatible and maintain existing functionality.
- Add missing import of peppyProject from peppy
- Add missing typing imports (Iterable, List, NoReturn, Union)
- Move CONFIG_KEY import from looper.const to peppy.const where it's actually defined

This fixes the ImportError that was preventing tests from running.
- Add missing 'import os' in cli_pydantic.py
- Add missing eido imports in processed_project.py (PROP_KEY, EidoSchemaInvalidError)

Fixes NameError exceptions that were causing pytest failures.
@nsheff nsheff requested a review from Copilot November 5, 2025 22:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces wildcard imports (from module import *) with explicit imports across multiple looper modules to improve code clarity and maintainability. This change makes dependencies explicit and helps prevent namespace pollution.

  • Replaced wildcard imports from typing, peppy.const, eido.const, eido.exceptions, and internal looper modules with explicit imports
  • Added specific imports for all constants, types, and exceptions used in each module
  • Removed unused wildcard import from looper/__init__.py

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
looper/utils.py Replaced wildcard imports from typing, peppy.const, and .const with explicit imports of required symbols
looper/project.py Replaced wildcard imports from typing, .exceptions, .utils, and .const with explicit imports; added missing imports from peppy
looper/processed_project.py Replaced wildcard imports from eido.const and eido.exceptions with explicit imports
looper/plugins.py Replaced wildcard import from .const with explicit imports of three constants
looper/pipeline_interface.py Replaced wildcard import from .const with explicit imports of required constants
looper/looper.py Removed unused wildcard import from peppy.const and replaced wildcard imports from .exceptions and .const with explicit imports
looper/conductor.py Replaced wildcard imports from typing and .const with explicit imports; removed duplicate import
looper/cli_pydantic.py Added missing os import and replaced wildcard imports from .const, .exceptions, .looper, and .parser_types with explicit imports
looper/init.py Removed unused wildcard import from .const

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 36 to 57
from .const import (
ALL_SUBCMD_KEY,
CLI_KEY,
CLI_PROJ_ATTRS,
COMPUTE_PACKAGE_KEY,
DRY_RUN_KEY,
EXTRA_KEY,
FILE_CHECKS_KEY,
INPUT_SCHEMA_KEY,
LOOPER_KEY,
OUTDIR_KEY,
OUTPUT_SCHEMA_KEY,
PEP_CONFIG_KEY,
PIFACE_KEY_SELECTOR,
PIPELINE_INTERFACE_PIPELINE_NAME_KEY,
PIPELINE_INTERFACES_KEY,
PipelineLevel,
PIPESTAT_KEY,
RESULTS_SUBDIR_KEY,
SAMPLE_PL_ARG,
SUBMISSION_SUBDIR_KEY,
)
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'ALL_SUBCMD_KEY' is not used.
Import of 'CLI_KEY' is not used.
Import of 'PEP_CONFIG_KEY' is not used.

Copilot uses AI. Check for mistakes.
nsheff and others added 2 commits November 5, 2025 17:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nsheff nsheff merged commit e26ca88 into dev Nov 5, 2025
3 checks passed
@nsheff nsheff deleted the claude/fix-wildcard-imports-011CUqUJXq9pvPPEhAodsrA8 branch November 5, 2025 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants