modulift 0.0.1__tar.gz → 0.0.2__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.
- {modulift-0.0.1 → modulift-0.0.2}/PKG-INFO +1 -1
- modulift-0.0.2/modulift/__init__.py +3 -0
- {modulift-0.0.1 → modulift-0.0.2}/modulift/api.py +55 -22
- {modulift-0.0.1 → modulift-0.0.2}/modulift.egg-info/PKG-INFO +1 -1
- {modulift-0.0.1 → modulift-0.0.2}/setup.py +1 -1
- modulift-0.0.1/modulift/__init__.py +0 -3
- {modulift-0.0.1 → modulift-0.0.2}/modulift/data.py +0 -0
- {modulift-0.0.1 → modulift-0.0.2}/modulift.egg-info/SOURCES.txt +0 -0
- {modulift-0.0.1 → modulift-0.0.2}/modulift.egg-info/dependency_links.txt +0 -0
- {modulift-0.0.1 → modulift-0.0.2}/modulift.egg-info/requires.txt +0 -0
- {modulift-0.0.1 → modulift-0.0.2}/modulift.egg-info/top_level.txt +0 -0
- {modulift-0.0.1 → modulift-0.0.2}/setup.cfg +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
from typing import List, Optional
|
|
1
|
+
from IPython.display import display, Markdown
|
|
2
|
+
from typing import List, Optional
|
|
3
3
|
from .data import load_data
|
|
4
4
|
|
|
5
5
|
|
|
@@ -60,12 +60,8 @@ def search_by_keywords(*args: str, relation: str = "or", limit: Optional[int] =
|
|
|
60
60
|
# Filter the DataFrame with matching rows and select required columns
|
|
61
61
|
result_df = df[mask][['package', 'description', 'keywords', 'popularity']]
|
|
62
62
|
|
|
63
|
-
# Define a custom order for sorting popularity
|
|
64
|
-
popularity_order = ['very popular', 'popular', 'not popular']
|
|
65
|
-
|
|
66
63
|
# Sort the DataFrame by 'POPULARITY' based on the defined order
|
|
67
|
-
result_df
|
|
68
|
-
result_df = result_df.sort_values('popularity')
|
|
64
|
+
result_df = result_df.sort_values('popularity', ascending=False)
|
|
69
65
|
|
|
70
66
|
# Apply limit if specified
|
|
71
67
|
if limit is not None:
|
|
@@ -77,11 +73,22 @@ def search_by_keywords(*args: str, relation: str = "or", limit: Optional[int] =
|
|
|
77
73
|
# Print in markdown format if markdown is True
|
|
78
74
|
if markdown:
|
|
79
75
|
for i, row in enumerate(results, 1):
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
|
|
77
|
+
package = row['package'].strip()
|
|
78
|
+
description = row['description'].strip()
|
|
79
|
+
keywords = row['keywords'].strip()
|
|
80
|
+
popularity = str(row['popularity'])
|
|
81
|
+
|
|
82
|
+
markdown_text = f"""
|
|
83
|
+
**{package}**
|
|
84
|
+
|
|
85
|
+
- **Description**: {description}
|
|
86
|
+
- **Keywords**: {keywords}
|
|
87
|
+
- **Popularity**: {popularity}
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
"""
|
|
91
|
+
display(Markdown(markdown_text))
|
|
85
92
|
|
|
86
93
|
return results
|
|
87
94
|
|
|
@@ -121,11 +128,23 @@ def search_by_package_name(package_name: str, markdown: bool = False) -> Optiona
|
|
|
121
128
|
|
|
122
129
|
# Print in markdown format if markdown is True
|
|
123
130
|
if markdown:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
|
|
132
|
+
package = result['package'].strip()
|
|
133
|
+
description = result['description'].strip()
|
|
134
|
+
keywords = result['keywords'].strip()
|
|
135
|
+
popularity = str(result['popularity'])
|
|
136
|
+
|
|
137
|
+
markdown_text = f"""
|
|
138
|
+
**{package}**
|
|
139
|
+
|
|
140
|
+
- **Description**: {description}
|
|
141
|
+
- **Keywords**: {keywords}
|
|
142
|
+
- **Popularity**: {popularity}
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
display(Markdown(markdown_text))
|
|
129
148
|
|
|
130
149
|
return result
|
|
131
150
|
else:
|
|
@@ -175,6 +194,9 @@ def search_by_description(text: str, limit: Optional[int] = None, markdown: bool
|
|
|
175
194
|
|
|
176
195
|
# Filter the DataFrame with matching rows and select required columns
|
|
177
196
|
result_df = df[mask][['package', 'description', 'keywords', 'popularity']]
|
|
197
|
+
|
|
198
|
+
# Sort the DataFrame by 'POPULARITY' based on the defined order
|
|
199
|
+
result_df = result_df.sort_values('popularity', ascending=False)
|
|
178
200
|
|
|
179
201
|
# Apply limit if specified
|
|
180
202
|
if limit is not None:
|
|
@@ -186,11 +208,22 @@ def search_by_description(text: str, limit: Optional[int] = None, markdown: bool
|
|
|
186
208
|
# Print in markdown format if markdown is True
|
|
187
209
|
if markdown:
|
|
188
210
|
for i, row in enumerate(results, 1):
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
211
|
+
|
|
212
|
+
package = row['package'].strip()
|
|
213
|
+
description = row['description'].strip()
|
|
214
|
+
keywords = row['keywords'].strip()
|
|
215
|
+
popularity = str(row['popularity'])
|
|
216
|
+
|
|
217
|
+
markdown_text = f"""
|
|
218
|
+
**{package}**
|
|
219
|
+
|
|
220
|
+
- **Description**: {description}
|
|
221
|
+
- **Keywords**: {keywords}
|
|
222
|
+
- **Popularity**: {popularity}
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
"""
|
|
226
|
+
display(Markdown(markdown_text))
|
|
194
227
|
else:
|
|
195
228
|
print(f"No matches found for the text '{text}'.")
|
|
196
229
|
return results
|
|
@@ -7,7 +7,7 @@ with open("Readme.md", "r") as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="modulift",
|
|
10
|
-
version="0.0.
|
|
10
|
+
version="0.0.2",
|
|
11
11
|
description="A powerful search tool for discovering Python packages based on user queries",
|
|
12
12
|
packages=find_packages(),
|
|
13
13
|
long_description=long_description,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|