github astral-sh/uv 0.4.0

latest releases: 0.5.1, 0.5.0, 0.4.30...
2 months ago

Release Notes

This release adds first-class support for Python projects that are not designed as Python packages (e.g., web applications, data science projects, etc.).

In doing so, it includes some breaking changes around uv's handling of projects. Previously, uv required that all projects could be built into distributable Python packages, and installed them into the virtual environment. Projects created by uv init always included a [build-system] definition and existing projects that did not define a [build-system] would use the legacy setuptools build backend by default.

Most users are not developing libraries that need to be packaged and published to PyPI. Instead, they're building applications using web frameworks, or running collections of Python scripts in the project's root directory. In these cases, requiring a [build-system] was confusing and error-prone. In this release, uv changes the default behavior to orient around these common use cases.

In summary, the major changes are:

  • uv no longer attempts to package and install projects that do not define a [build-system].
    • While the project itself will not be installed into the virtual environment, its dependencies will still be included.
    • The previous behavior can be recovered by setting package = true in the [tool.uv] section of your pyproject.toml.
  • uv init no longer creates a src/ directory or defines a [build-system] by default.
    • The previous behavior can be recovered with uv init --lib or uv init --app --package.
  • uv allows and recommends including [project] definitions in virtual workspace roots.
    • Previously, the uv required the [project] section to be omitted.
  • uv allows disabling packaging of projects, even if they define a [build-system], by setting package = false in the [tool.uv] section of your pyproject.toml.

See the latest documentation on build systems in projects for more details.

Enhancements

  • Add first-class support for non-packaged projects (#6585)
  • Add --app and --lib options to uv init (#6689)
  • Use virtual source label in lockfile for non-packaged dependencies (#6728)
  • Read hash from URL fragment if --hashes are omitted (#6731)
  • Support {package}@{version} in uv tool install (#6762)
  • Publish additional Docker tags without patch version (#6734)

Bug fixes

  • Accept either strings or structs for hosts (#6763)
  • Avoid including non-excluded members in parent workspaces (#6735)
  • Avoid reading stale .egg-info from mutable sources (#6714)
  • Avoid writing invalid PEP 723 scripts on tool.uv.sources (#6706)
  • Compare virtual members when invalidating lockfile (#6754)
  • Do not require workspace members to sync with --frozen (#6737)
  • Implement deserialization for trusted host (#6716)
  • Avoid showing duplicate paths in uv python list (#6740)
  • Raise an error for unclosed script tags in PEP 723 scripts (#6704)

Documentation

  • Add dependabot and renovate documentation page (#6236)
  • Bind to the host to allow connections in FastAPI Docker example (#6753)
  • Fix some broken links (#6705)
  • Update FastAPI guide for virtual projects and use uv init to create the pyproject.toml (#6752)
  • Update project documentation for the application / library concepts (#6718)
  • Update workspace documentation to remove legacy virtual projects (#6720)

Install uv 0.4.0

Install prebuilt binaries via shell script

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.4.0/uv-installer.sh | sh

Install prebuilt binaries via powershell script

powershell -c "irm https://github.com/astral-sh/uv/releases/download/0.4.0/uv-installer.ps1 | iex"

Download uv 0.4.0

File Platform Checksum
uv-aarch64-apple-darwin.tar.gz Apple Silicon macOS checksum
uv-x86_64-apple-darwin.tar.gz Intel macOS checksum
uv-i686-pc-windows-msvc.zip x86 Windows checksum
uv-x86_64-pc-windows-msvc.zip x64 Windows checksum
uv-aarch64-unknown-linux-gnu.tar.gz ARM64 Linux checksum
uv-i686-unknown-linux-gnu.tar.gz x86 Linux checksum
uv-powerpc64-unknown-linux-gnu.tar.gz PPC64 Linux checksum
uv-powerpc64le-unknown-linux-gnu.tar.gz PPC64LE Linux checksum
uv-s390x-unknown-linux-gnu.tar.gz S390x Linux checksum
uv-x86_64-unknown-linux-gnu.tar.gz x64 Linux checksum
uv-armv7-unknown-linux-gnueabihf.tar.gz ARMv7 Linux checksum
uv-aarch64-unknown-linux-musl.tar.gz ARM64 MUSL Linux checksum
uv-i686-unknown-linux-musl.tar.gz x86 MUSL Linux checksum
uv-x86_64-unknown-linux-musl.tar.gz x64 MUSL Linux checksum
uv-arm-unknown-linux-musleabihf.tar.gz ARMv6 MUSL Linux (Hardfloat) checksum
uv-armv7-unknown-linux-musleabihf.tar.gz ARMv7 MUSL Linux checksum

Don't miss a new uv release

NewReleases is sending notifications on new releases.