astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
23.19k stars 667 forks source link

Exporting requirements-dev.txt without `python_full_version` #8034

Closed Jkrox closed 1 week ago

Jkrox commented 1 week ago

uv version: 0.4.9

command executed: uv export --extra dev --no-hashes -o requirements-dev.txt . I got the following thing:

requirements-dev.txt

# This file was autogenerated via `uv export`.
aiohappyeyeballs==2.4.3 ; python_full_version >= '3.12'
aiohttp==3.10.8 ; python_full_version >= '3.12'
aiosignal==1.3.1 ; python_full_version >= '3.12'
annotated-types==0.7.0 ; python_full_version >= '3.12'
anyio==4.6.0 ; python_full_version >= '3.12'
attrs==24.2.0 ; python_full_version >= '3.12'
certifi==2024.8.30 ; python_full_version >= '3.12'
charset-normalizer==3.3.2 ; python_full_version >= '3.12'
click==8.1.7 ; python_full_version >= '3.12'
colorama==0.4.6 ; (python_full_version >= '3.12' and sys_platform == 'win32') or (python_full_version >= '3.12' and platform_system == 'Windows')
dnspython==2.7.0 ; python_full_version >= '3.12'
email-validator==2.2.0 ; python_full_version >= '3.12'
fastapi==0.115.0 ; python_full_version >= '3.12'
fastapi-cli==0.0.5 ; python_full_version >= '3.12'
frozenlist==1.4.1 ; python_full_version >= '3.12'
h11==0.14.0 ; python_full_version >= '3.12'
httpcore==1.0.6 ; python_full_version >= '3.12'
httptools==0.6.1 ; python_full_version >= '3.12'
httpx==0.27.2 ; python_full_version >= '3.12'
idna==3.10 ; python_full_version >= '3.12'
jinja2==3.1.4 ; python_full_version >= '3.12'
markdown-it-py==3.0.0 ; python_full_version >= '3.12'
markupsafe==3.0.0 ; python_full_version >= '3.12'
mdurl==0.1.2 ; python_full_version >= '3.12'
multidict==6.1.0 ; python_full_version >= '3.12'
packaging==24.1 ; python_full_version >= '3.12'
psutil==6.0.0 ; python_full_version >= '3.12'
pydantic==2.9.2 ; python_full_version >= '3.12'
pydantic-core==2.23.4 ; python_full_version >= '3.12'
pygments==2.18.0 ; python_full_version >= '3.12'
python-dotenv==1.0.1 ; python_full_version >= '3.12'
python-multipart==0.0.12 ; python_full_version >= '3.12'
pyyaml==6.0.2 ; python_full_version >= '3.12'
requests==2.32.3 ; python_full_version >= '3.12'
rich==13.9.2 ; python_full_version >= '3.12'
ruff==0.6.9 ; python_full_version >= '3.12'
shellingham==1.5.4 ; python_full_version >= '3.12'
sniffio==1.3.1 ; python_full_version >= '3.12'
starlette==0.38.6 ; python_full_version >= '3.12'
typer==0.12.5 ; python_full_version >= '3.12'
typing-extensions==4.12.2 ; python_full_version >= '3.12'
urllib3==2.2.3 ; python_full_version >= '3.12'
uvicorn==0.31.0 ; python_full_version >= '3.12'
uvloop==0.20.0 ; python_full_version >= '3.12' and platform_python_implementation != 'PyPy' and sys_platform != 'cygwin' and sys_platform != 'win32'
watchfiles==0.24.0 ; python_full_version >= '3.12'
websockets==13.1 ; python_full_version >= '3.12'
yarl==1.13.1 ; python_full_version >= '3.12'

I'm trying to do uv pip freeze > requirements-dev.txt but with the dev stuff.

pyproject.toml

[project]
name = "test"
version = "0.1.0"
description = "test"
requires-python = ">=3.12"
dependencies = [
    "aiohappyeyeballs==2.4.3",
    "aiohttp==3.10.8",
    "aiosignal==1.3.1",
    "attrs==24.2.0",
    "certifi==2024.8.30",
    "charset-normalizer==3.3.2",
    "fastapi[standard]>=0.115.0",
    "frozenlist==1.4.1",
    "idna==3.10",
    "multidict==6.1.0",
    "packaging==24.1",
    "psutil>=6.0.0",
    "pydantic>=2.9.2",
    "python-dotenv==1.0.1",
    "requests==2.32.3",
    "urllib3==2.2.3",
    "websockets==13.1",
    "yarl==1.13.1",
]

[tool.uv]
dev-dependencies = [
    "ruff>=0.6.9",
]
Jkrox commented 1 week ago

I was able to solve the issue, just update uv, now uv 0.4.20, and use the following command:

uv export --only-dev --no-hashes | awk '{print $1}' FS=' ;' > requirements-dev.txt.

or if you want to export with no dev dependencies, use this command:

uv export --no-dev --no-hashes | awk '{print $1}' FS=' ;' > requirements.txt.

References:

the option --only-dev was added exactly in the version 0.4.11.