コンテンツにスキップ

pytilpack

Pythonのユーティリティ集。

CI PyPI version

インストール

ベースパッケージ(stdlib系ユーティリティ + httpx/werkzeug):

pip install pytilpack

各モジュールが必要とするライブラリは extras で追加インストールする:

pip install pytilpack[all]       # 全モジュール
pip install pytilpack[fastapi]   # pytilpack.fastapi 用
pip install pytilpack[flask]     # pytilpack.flask 用
# ...

uvx で CLI を使う場合、サブコマンドが要求する extras を --from で明示する:

uvx --from 'pytilpack[mcp]' pytilpack mcp
uvx --from 'pytilpack[sqlalchemy]' pytilpack wait-for-db-connection "$SQLALCHEMY_DATABASE_URI"

extras 一覧

Extra 対象モジュール 主な依存パッケージ
all 全モジュール (全依存)
babel pytilpack.babel, pytilpack.i18n babel
bleach (markdown extraに含まれる) bleach
environ pytilpack.environ python-dotenv
fastapi pytilpack.fastapi fastapi, html5lib
flask pytilpack.flask, pytilpack.flask_login flask, flask-login, html5lib
htmlrag pytilpack.htmlrag beautifulsoup4
markdown pytilpack.markdown bleach, markdown, tinycss2
mcp CLI: pytilpack mcp mcp, beautifulsoup4
msal pytilpack.msal azure-identity, cryptography, msal
pycryptodome pytilpack.pycrypto pycryptodome
pydantic pytilpack.pydantic pydantic
pytest pytilpack.pytest pytest, pytest-asyncio
pyyaml pytilpack.yaml pyyaml
quart pytilpack.quart, pytilpack.quart_auth quart, quart-auth, hypercorn, uvicorn
sqlalchemy pytilpack.sqlalchemy sqlalchemy, tabulate
tiktoken pytilpack.tiktoken tiktoken, openai, pillow
tqdm pytilpack.tqdm tqdm
web pytilpack.web (check_html) html5lib

主な使い方

各モジュールを個別に import して利用する。

import pytilpack.xxx

xxx には対象ライブラリ名(httpxpathlib など)が入る。

一部は CLI もある。詳細は CLIコマンド を参照。

各種ライブラリ用ユーティリティ

特定ライブラリに依存しないモジュール