pip-search-fix 1.0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 @readwithai
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,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: pip-search-fix
3
+ Version: 1.0.0
4
+ Summary: Search PyPI packages from the command-line by scraping the web interface
5
+ Author-email: "@readwithai" <talwrii@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ManiacBoy777/pip-search
8
+ Project-URL: Repository, https://github.com/ManiacBoy777/pip-search
9
+ Project-URL: Issues, https://github.com/ManiacBoy777/pip-search/issues
10
+ Keywords: pip,pypi,search,packages,command-line
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: requests>=2.25.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: black; extra == "dev"
26
+ Requires-Dist: flake8; extra == "dev"
27
+ Requires-Dist: pytest; extra == "dev"
28
+ Requires-Dist: pytest-cov; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # pip-search
32
+
33
+ Search PyPI packages from the command-line with enhanced styling like the old `pip search`
34
+
35
+ ## Installation
36
+ **Using pip:**
37
+
38
+ ```bash
39
+ pip install git@https://github.com/ManiacBoy777/pip-search
40
+ ```
41
+
42
+ **Using uv (Recommended):**
43
+
44
+ ```bash
45
+ uv pip install -U --system git+https://github.com/ManiacBoy777/pip-search
46
+ ```
47
+
48
+ ### Shell pip functions (optional but recommended for ease of use)
49
+
50
+ To use it like normal `pip search` worked in the past, download the shell function to your shell's functions directory:
51
+
52
+ #### Fish
53
+
54
+ **Using curl:**
55
+
56
+ ```bash
57
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.fish -o ~/.config/fish/functions/pip.fish
58
+ ```
59
+
60
+ **Using wget:**
61
+
62
+ ```bash
63
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.fish -O ~/.config/fish/functions/pip.fish
64
+ ```
65
+
66
+ #### Bash
67
+
68
+ **Using curl:**
69
+
70
+ ```bash
71
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.bash -o ~/.bash_functions
72
+ ```
73
+
74
+ Then add the following to your `~/.bashrc`:
75
+
76
+ ```bash
77
+ if [ -f ~/.bash_functions ]; then
78
+ source ~/.bash_functions
79
+ fi
80
+ ```
81
+
82
+ **Using wget:**
83
+
84
+ ```bash
85
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.bash -O ~/.bash_functions
86
+ ```
87
+
88
+ #### Zsh
89
+
90
+ **Using curl:**
91
+
92
+ ```bash
93
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.zsh -o ~/.zsh_functions
94
+ ```
95
+
96
+ Then add the following to your `~/.zshrc`:
97
+
98
+ ```bash
99
+ if [ -f ~/.zsh_functions ]; then
100
+ source ~/.zsh_functions
101
+ fi
102
+ ```
103
+
104
+ **Using wget:**
105
+
106
+ ```bash
107
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.zsh -O ~/.zsh_functions
108
+ ```
109
+
110
+ ## Usage
111
+
112
+ ```bash
113
+ pip-search-fix requests
114
+ pip-search-fix machine learning
115
+ ```
116
+
117
+ ## Features
118
+
119
+ - 🎨 Colorized and styled output
120
+ - 🔗 Terminal hyperlinks to PyPI packages
121
+ - 🔍 Smart search ranking by name and description
122
+ - ⚡ Concurrent package info fetching
123
+ - 📝 Detailed package information and versions
@@ -0,0 +1,93 @@
1
+ # pip-search
2
+
3
+ Search PyPI packages from the command-line with enhanced styling like the old `pip search`
4
+
5
+ ## Installation
6
+ **Using pip:**
7
+
8
+ ```bash
9
+ pip install git@https://github.com/ManiacBoy777/pip-search
10
+ ```
11
+
12
+ **Using uv (Recommended):**
13
+
14
+ ```bash
15
+ uv pip install -U --system git+https://github.com/ManiacBoy777/pip-search
16
+ ```
17
+
18
+ ### Shell pip functions (optional but recommended for ease of use)
19
+
20
+ To use it like normal `pip search` worked in the past, download the shell function to your shell's functions directory:
21
+
22
+ #### Fish
23
+
24
+ **Using curl:**
25
+
26
+ ```bash
27
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.fish -o ~/.config/fish/functions/pip.fish
28
+ ```
29
+
30
+ **Using wget:**
31
+
32
+ ```bash
33
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.fish -O ~/.config/fish/functions/pip.fish
34
+ ```
35
+
36
+ #### Bash
37
+
38
+ **Using curl:**
39
+
40
+ ```bash
41
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.bash -o ~/.bash_functions
42
+ ```
43
+
44
+ Then add the following to your `~/.bashrc`:
45
+
46
+ ```bash
47
+ if [ -f ~/.bash_functions ]; then
48
+ source ~/.bash_functions
49
+ fi
50
+ ```
51
+
52
+ **Using wget:**
53
+
54
+ ```bash
55
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.bash -O ~/.bash_functions
56
+ ```
57
+
58
+ #### Zsh
59
+
60
+ **Using curl:**
61
+
62
+ ```bash
63
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.zsh -o ~/.zsh_functions
64
+ ```
65
+
66
+ Then add the following to your `~/.zshrc`:
67
+
68
+ ```bash
69
+ if [ -f ~/.zsh_functions ]; then
70
+ source ~/.zsh_functions
71
+ fi
72
+ ```
73
+
74
+ **Using wget:**
75
+
76
+ ```bash
77
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.zsh -O ~/.zsh_functions
78
+ ```
79
+
80
+ ## Usage
81
+
82
+ ```bash
83
+ pip-search-fix requests
84
+ pip-search-fix machine learning
85
+ ```
86
+
87
+ ## Features
88
+
89
+ - 🎨 Colorized and styled output
90
+ - 🔗 Terminal hyperlinks to PyPI packages
91
+ - 🔍 Smart search ranking by name and description
92
+ - ⚡ Concurrent package info fetching
93
+ - 📝 Detailed package information and versions
@@ -0,0 +1 @@
1
+ """pip-search-fix package"""
@@ -0,0 +1,187 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Simple PyPI package search tool with enhanced styling and hyperlinking.
4
+ Usage: pip-search-fix <search_terms...> [-n COUNT]
5
+ """
6
+
7
+ import sys
8
+ import requests
9
+ import re
10
+ import argparse
11
+ from concurrent.futures import ThreadPoolExecutor, as_completed
12
+
13
+ # ANSI escape codes for styling
14
+ BLUE = "\033[94m"
15
+ GREEN = "\033[92m"
16
+ YELLOW = "\033[93m"
17
+ BOLD = "\033[1m"
18
+ RESET = "\033[0m"
19
+
20
+ def create_hyperlink(text, url):
21
+ """Create a terminal hyperlink if supported"""
22
+ return f"\033]8;;{url}\033\\{text}\033]8;;\033\\"
23
+
24
+ def get_package_info(package_name):
25
+ """Get package description from PyPI JSON API"""
26
+ try:
27
+ response = requests.get(f"https://pypi.org/pypi/{package_name}/json", timeout=3)
28
+ if response.status_code == 200:
29
+ data = response.json()
30
+ info = data.get('info', {})
31
+ summary = info.get('summary', 'No description available')
32
+ version = info.get('version', '?.?.?')
33
+ # Clean up the summary
34
+ if summary:
35
+ summary = summary.strip()[:100] # Limit to 100 chars
36
+ else:
37
+ summary = 'No description available'
38
+ return {"summary": summary, "version": version}
39
+ return {"summary": 'No description available', "version": "unknown"}
40
+ except:
41
+ return {"summary": 'No description available', "version": "unknown"}
42
+
43
+ def search_packages(term):
44
+ """Search PyPI simple index for packages"""
45
+ try:
46
+ response = requests.get("https://pypi.org/simple/", timeout=10)
47
+ if response.status_code != 200:
48
+ return []
49
+
50
+ # Extract package names
51
+ packages = re.findall(r'<a href="/simple/([^/]+)/">', response.text)
52
+
53
+ # Handle multiple search terms
54
+ search_words = term.lower().split()
55
+
56
+ # Search for packages containing any of the terms in their name
57
+ matches = []
58
+ for pkg in packages:
59
+ pkg_lower = pkg.lower()
60
+ if any(word in pkg_lower for word in search_words):
61
+ matches.append(pkg)
62
+
63
+ # Prioritize exact matches and shorter names
64
+ def sort_key(pkg):
65
+ pkg_lower = pkg.lower()
66
+ if pkg_lower == term.lower():
67
+ return (0, len(pkg))
68
+ if term.lower() in pkg_lower:
69
+ return (1, len(pkg))
70
+ return (2, len(pkg))
71
+
72
+ matches.sort(key=sort_key)
73
+ return matches
74
+
75
+ except Exception as e:
76
+ print(f"Error searching packages: {e}")
77
+ return []
78
+
79
+ def main():
80
+ parser = argparse.ArgumentParser(
81
+ description="Search PyPI packages with styled output and description search",
82
+ formatter_class=argparse.RawDescriptionHelpFormatter,
83
+ epilog="""
84
+ Examples:
85
+ %(prog)s requests
86
+ %(prog)s machine learning
87
+ %(prog)s web scraping -n 20
88
+ """
89
+ )
90
+
91
+ parser.add_argument(
92
+ 'search_terms',
93
+ nargs='+',
94
+ help='Search terms (multiple words will be joined with spaces)'
95
+ )
96
+
97
+ parser.add_argument(
98
+ '-n', '--count',
99
+ type=int,
100
+ default=10,
101
+ help='Number of results to show (default: 10)'
102
+ )
103
+
104
+ args = parser.parse_args()
105
+
106
+ # Join multiple search terms with spaces
107
+ search_term = ' '.join(args.search_terms)
108
+ search_words = search_term.lower().split()
109
+
110
+ # Search for packages by name first
111
+ name_matches = search_packages(search_term)
112
+
113
+ if not name_matches:
114
+ print(f"{YELLOW}No packages found matching names.{RESET}")
115
+ return
116
+
117
+ # Limit initial name matches to a reasonable number to check descriptions
118
+ # We check more than 'count' to allow for description-based filtering/ranking
119
+ check_count = max(args.count * 3, 100)
120
+ packages_to_check = name_matches[:check_count]
121
+
122
+ # Get descriptions concurrently
123
+ package_info = {}
124
+ with ThreadPoolExecutor(max_workers=10) as executor:
125
+ future_to_pkg = {executor.submit(get_package_info, pkg): pkg for pkg in packages_to_check}
126
+ for future in as_completed(future_to_pkg):
127
+ pkg = future_to_pkg[future]
128
+ try:
129
+ package_info[pkg] = future.result()
130
+ except:
131
+ package_info[pkg] = {"summary": 'No description available', "version": "unknown"}
132
+
133
+ # Ranking function: prioritize exact name match, then name contains, then description contains
134
+ def get_score(pkg):
135
+ pkg_lower = pkg.lower()
136
+ info = package_info.get(pkg, {})
137
+ desc_lower = info.get('summary', '').lower()
138
+
139
+ score = 0
140
+ if pkg_lower == search_term.lower():
141
+ score += 5000
142
+
143
+ # Exact word match in name is better than partial
144
+ for word in search_words:
145
+ if word == pkg_lower:
146
+ score += 2000
147
+ elif word in pkg_lower:
148
+ score += 500
149
+
150
+ if word in desc_lower:
151
+ score += 100
152
+
153
+ # Shorter names are usually more relevant for the base package
154
+ score -= len(pkg)
155
+
156
+ return score
157
+
158
+ # Sort by score descending
159
+ sorted_packages = sorted(package_info.keys(), key=lambda p: -get_score(p))
160
+
161
+ # Display results
162
+ results_shown = 0
163
+ for pkg in sorted_packages:
164
+ if results_shown >= args.count:
165
+ break
166
+
167
+ info = package_info.get(pkg, {})
168
+ summary = info.get('summary', 'No description available')
169
+ version = info.get('version', 'unknown')
170
+ url = f"https://pypi.org/project/{pkg}/"
171
+
172
+ # Style the output
173
+ styled_pkg = f"{BOLD}{BLUE}{create_hyperlink(pkg, url)}{RESET}"
174
+ styled_version = f"{GREEN}{version}{RESET}"
175
+
176
+ # Mark exact matches with a star
177
+ is_exact = pkg.lower() == search_term.lower()
178
+ prefix = f"{YELLOW}*{RESET} " if is_exact else " "
179
+
180
+ print(f"{prefix}{styled_pkg} ({styled_version}) - {summary}")
181
+ results_shown += 1
182
+
183
+ if results_shown == 0:
184
+ print(f"{YELLOW}No packages found.{RESET}")
185
+
186
+ if __name__ == "__main__":
187
+ main()
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: pip-search-fix
3
+ Version: 1.0.0
4
+ Summary: Search PyPI packages from the command-line by scraping the web interface
5
+ Author-email: "@readwithai" <talwrii@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ManiacBoy777/pip-search
8
+ Project-URL: Repository, https://github.com/ManiacBoy777/pip-search
9
+ Project-URL: Issues, https://github.com/ManiacBoy777/pip-search/issues
10
+ Keywords: pip,pypi,search,packages,command-line
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: requests>=2.25.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: black; extra == "dev"
26
+ Requires-Dist: flake8; extra == "dev"
27
+ Requires-Dist: pytest; extra == "dev"
28
+ Requires-Dist: pytest-cov; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # pip-search
32
+
33
+ Search PyPI packages from the command-line with enhanced styling like the old `pip search`
34
+
35
+ ## Installation
36
+ **Using pip:**
37
+
38
+ ```bash
39
+ pip install git@https://github.com/ManiacBoy777/pip-search
40
+ ```
41
+
42
+ **Using uv (Recommended):**
43
+
44
+ ```bash
45
+ uv pip install -U --system git+https://github.com/ManiacBoy777/pip-search
46
+ ```
47
+
48
+ ### Shell pip functions (optional but recommended for ease of use)
49
+
50
+ To use it like normal `pip search` worked in the past, download the shell function to your shell's functions directory:
51
+
52
+ #### Fish
53
+
54
+ **Using curl:**
55
+
56
+ ```bash
57
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.fish -o ~/.config/fish/functions/pip.fish
58
+ ```
59
+
60
+ **Using wget:**
61
+
62
+ ```bash
63
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.fish -O ~/.config/fish/functions/pip.fish
64
+ ```
65
+
66
+ #### Bash
67
+
68
+ **Using curl:**
69
+
70
+ ```bash
71
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.bash -o ~/.bash_functions
72
+ ```
73
+
74
+ Then add the following to your `~/.bashrc`:
75
+
76
+ ```bash
77
+ if [ -f ~/.bash_functions ]; then
78
+ source ~/.bash_functions
79
+ fi
80
+ ```
81
+
82
+ **Using wget:**
83
+
84
+ ```bash
85
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.bash -O ~/.bash_functions
86
+ ```
87
+
88
+ #### Zsh
89
+
90
+ **Using curl:**
91
+
92
+ ```bash
93
+ curl -fsSL https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.zsh -o ~/.zsh_functions
94
+ ```
95
+
96
+ Then add the following to your `~/.zshrc`:
97
+
98
+ ```bash
99
+ if [ -f ~/.zsh_functions ]; then
100
+ source ~/.zsh_functions
101
+ fi
102
+ ```
103
+
104
+ **Using wget:**
105
+
106
+ ```bash
107
+ wget https://raw.githubusercontent.com/ManiacBoy777/pip-search/master/functions/pip.zsh -O ~/.zsh_functions
108
+ ```
109
+
110
+ ## Usage
111
+
112
+ ```bash
113
+ pip-search-fix requests
114
+ pip-search-fix machine learning
115
+ ```
116
+
117
+ ## Features
118
+
119
+ - 🎨 Colorized and styled output
120
+ - 🔗 Terminal hyperlinks to PyPI packages
121
+ - 🔍 Smart search ranking by name and description
122
+ - ⚡ Concurrent package info fetching
123
+ - 📝 Detailed package information and versions
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ pip_search_fix/__init__.py
5
+ pip_search_fix/main.py
6
+ pip_search_fix.egg-info/PKG-INFO
7
+ pip_search_fix.egg-info/SOURCES.txt
8
+ pip_search_fix.egg-info/dependency_links.txt
9
+ pip_search_fix.egg-info/entry_points.txt
10
+ pip_search_fix.egg-info/requires.txt
11
+ pip_search_fix.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ pip-search-fix = pip_search_fix.main:main
3
+ psf = pip_search_fix.main:main
@@ -0,0 +1,7 @@
1
+ requests>=2.25.0
2
+
3
+ [dev]
4
+ black
5
+ flake8
6
+ pytest
7
+ pytest-cov
@@ -0,0 +1 @@
1
+ pip_search_fix
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = [ "setuptools>=61.0", "wheel",]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pip-search-fix"
7
+ version = "1.0.0"
8
+ description = "Search PyPI packages from the command-line by scraping the web interface"
9
+ readme = "README.md"
10
+ classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Topic :: Software Development :: Libraries",]
11
+ keywords = [ "pip", "pypi", "search", "packages", "command-line",]
12
+ requires-python = ">=3.8"
13
+ dependencies = [ "requests>=2.25.0",]
14
+ [[project.authors]]
15
+ name = "@readwithai"
16
+ email = "talwrii@gmail.com"
17
+
18
+ [project.license]
19
+ text = "MIT"
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/ManiacBoy777/pip-search"
23
+ Repository = "https://github.com/ManiacBoy777/pip-search"
24
+ Issues = "https://github.com/ManiacBoy777/pip-search/issues"
25
+
26
+ [project.scripts]
27
+ pip-search-fix = "pip_search_fix.main:main"
28
+ psf = "pip_search_fix.main:main"
29
+
30
+ [project.optional-dependencies]
31
+ dev = [ "black", "flake8", "pytest", "pytest-cov",]
32
+
33
+ [tool.setuptools]
34
+ packages = [ "pip_search_fix",]
35
+
36
+ [tool.black]
37
+ line-length = 88
38
+ target-version = [ "py38",]
39
+ include = "\\.pyi?$"
40
+
41
+ [tool.flake8]
42
+ max-line-length = 88
43
+ extend-ignore = [ "E203", "W503",]
44
+
45
+ [tool.setuptools.package-dir]
46
+ pip_search_fix = "pip_search_fix"
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = [ "tests",]
50
+ python_files = [ "test_*.py",]
51
+ python_classes = [ "Test*",]
52
+ python_functions = [ "test_*",]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+