Skip to content

uv doesn't include environment markers in compiled output #2349

Closed as not planned
@euan-reid

Description

@euan-reid

In a current project I have an optional dependency that's not available on Windows - specifically, uvloop (used for better performance by uvicorn) is currently unavailable for Windows. As such, I set environment markers to only install that extra on non-Windows platforms. However, when I run uv pip compile it doesn't include the markers in the output requirements.txt.

uv version output:

uv 0.1.17 (bb2d06cbb 2024-03-10)

Minimal pyproject.toml:

[project]
name = "coolapp"
version = "0.1.0"
dependencies = [
    'fastapi~=0.110',
    'uvicorn[standard]~=0.27 ; platform_system != "Windows"',
    'uvicorn~=0.27 ; platform_system == "Windows"',
]

Relevant section of compiled requirements.txt

uvicorn==0.27.1
uvloop==0.19.0
    # via uvicorn
watchfiles==0.21.0
    # via uvicorn
websockets==12.0
    # via uvicorn

For now I'm just manually working aroung it by adding a ; platform_system ~= "Windows" on the line with uvloop before git committing, but that's obviously not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions