LCM Logo
Project Scaffolding

Python

Installation

Our recommendation is to use uv to install and manage Python versions, packages, and virtual environments.

Install uv

You can install uv using Homebrew on macOS or Linux:

shell
brew install uv

You can install uv using Scoop on Windows:

shell
scoop install uv

Create a new project using uv

uv is a highly performant and comprehensive tool that can install and manage:

  • Python itself
  • packages / dependencies
  • virtual environments / projects
shell
uv init .
# or if you want to create a library project
uv init --lib .
# or local package
uv init --package .

Add dependencies

For example, to add polars and duckdb as dependencies, you can use the following command:

shell
uv add polars duckdb

This will create the pyproject.toml file and add the dependencies to it, as well as create a virtual environment for the project. You can also add other dependencies as needed.

Development dependencies

Development dependencies are packages that are only needed during development, such as testing frameworks or linters. To add development dependencies, you can use the --dev flag. For example, to add pytest as a development dependency, you can use the following command:

shell
uv add --dev pytest

This will add the specified packages to the dev dependency group of the pyproject.toml file.

If using VS Code with the Jupyter interactive window, you need to install the ipykernel package as a development dependency:

shell
uv add --dev ipykernel

Pruning the uv cache

uv caches downloaded packages and Python versions to speed up future installations. This needs to be pruned from time to time to free up disk space:

shell
uv cache prune

Resources

uv docs

On this page