Skip to content

Commit

Permalink
feat: add python scripting with uv
Browse files Browse the repository at this point in the history
  • Loading branch information
byt3h3ad committed Jan 14, 2025
1 parent 1a1f2e6 commit 7cba7b1
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions python/running-scripts-with-uv.md
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)

0 comments on commit 7cba7b1

Please sign in to comment.