astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
12.08k stars 425 forks source link

Add ; platform_system tag to requirements.lock where applicable #1166

Open hanerlend opened 1 week ago

hanerlend commented 1 week ago

Some times a requirements-file might include OS-specific requirements. This can be a problem if you develop on Windows, and want to deploy your project with Docker.

Example using Django + Daphne:

rye init newproject --virtual
cd newproject
rye add django daphne
rye sync

When trying to build a Docker image (which is linux, not windows), the build fails. To fix this, edit requirements.lock :

twisted-iocpsupport==1.0.4 ; platform_system == "Windows"

Coming from Poetry, this happened automatically. It would be really nice if this would also be implemented in Rye. 😊

bluss commented 3 days ago

This is possible with uv since yesterday ;) https://github.com/astral-sh/uv/pull/4505