-
Notifications
You must be signed in to change notification settings - Fork 7
remove wildcard imports #556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove wildcard imports #556
Conversation
…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.
There was a problem hiding this 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.
| 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, | ||
| ) |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit addresses namespace pollution and improves tool compatibility by replacing all wildcard imports with explicit imports in the looper package.
Benefits:
All changes are backwards compatible and maintain existing functionality.