Skip to content

[BUG] build_editable does not emit #!python shebang for scripts #4863

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

Closed
sbidoul opened this issue Mar 7, 2025 · 2 comments · Fixed by pypa/distutils#332
Closed

[BUG] build_editable does not emit #!python shebang for scripts #4863

sbidoul opened this issue Mar 7, 2025 · 2 comments · Fixed by pypa/distutils#332

Comments

@sbidoul
Copy link
Member

sbidoul commented Mar 7, 2025

setuptools version

75.8.2

Python version

3.13, probably irrelevant

OS

linux, probably irrelevant

Additional environment information

No response

Description

Assume a script like this

#!/usr/bin/env python3
from pkga import main

main()

and a setup.py like this

setup(
    name="pkga",
    scripts=["scripts/pkga-script"]
)

When running build_editable on such a project, the file pkga-0.1.0.data/scripts/pkga-script in the editable wheel produced has the path to the python interpreter used for the build.

This is unexpected. When running build_wheel, the shebang is #!python.

Note that script entry points correctly emit #!python both for regular and editable wheels.

Expected behavior

The shebang in the script in the editable wheel should be #!python too.

How to Reproduce

I don't have packaged the repro in a self-contained repo, but the example above should be explicit enough. Let me know if you need more information to reproduce.

Output

...

@sbidoul
Copy link
Member Author

sbidoul commented Mar 7, 2025

See astral-sh/uv#2744 for more context.

@jaraco
Copy link
Member

jaraco commented Mar 8, 2025

I pushed a commit and started on a PR before I realized the relevant logic is found in distutils.

@jaraco jaraco added technical debt standardization and removed bug Needs Triage Issues that need to be evaluated for severity and status. labels Mar 8, 2025
jaraco added a commit to pypa/distutils that referenced this issue Mar 8, 2025
oreo639 added a commit to oreo639/void-packages that referenced this issue Mar 31, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
oreo639 added a commit to oreo639/void-packages that referenced this issue Mar 31, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
oreo639 added a commit to oreo639/void-packages that referenced this issue Mar 31, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
oreo639 added a commit to oreo639/void-packages that referenced this issue Mar 31, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
oreo639 added a commit to oreo639/void-packages that referenced this issue Apr 1, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
oreo639 added a commit to void-linux/void-packages that referenced this issue Apr 1, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
moabeat-berlin pushed a commit to moabeat-berlin/void-packages that referenced this issue Apr 3, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
atk pushed a commit to atk/void-packages that referenced this issue Apr 30, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
worf1337 pushed a commit to worf1337/void-packages that referenced this issue May 2, 2025
Shebangs containing #!python are ignored currently, which causes a problem
since newer versions of python3-setuptools generate this, so replace them with
the proper shebang when encountered.

pypa/setuptools#4863
jaraco added a commit that referenced this issue May 3, 2025
… for portability.

Replacement implementation for #4863 following #4934.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants