This project is a template UV project
- create project by UV, because UV is so fast
As a python Beginer, use UV to management Python Dev evnironment, key points for basic usage:
- How to use uv to create a virtual environment with different python version
- How to use uv to add/remove python packages
- How to use uv to Build/Run python project
- How to use uv to manage different scripts like package.json in Node.js
Please replay as simple as possible in markdown format, and use code block to show the commands, please make sure as simple as possible, and one question then another.
Don't explain too much, just focus on how to use uv to manage a python project without any advanced knowledge or skill.
Create a virtual environment with the default Python version:
uv venv .venvCreate with a specific Python version:
uv venv .venv --python=3.10Activate the environment:
source .venv/bin/activateAdd packages:
uv pip install requestsAdd multiple packages:
uv pip install requests pandas matplotlibAdd with specific version:
uv pip install requests==2.31.0Remove packages:
uv pip uninstall requestsList installed packages:
uv pip listRun a Python script:
uv python script.pyInstall project dependencies from requirements.txt:
uv pip install -r requirements.txtCreate a pyproject.toml file:
[tool.uv.scripts]
start = "python app.py"
test = "pytest"
lint = "flake8"Run scripts:
uv run startuv run testuv run lint