python / python/pymanager

Support shebang additional arguments

Open
#242 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
344
Forks
74
Avg merge
1d 3h
Merged PRs (30d)
7

Description

Is your feature request related to a problem? Please describe.
I'm trying to set up a self contained script as discussed here. This works great on unix systems, but doesn't quite work on windows. One can almost create a shebang line that works on both with #!/usr/bin/env -S python3 -m uv run --script, except pymanager doesn't propagate the additional arguments.

Describe the solution you'd like
I would like the pymanager shebang handler to propagte additional arguments in the same way as the legacy launcher (reference).

Describe alternatives you've considered
One alternative would be to have pymanager support uv as a target directly, but that would require bespoke handling, and only work for this exact use-case. Handling additional arguments more generally would allow for running script through any sort of module (such as the built-in timeit module) or with any other arguments (such as -v).

Additional context
As mentioned above, the legacy launcher does support additional arguments, but doesn't support #!/usr/bin/env -S, so a cross-platform shebang line is not possible with either the legacy launcher or pymanager.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pymanager's shebang handler and compare its argument handling with the legacy launcher behavior described in the linked Python documentation. Trace how additional shebang arguments are parsed and passed when running a script, then verify that module and option arguments such as -m uv run --script, timeit, and -v are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.