- tools
- uv
- scripts
- Projects
- pipx
- Anaconda
- EOL
- Relative imports in Python 3
- Distribution Default
- pip
- Proxy
- CN Mirror
- pypi
- Google Fire
- pendulum
- Web automation
- requestium
- VSCode
- Remote debugging
- Pythonista on IOS
- MongoDB ORM
- ASGI
- Web Frameworks
- starlette
- aiohttp
- Sanic
- API Server
- WSDL
tools¶
uv pip install pydantic # Data validation using Python type hints
uv¶
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # wget uv/uvw/uvx , v0.9.2 < 60MB
pip install uv
uv self update
uv python install 3.14 3.12 # around 20MB each
uv python list # supported versions & local path
cd $path
uv venv --python 3.12 --seed # cat .venv/pyvenv.cfg
uv tool run jupyter lab # v4.4.9 : 99 packages
scripts¶
https://docs.astral.sh/uv/guides/scripts/
uv run example.py
echo 'print("hello world!")' | uv run -
uv run - <<EOF
print("hello world!")
EOF
Projects¶
$cd example
$ uv add ruff
Creating virtual environment at: .venv
$ uv run ruff check
$ uv lock
$ uv sync
Jupyter: https://docs.astral.sh/uv/guides/integration/jupyter/#using-jupyter-within-a-project
uv run --with jupyter jupyter lab # pyproject.toml or uv.lock
pipx¶
https://github.com/pypa/pipx?tab=readme-ov-file#overview-what-is-pipx - creates an isolated environment for each application - run from the command line directly
Anaconda¶
https://docs.anaconda.com/anaconda/packages/oldpkglists/
Anaconda3\condabin>conda.bat activate
~/.bashrc # conda initialize
conda config --set auto_activate_base false
conda create -n py3.14 python=3.14
EOL¶
| Ver | Released | EOS |
|---|---|---|
| 3.14 | Oct 2025 | Oct 2027 |
Relative imports in Python 3¶
https://stackoverflow.com/a/49375740/4769874
from module1 intead of from .module1
# __init__.py
import os, sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
Distribution Default¶
Debian 7 wheezy 2.7.3 / 3.2
Debian 8 jessie 2.7.9 / 3.4
Debian 9 stretch 2.7.13 / 3.5
Debian 10 buster 2.7.14 / 3.6
Debian 11 bullseye 3.9
pip¶
# online
pip install git+ https://github.com/<owner_name>/<repo_name>.git
# local
pip install --download DIR -r requirements.txt
pip wheel --wheel-dir DIR -r requirements.txt
pip install --no-index --find-links=DIR -r requirements.txt
Proxy¶
export all_proxy="socks5://x:y" # cause python error: Missing dependencies for SOCKS support.
pip install --proxy=https://user@mydomain:port somepackage
CN Mirror¶
mkdir -p ~/.pip \ && echo ‘[global]’ > ~/.pip/pip.conf \ && echo ‘index-url = https://mirrors.aliyun.com/pypi/simple/‘ >> ~/.pip/pip.conf \ && pip install -r requirements.txt
pypi¶
https://packaging.python.org/tutorials/distributing-packages/
twine upload --repository testpypi dist/*
Google Fire¶
https://github.com/google/python-fire/blob/master/docs/guide.md#accessing-properties
import fire
english = 'Hello World'
fire.Fire()
# .py english
fire.Fire(lambda obj: type(obj).__name__)
# .py 10 / "10" # output: int
# .py '"10"' / "'10'" / \"10\" # output: str
# .py '{"name": "David Bieber"}' # notice the quote, output: dict
# .py {"name":"David Bieber"} # Wrong. output: str
# .py --obj=True / --obj
# .py --obj=False / --noobj
def hello(name):
return 'Hello {name}!'.format(name=name)
if __name__ == '__main__':
fire.Fire()
# .py hello name_value
class Calculator(object):
def add(self, x, y):
return x + y
if __name__ == '__main__':
fire.Fire(Calculator)
# .py add 10 20
class BrokenCalculator(object):
def __init__(self, offset=1):
self._offset = offset
def add(self, x, y):
return x + y + self._offset
if __name__ == '__main__':
fire.Fire(BrokenCalculator)
# .py add 10 20 --offset=0
class Airport(object):
def __init__(self, code):
self.code = code
self.name = fn_x(self.code)
if __name__ == '__main__':
fire.Fire(Airport)
# .py --code=SJC name
pendulum¶
https://github.com/sdispater/pendulum#pendulum
tomorrow = pendulum.now().add(days=1)
last_week = pendulum.now().subtract(weeks=1)
if pendulum.now().is_weekend():
past.diff_for_humans()
Web automation¶
requestium¶
https://github.com/tryolabs/requestium
merges the power of Requests, Selenium, and Parsel into a single integrated tool
VSCode¶
Remote debugging¶
VS: https://youtu.be/y1Qq7BrV6Cc?t=228
VSCode: https://code.visualstudio.com/docs/python/debugging#_remote-debugging
# bug: https://github.com/DonJayamanne/pythonVSCode/issues/981#issuecomment-308085243
pip install ptvsd==3.0.0
import ptvsd
ptvsd.enable_attach("my_secret", address = ('0.0.0.0', 3000))
ptvsd.wait_for_attach()
Pythonista on IOS¶
https://github.com/Pythonista-Tools/Pythonista-Tools/blob/master/Utilities.md
MongoDB ORM¶
http://ming.readthedocs.io/en/latest/
http://turbogears.readthedocs.io/en/latest/turbogears/mongodb.html
ASGI¶
uvicorn, daphne, or hypercorn
Web Frameworks¶
https://github.com/topics/web-framework?l=python
https://wiki.python.org/moin/WebFrameworks
starlette¶
https://github.com/encode/starlette
aiohttp¶
https://github.com/aio-libs/aiohttp
https://aiohttp.readthedocs.io/en/stable/
Supports both client and server Web-Sockets
Web-server has middlewares and pluggable routing.
Sanic¶
https://github.com/channelcat/sanic
API Server¶
https://github.com/tiangolo/fastapi
http://www.hug.rest/
WSDL¶
http://www.soapclient.com/xml/soapresponder.wsdl
http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/web_services/ws_wsdlstructure.html