Skip to content

chore(examples): add -S to env shebangs for portability - #3210

Open
lucky-verma wants to merge 1 commit into
openai:nextfrom
lucky-verma:chore/examples-shebang-portable
Open

chore(examples): add -S to env shebangs for portability#3210
lucky-verma wants to merge 1 commit into
openai:nextfrom
lucky-verma:chore/examples-shebang-portable

Conversation

@lucky-verma

@lucky-verma lucky-verma commented May 8, 2026

Copy link
Copy Markdown

five executable examples use an env shebang without -S:

examples/audio.py
examples/speech_to_text.py
examples/text_to_speech.py
examples/realtime/realtime.py
examples/realtime/push_to_talk_app.py

added push_to_talk_app.py per your review. i checked every mode-100755 file under examples/ and those five are the only ones missing -S. (azure.py, azure_ad.py and module_client.py are 755 with no shebang at all — different issue, left alone.)

also correcting myself: i said linux env splits the args so this only broke on older BSD. that's wrong, it fails there too — on coreutils 9.4 ./examples/audio.py gives env: 'rye run python': No such file or directory.

only shebang lines change. modes unchanged, ruff check + format clean on all five.

@DTiming24

Copy link
Copy Markdown

Good portability cleanup. env -S is a subtle but important change here; a brief note in the examples README about the minimum shell/coreutils support would help users on older environments avoid surprises.

@stainless-app
stainless-app Bot force-pushed the next branch 2 times, most recently from 317260c to e67afa8 Compare July 22, 2026 17:46

@jbeckwith-oai jbeckwith-oai 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.

One same-class executable shebang is still missing from this portability sweep: examples/realtime/push_to_talk_app.py:1 remains #!/usr/bin/env uv run (mode 100755). On Linux, the kernel passes uv run as one argument and GNU env tries to find an executable with that literal name, so direct invocation fails with the same error these four edits fix. Please change it to #!/usr/bin/env -S uv run as well. The four modified Rye shebangs, executable modes, Ruff/format checks, and compile validation are otherwise clean.

Five executable examples use an env shebang without the -S flag:
  examples/audio.py
  examples/speech_to_text.py
  examples/text_to_speech.py
  examples/realtime/realtime.py
  examples/realtime/push_to_talk_app.py

CONTRIBUTING.md shows the canonical form as #!/usr/bin/env -S rye run python.
Without -S the kernel passes the whole interpreter string to env as one
argument, so env looks for a program named 'rye run python' and the script
fails. This affects GNU env as well as BSD env. The first four use the rye
shebang; push_to_talk_app.py has the same defect with 'uv run'.

Only shebang lines change; executable modes are unchanged.
@lucky-verma
lucky-verma force-pushed the chore/examples-shebang-portable branch from dd7db2c to ae028fc Compare August 4, 2026 06:14
@lucky-verma

Copy link
Copy Markdown
Author

added -S to push_to_talk_app.py. also corrected the linux claim in the description — you were right, it fails there too. PTAL

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.

3 participants