48 lines
818 B
Markdown
48 lines
818 B
Markdown
# python-tests
|
|
|
|
> Python tool: https://github.com/astral-sh/uv
|
|
|
|
```shell
|
|
uvx pycowsay 'hello world!'
|
|
```
|
|
|
|
```shell
|
|
$ echo 'import requests; print(requests.get("https://astral.sh"))' > example.py
|
|
|
|
$ uv add --script example.py requests
|
|
Updated `example.py`
|
|
```
|
|
|
|
```shell
|
|
$ uv run example.py
|
|
Reading inline script metadata from: example.py
|
|
Installed 5 packages in 12ms
|
|
<Response [200]>
|
|
```
|
|
|
|
```shell
|
|
uv run --python 3.12 https://git.hatter.ink/hatter/python-tests/raw/branch/main/leap_year.py
|
|
```
|
|
|
|
> https://developer.aliyun.com/mirror/pypi/
|
|
|
|
`~/.pip/pip.conf`
|
|
```ini
|
|
[global]
|
|
index-url = http://mirrors.aliyun.com/pypi/simple/
|
|
|
|
[install]
|
|
trusted-host=mirrors.aliyun.com
|
|
```
|
|
|
|
```shell
|
|
pip install requests
|
|
pip install cryptography
|
|
```
|
|
|
|
----
|
|
|
|
```shell
|
|
PYTHONPATH=./.venv/lib/python3.10/site-packages/ ./show_my_ip.py
|
|
```
|