v1.0.24
What's Changed
CSnakes now has the ability to install packages using uv
instead of pip
, which is significantly faster and improves app startup times.
Installing dependencies with uv
uv
is an alternative to pip that can also install requirements from a file like requirements.txt
or pyproject.toml
. UV has a major benefit in a 10-100x speedup over pip, so your CSnakes applications will be faster to start.
To use uv to install packages:
...
services
.WithPython()
.WithVirtualEnvironment(Path.Join(home, ".venv"))
.WithUvInstaller("requirements.txt"); // Optional - give the name of the requirements file, or pyproject.toml
Some other important notes about this implementation.
- Only uses uv to install packages and does not use uv to create projects or virtual environments.
- Must be used with
WithVirtualEnvironment()
, as pip requires a virtual environment to install packages into. - Will use the
UV_CACHE_DIR
environment variable to cache the packages in a directory if set. - Will disable the cache if the
UV_NO_CACHE
environment variable is set.
Features
- Add a UV package installer by @tonybaloney in #327
Bug Fixes
Other Updates
- Reduce logging noise and move pip/env output to debug logs by @tonybaloney in #325
- Reuse computed installation lock file path by @atifaziz in #328
Full Changelog: v1.0.23...v1.0.24