Skip to content

PEP 723 support is faulty: uses wrong TOML field name #1187

@flying-sheep

Description

@flying-sheep

Describe the bug
#1100 implemented PEP 723 wrong:

for requirement in pyproject.get("run", {}).get("requirements", []):

this should be "dependencies", not "requirements".

How to reproduce

Create a PEP 723 compliant script:

#!/usr/bin/env -S pipx run
# /// pyproject
# run.dependencies = ["httpx"]
# ///
import httpx

and run it using pipx run ./script.py. You’ll see

Traceback (most recent call last):
  File "<string>", line 11, in <module>
ModuleNotFoundError: No module named 'requests'

Expected behavior

pipx should run it in a temporary environment.

Also the traceback should contain the file name, not <string>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions