-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Scripting with uv | ||
|
||
If you want to do some scripting in Python and have to use a dependency, instead of the traditional methods of: | ||
|
||
1. Run pip install pandas, potentially modifying your global environment. | ||
|
||
2. Take the proper route: | ||
- Create a virtual environment | ||
- Activate the virtual environment | ||
- pip install pandas | ||
- Run python | ||
|
||
And if you have to use a Python version other than the global one, you end up using `pyenv`, install the version and set that version as local. | ||
|
||
So, worst case: | ||
|
||
1. pyenv install 3.12. | ||
|
||
2. pyenv local 3.12. | ||
|
||
3. python -m venv .venv. | ||
|
||
4. source .venv/bin/activate. | ||
|
||
5. pip install pandas. | ||
|
||
6. python. | ||
|
||
With uv, it’s just 1 command: | ||
|
||
``` | ||
uv run --python 3.12 --with pandas python | ||
``` | ||
|
||
[source](https://valatka.dev/2025/01/12/on-killer-uv-feature.html) |