pip-auto 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pip_auto-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 pip-auto contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.5
2
+ Name: pip-auto
3
+ Version: 0.3.0
4
+ Summary: Just import it. Missing modules are installed from PyPI automatically. / import するだけで無いモジュールを PyPI から自動インストール
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Keywords: auto-install,dependencies,import,installer,pep723,pip
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Natural Language :: Japanese
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: POSIX
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Software Development :: Build Tools
17
+ Classifier: Topic :: System :: Software Distribution
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+
21
+ # pip-auto
22
+
23
+ **import するだけ。無いモジュールは勝手に入る。**
24
+
25
+ ```bash
26
+ pip install pip-auto
27
+ ```
28
+
29
+ これだけ。あとは普通に Python を書いて動かすと、足りないモジュールがその場で PyPI から入ってそのまま動き続けます。
30
+
31
+ ```python
32
+ import pyfiglet # 入ってなくても OK
33
+ from PIL import Image # import 名と pip 名が違っても OK(pillow を入れる)
34
+ import cv2 # opencv-python を入れる
35
+ print(pyfiglet.figlet_format("hello"))
36
+ ```
37
+
38
+ ```
39
+ [autopip] 'pyfiglet' が無い → pyfiglet を入れる
40
+ [autopip] pyfiglet==1.0.4 入った (2.51s)
41
+ ```
42
+
43
+ ## 何が便利か
44
+
45
+ - **入れるだけで有効**: `pip install pip-auto` で ON。`pip uninstall pip-auto` で完全に元通り
46
+ - **名前を当てる**: `PIL`→`pillow`、`cv2`→`opencv-python`、`google.generativeai`→`google-generativeai` など。
47
+ 候補は wheel の中身まで確認してから入れる(同名の別物は入れない)
48
+ - **速い**: pip を使わない自前インストーラ。依存を並列で先読みして解決し、全ファイルを 1 回でまとめて展開。
49
+ 2 回目以降はキャッシュからハードリンクを張るだけ(pip の 5〜10 倍程度)。Python の起動への上乗せは約 5ms
50
+ - **安全**: 人気パッケージにそっくりな名前(タイポスクワット)や、公開されたばかりの無名パッケージは自動では入れない。
51
+ 失敗したら途中まで入ったものも含めて全部元に戻す
52
+ - **ライブラリの「無くても動く」import は無視**: `try: import x except ImportError:` や `importlib.util.find_spec("x")` では入れない
53
+
54
+ ## スクリプトに書いておく
55
+
56
+ ```python
57
+ # /// script
58
+ # dependencies = ["requests<3", "rich"]
59
+ # ///
60
+ import requests, rich # PEP 723 ブロックがあれば最初にまとめて入れる
61
+ import numpy # autopip: numpy<2 ← 行末コメントでバージョン指定
62
+ ```
63
+
64
+ ## コマンド
65
+
66
+ | コマンド | 内容 |
67
+ |---|---|
68
+ | `autopip run x.py` | 足りないものを先にまとめて入れてから実行(`--venv` で隣に .venv を作ってそこで) |
69
+ | `autopip lock x.py` | 全部のバージョンと sha256 を固定した `x.autopip.lock` を作る。以後 `run` はその通りに入れる |
70
+ | `autopip freeze x.py --requirements` / `--pep723` | 使っているものを書き出す |
71
+ | `autopip install pkg...` / `uninstall pkg...` | 自前インストーラで入れる / 消す |
72
+ | `autopip clean [--days 30] [--yes]` | しばらく使ってない自動インストール品を掃除 |
73
+ | `autopip gui` | ブラウザで一覧・掃除・設定(127.0.0.1 のみ) |
74
+ | `autopip check pkg` | 安全チェックだけ |
75
+ | `autopip config ask true` | 入れる前に毎回確認する |
76
+ | `autopip off` / `on` | 一時的に止める / 戻す |
77
+
78
+ 環境変数 `AUTOPIP_DISABLE=1` でその場だけ無効にできます。
79
+
80
+ ## 設定 (`autopip config キー 値`)
81
+
82
+ - `ask` … `true` で入れる前に確認(端末から直接聞く。答えられない環境では入れない)
83
+ - `safety` … `strict`(既定)/ `warn` / `off`
84
+ - `link_mode` … `hardlink`(既定・速い)/ `copy`(環境ごとに別ファイル)
85
+ - `index_url` / `extra_index_urls` … PyPI 以外のインデックス(`pip.ini` / `PIP_INDEX_URL` も読みます)
86
+
87
+ ## 注意
88
+
89
+ - 自動で入れるのは PyPI 上のパッケージです。何を入れたかは毎回ログに出ます
90
+ - ハードリンクモードでは同じファイルを複数の環境で共有します。入れたファイルを直接書き換える使い方をするなら `link_mode copy` に
91
+ - Python 3.10 以上。Windows で主に確認しています(Linux / macOS の wheel 選びは packaging に任せています)
92
+
93
+ ---
94
+
95
+ ## English
96
+
97
+ **Just import it — missing modules are installed from PyPI on the fly.**
98
+ `pip install pip-auto` enables it for that Python (a `.pth` hook); `pip uninstall pip-auto` removes it completely.
99
+ It maps import names to distribution names (`PIL`→`pillow`, `cv2`→`opencv-python`), verifies the wheel really contains the module,
100
+ blocks typosquats / brand-new unknown packages, resolves with backtracking, and installs everything in one parallel batch
101
+ with hard links from a local cache. Library-internal optional imports are left alone. Supports PEP 723 script metadata,
102
+ lock files with sha256, `autopip gui`, `autopip clean`, and `autopip freeze`.
@@ -0,0 +1,82 @@
1
+ # pip-auto
2
+
3
+ **import するだけ。無いモジュールは勝手に入る。**
4
+
5
+ ```bash
6
+ pip install pip-auto
7
+ ```
8
+
9
+ これだけ。あとは普通に Python を書いて動かすと、足りないモジュールがその場で PyPI から入ってそのまま動き続けます。
10
+
11
+ ```python
12
+ import pyfiglet # 入ってなくても OK
13
+ from PIL import Image # import 名と pip 名が違っても OK(pillow を入れる)
14
+ import cv2 # opencv-python を入れる
15
+ print(pyfiglet.figlet_format("hello"))
16
+ ```
17
+
18
+ ```
19
+ [autopip] 'pyfiglet' が無い → pyfiglet を入れる
20
+ [autopip] pyfiglet==1.0.4 入った (2.51s)
21
+ ```
22
+
23
+ ## 何が便利か
24
+
25
+ - **入れるだけで有効**: `pip install pip-auto` で ON。`pip uninstall pip-auto` で完全に元通り
26
+ - **名前を当てる**: `PIL`→`pillow`、`cv2`→`opencv-python`、`google.generativeai`→`google-generativeai` など。
27
+ 候補は wheel の中身まで確認してから入れる(同名の別物は入れない)
28
+ - **速い**: pip を使わない自前インストーラ。依存を並列で先読みして解決し、全ファイルを 1 回でまとめて展開。
29
+ 2 回目以降はキャッシュからハードリンクを張るだけ(pip の 5〜10 倍程度)。Python の起動への上乗せは約 5ms
30
+ - **安全**: 人気パッケージにそっくりな名前(タイポスクワット)や、公開されたばかりの無名パッケージは自動では入れない。
31
+ 失敗したら途中まで入ったものも含めて全部元に戻す
32
+ - **ライブラリの「無くても動く」import は無視**: `try: import x except ImportError:` や `importlib.util.find_spec("x")` では入れない
33
+
34
+ ## スクリプトに書いておく
35
+
36
+ ```python
37
+ # /// script
38
+ # dependencies = ["requests<3", "rich"]
39
+ # ///
40
+ import requests, rich # PEP 723 ブロックがあれば最初にまとめて入れる
41
+ import numpy # autopip: numpy<2 ← 行末コメントでバージョン指定
42
+ ```
43
+
44
+ ## コマンド
45
+
46
+ | コマンド | 内容 |
47
+ |---|---|
48
+ | `autopip run x.py` | 足りないものを先にまとめて入れてから実行(`--venv` で隣に .venv を作ってそこで) |
49
+ | `autopip lock x.py` | 全部のバージョンと sha256 を固定した `x.autopip.lock` を作る。以後 `run` はその通りに入れる |
50
+ | `autopip freeze x.py --requirements` / `--pep723` | 使っているものを書き出す |
51
+ | `autopip install pkg...` / `uninstall pkg...` | 自前インストーラで入れる / 消す |
52
+ | `autopip clean [--days 30] [--yes]` | しばらく使ってない自動インストール品を掃除 |
53
+ | `autopip gui` | ブラウザで一覧・掃除・設定(127.0.0.1 のみ) |
54
+ | `autopip check pkg` | 安全チェックだけ |
55
+ | `autopip config ask true` | 入れる前に毎回確認する |
56
+ | `autopip off` / `on` | 一時的に止める / 戻す |
57
+
58
+ 環境変数 `AUTOPIP_DISABLE=1` でその場だけ無効にできます。
59
+
60
+ ## 設定 (`autopip config キー 値`)
61
+
62
+ - `ask` … `true` で入れる前に確認(端末から直接聞く。答えられない環境では入れない)
63
+ - `safety` … `strict`(既定)/ `warn` / `off`
64
+ - `link_mode` … `hardlink`(既定・速い)/ `copy`(環境ごとに別ファイル)
65
+ - `index_url` / `extra_index_urls` … PyPI 以外のインデックス(`pip.ini` / `PIP_INDEX_URL` も読みます)
66
+
67
+ ## 注意
68
+
69
+ - 自動で入れるのは PyPI 上のパッケージです。何を入れたかは毎回ログに出ます
70
+ - ハードリンクモードでは同じファイルを複数の環境で共有します。入れたファイルを直接書き換える使い方をするなら `link_mode copy` に
71
+ - Python 3.10 以上。Windows で主に確認しています(Linux / macOS の wheel 選びは packaging に任せています)
72
+
73
+ ---
74
+
75
+ ## English
76
+
77
+ **Just import it — missing modules are installed from PyPI on the fly.**
78
+ `pip install pip-auto` enables it for that Python (a `.pth` hook); `pip uninstall pip-auto` removes it completely.
79
+ It maps import names to distribution names (`PIL`→`pillow`, `cv2`→`opencv-python`), verifies the wheel really contains the module,
80
+ blocks typosquats / brand-new unknown packages, resolves with backtracking, and installs everything in one parallel batch
81
+ with hard links from a local cache. Library-internal optional imports are left alone. Supports PEP 723 script metadata,
82
+ lock files with sha256, `autopip gui`, `autopip clean`, and `autopip freeze`.