Refactor /bnf/setup.py to use qualified imports - #143
Conversation
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the import statements in bnf/setup.py to use qualified imports instead of the from xxx import yyy style, aligning with the author's preference for explicit module qualification at usage sites.
Key Changes:
- Converted three import statements from
fromstyle to module imports - Updated all usages throughout the file to use fully qualified names
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
| class BuildWithAntlr(build_py): | ||
| class BuildWithAntlr(setuptools.command.build_py.build_py): |
There was a problem hiding this comment.
The class inheritance uses an unnecessarily verbose qualified path. While setuptools.command.build_py.build_py is technically correct, it impacts readability and goes against common Python conventions. Consider using a more concise approach like importing the module as an alias (e.g., from setuptools.command import build_py) or at minimum using the shorter setuptools.command.build_py module with an alias to access the class.
Converts import style from
from xxx import yyytoimport xxxwith qualified usage throughout the file.Changes
from pathlib import Path→import pathlibwithpathlib.Pathusagefrom setuptools import setup→import setuptoolswithsetuptools.setupusagefrom setuptools.command.build_py import build_py→import setuptools.command.build_pywithsetuptools.command.build_py.build_pyusageNo functional changes, imports now follow the preferred style convention.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.