Skip to content

Refactor /bnf/setup.py to use qualified imports - #143

Merged
hzhangxyz merged 2 commits into
mainfrom
copilot/refactor-import-statements
Dec 20, 2025
Merged

Refactor /bnf/setup.py to use qualified imports#143
hzhangxyz merged 2 commits into
mainfrom
copilot/refactor-import-statements

Conversation

Copilot AI commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

Converts import style from from xxx import yyy to import xxx with qualified usage throughout the file.

Changes

  • from pathlib import Pathimport pathlib with pathlib.Path usage
  • from setuptools import setupimport setuptools with setuptools.setup usage
  • from setuptools.command.build_py import build_pyimport setuptools.command.build_py with setuptools.command.build_py.build_py usage

No functional changes, imports now follow the preferred style convention.

Original prompt

This section details on the original issue you should resolve

<issue_title>/bnf/setup.py 做一下变换</issue_title>
<issue_description>我不喜欢from xxx import yyy

我喜欢import xxx然后用的时候xxx.yyy</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor import statements in setup.py Refactor /bnf/setup.py to use qualified imports Dec 20, 2025
Copilot AI requested a review from hzhangxyz December 20, 2025 10:43
@hzhangxyz
hzhangxyz marked this pull request as ready for review December 20, 2025 10:47
Copilot AI review requested due to automatic review settings December 20, 2025 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 from style 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.

Comment thread bnf/setup.py


class BuildWithAntlr(build_py):
class BuildWithAntlr(setuptools.command.build_py.build_py):

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@hzhangxyz
hzhangxyz merged commit 3f532da into main Dec 20, 2025
73 checks passed
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.

/bnf/setup.py 做一下变换

3 participants