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 .venv
Create with a specific Python version:
uv venv .venv --python=3.10
Activate the environment:
source .venv/bin/activate
Add packages:
uv pip install requests
Add multiple packages:
uv pip install requests pandas matplotlib
Add with specific version:
uv pip install requests==2.31.0
Remove packages:
uv pip uninstall requests
List installed packages:
uv pip list
Run a Python script:
uv python script.py
Install project dependencies from requirements.txt:
uv pip install -r requirements.txt
Create a pyproject.toml file:
[tool.uv.scripts]
start = "python app.py"
test = "pytest"
lint = "flake8"
Run scripts:
uv run start
uv run test
uv run lint