-
Notifications
You must be signed in to change notification settings - Fork 216
Open
Milestone
Description
I looked a bit through the bug tracker but didn't see this: I have a few projects that I develop with uv run --script, along with PEP 723 inline metadata for my dependencies. I find this is really nice for simple scripts in my monorepo:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = "==3.12.*"
# dependencies = [
# "mlx>=0.26.1",
# "mlx-lm>=0.25.2",
# "urllib3==1.26.6",
# "click>=8.0.0",
# "rich>=13.0.0",
# "prompt-toolkit>=3.0.0",
# ]
# ///
...However, if I execute uvx ty check foo.py on these files, then the following occurs:
aseipp@navi bizarro % uvx ty check bizarro.py
WARN ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.
error[unresolved-import]: Cannot resolve imported module `click`
--> bizarro.py:31:8
|
30 | # Third-party imports
31 | import click
| ^^^^^
... many more errors follow ...
I think this can obviously be avoided by using pyproject.toml, but it would be wonderful if ty could also work for this case too. I have a bunch of one-shot scripts like this that I occasionally need to import a library with, so it'd be nice to not require more project scaffolding. Q: Perhaps it should also require a --script argument to ty check to make it more uniform with uv run?
P.S. Many thanks for uv/ruff/ty!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels