Skip to content

Add support for single-file environment #20613

Description

@artzok

Summary

In my project, the Python scripts are all written in single files. Each file may have different environments. I hope that within a single Python script, I can declare the running Python version and related dependencies through comments,for example main.py:

# -*- env_name: figma_export_color -*-
# -*- py_version: 3.8 -*-
# -*- dependencies: [pyyaml==6.0.2, requests] -*-
import sys
import re
import yaml
import json
import os
...

then:

uv run main.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions