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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modulift
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: A powerful search tool for discovering Python packages based on user queries
5
5
  Home-page: https://github.com/okanyenigun/modulift
6
6
  Author: Okan Yenigün
@@ -0,0 +1,3 @@
1
+ from .api import *
2
+
3
+ __version__ = '0.0.2'
@@ -1,5 +1,5 @@
1
- import pandas as pd
2
- from typing import List, Optional, Union
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['popularity'] = pd.Categorical(result_df['popularity'], categories=popularity_order, ordered=True)
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
- print(f"**{i}. {row['package']}**")
81
- print(f"- **Description**: {row['description']}")
82
- print(f"- **Keywords**: {row['keywords']}")
83
- print(f"- **Popularity**: {row['popularity']}")
84
- print("\n---\n")
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
- print(f"**Package**: {result['package']}")
125
- print(f"- **Description**: {result['description']}")
126
- print(f"- **Keywords**: {result['keywords']}")
127
- print(f"- **Popularity**: {result['popularity']}")
128
- print("\n---\n")
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
- print(f"**{i}. {row['package']}**")
190
- print(f"- **Description**: {row['description']}")
191
- print(f"- **Keywords**: {row['keywords']}")
192
- print(f"- **Popularity**: {row['popularity']}")
193
- print("\n---\n")
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modulift
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: A powerful search tool for discovering Python packages based on user queries
5
5
  Home-page: https://github.com/okanyenigun/modulift
6
6
  Author: Okan Yenigün
@@ -7,7 +7,7 @@ with open("Readme.md", "r") as f:
7
7
 
8
8
  setup(
9
9
  name="modulift",
10
- version="0.0.1",
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,
@@ -1,3 +0,0 @@
1
- from .api import *
2
-
3
- __version__ = '0.0.1'
File without changes
File without changes