trendscout 0.2.2__tar.gz → 1.1.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,255 @@
1
+ Metadata-Version: 2.4
2
+ Name: trendscout
3
+ Version: 1.1.0
4
+ Summary: Real-time trend intelligence with HackerNews, RSS feeds, trend velocity, and multi-domain sentiment
5
+ Author-email: Teyfik OZ <teyfikoz@yahoo.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/teyfikoz/trendscout
8
+ Project-URL: Repository, https://github.com/teyfikoz/trendscout
9
+ Project-URL: Issues, https://github.com/teyfikoz/trendscout/issues
10
+ Keywords: trends,sentiment,market-analysis,nlp,scraping
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: beautifulsoup4>=4.12.0
22
+ Requires-Dist: pandas>=2.0.0
23
+ Requires-Dist: requests>=2.31.0
24
+ Requires-Dist: textblob>=0.17.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
28
+
29
+ # TrendScout
30
+
31
+ **Real-time trend intelligence** — HackerNews search, RSS feed parsing, trend velocity scoring, and multi-domain sentiment analysis. No API key required.
32
+
33
+ [![PyPI version](https://badge.fury.io/py/trendscout.svg)](https://pypi.org/project/trendscout/)
34
+ [![CI](https://github.com/teyfikoz/trendscout/actions/workflows/ci.yml/badge.svg)](https://github.com/teyfikoz/trendscout/actions/workflows/ci.yml)
35
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
36
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install trendscout
42
+ ```
43
+
44
+ ## Quick Start
45
+
46
+ ```python
47
+ from trendscout import TrendScout
48
+
49
+ ts = TrendScout()
50
+
51
+ # Real HackerNews data — no API key needed
52
+ df = ts.get_hackernews_trends("AI agents", limit=10)
53
+ print(df[['title', 'score', 'num_comments']].head())
54
+
55
+ # Sentiment with market signal
56
+ result = ts.analyze_sentiment("GPT-5 crushes every benchmark!", domain="tech")
57
+ print(result)
58
+
59
+ # Trend velocity
60
+ velocity = ts.get_trend_velocity("rust programming language")
61
+ print(velocity)
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Features at a Glance
67
+
68
+ | Feature | Description |
69
+ |---------|-------------|
70
+ | **HackerNews API** | Real stories via Algolia — free, no key, always fresh |
71
+ | **RSS/Atom Feeds** | Tech, AI, business, Python presets + custom URLs |
72
+ | **Trend Velocity** | Momentum score 0–1 with status: emerging/peak/stable/declining |
73
+ | **Sentiment Analysis** | TextBlob + domain-aware lexicons (financial, tech, social) |
74
+ | **Multi-topic Analysis** | Compare topics side-by-side in a ranked DataFrame |
75
+ | **DataFrame Batch** | Bulk sentiment analysis on any text DataFrame |
76
+
77
+ ---
78
+
79
+ ## HackerNews Trends (Real Data)
80
+
81
+ ```python
82
+ from trendscout import TrendScout
83
+
84
+ ts = TrendScout()
85
+
86
+ # Search by keyword — uses HN Algolia API
87
+ df = ts.get_hackernews_trends("large language models", limit=20)
88
+ print(df[['title', 'score', 'num_comments', 'author']].head(5))
89
+ # title score num_comments author
90
+ # 0 LLMs are now good enough for production use 847 312 pg
91
+ # 1 Show HN: Open-source LLM benchmark suite 412 189 teyfikoz
92
+ # ...
93
+
94
+ # Top stories right now
95
+ from trendscout.sources.hackernews import HackerNewsSource
96
+ hn = HackerNewsSource()
97
+ top = hn.get_top_stories(limit=10)
98
+ for story in top:
99
+ print(f"[{story.score:4d}] {story.title[:70]}")
100
+ ```
101
+
102
+ ---
103
+
104
+ ## RSS / Atom Feed Parsing
105
+
106
+ ```python
107
+ ts = TrendScout()
108
+
109
+ # Preset categories: tech | ai | business | python | startup
110
+ tech_news = ts.get_rss_trends(category="tech", limit=15)
111
+ ai_news = ts.get_rss_trends(category="ai", limit=10)
112
+
113
+ print(tech_news[['title', 'published', 'feed_name']].head())
114
+
115
+ # Custom feed URLs
116
+ custom = ts.get_rss_trends(
117
+ feeds=[
118
+ "https://feeds.hnrss.org/newest?points=100",
119
+ "https://planetpython.org/rss20.xml",
120
+ ],
121
+ limit=20,
122
+ )
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Trend Velocity Scoring
128
+
129
+ ```python
130
+ velocity = ts.get_trend_velocity("quantum computing")
131
+ print(velocity)
132
+ # Trend : quantum computing
133
+ # Velocity: [████████░░░░░░░░░░░░] 0.42
134
+ # Status : PEAK
135
+ # Articles: 12 | Avg engagement: 156
136
+ # → Trending now — maximise exposure before it plateaus
137
+
138
+ # Status meanings:
139
+ # emerging (0.70–1.00) — fast-growing, act now
140
+ # peak (0.40–0.70) — trending, maximise reach
141
+ # stable (0.15–0.40) — evergreen, good for long-form
142
+ # declining (0.00–0.15) — losing momentum, pivot keywords
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Multi-Topic Comparison
148
+
149
+ ```python
150
+ report = ts.analyze_topics(
151
+ ["AI agents", "blockchain", "quantum computing", "WebAssembly", "Rust"],
152
+ source="hackernews",
153
+ )
154
+ print(report.to_string(index=False))
155
+ # topic velocity_score status article_count avg_engagement
156
+ # AI agents 0.87 emerging 24 312.4
157
+ # Rust 0.64 peak 18 198.2
158
+ # quantum computing 0.42 peak 12 156.1
159
+ # blockchain 0.21 stable 8 89.3
160
+ # WebAssembly 0.09 declining 4 42.0
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Sentiment Analysis
166
+
167
+ ```python
168
+ # General sentiment
169
+ result = ts.analyze_sentiment("The product launch exceeded all expectations.")
170
+ print(result.label) # positive
171
+ print(result.intensity) # strong
172
+ print(result.polarity) # 0.625
173
+
174
+ # Financial domain (detects bullish/bearish signals)
175
+ fin = ts.analyze_sentiment("Revenue surged 40% beating analyst estimates.", domain="financial")
176
+ print(fin.market_signal) # bullish
177
+ print(fin.confidence) # 0.92
178
+
179
+ # Tech news domain
180
+ tech = ts.analyze_sentiment("Critical vulnerability found in popular library.", domain="tech")
181
+ print(tech.market_signal) # bearish
182
+ print(tech.label) # negative
183
+ ```
184
+
185
+ ### Batch DataFrame Analysis
186
+
187
+ ```python
188
+ import pandas as pd
189
+
190
+ headlines = pd.DataFrame({
191
+ 'headline': [
192
+ "OpenAI releases new model beating GPT-4",
193
+ "Tech stocks plunge amid regulatory fears",
194
+ "Startup raises $50M Series B for AI platform",
195
+ "Security breach affects millions of users",
196
+ ]
197
+ })
198
+
199
+ result = ts.analyze_dataframe(headlines, text_col="headline", domain="financial")
200
+ print(result[['headline', 'sentiment_label', 'market_signal', 'polarity']])
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Direct Source Access
206
+
207
+ ```python
208
+ from trendscout.sources.hackernews import HackerNewsSource
209
+ from trendscout.sources.rss import RSSFeedSource
210
+
211
+ # HackerNews
212
+ hn = HackerNewsSource()
213
+ stories = hn.search("python async", limit=5)
214
+ for s in stories:
215
+ print(f"[{s.score}] {s.title}")
216
+
217
+ # RSS
218
+ rss = RSSFeedSource()
219
+ items = rss.fetch("https://feeds.hnrss.org/newest?points=100", limit=5)
220
+ for item in items:
221
+ print(item.title)
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Full Intelligence Pipeline
227
+
228
+ ```python
229
+ from trendscout import TrendScout
230
+
231
+ ts = TrendScout()
232
+ topics = ["AI agents", "edge computing", "Web3", "open source LLMs"]
233
+
234
+ # 1. Velocity comparison
235
+ report = ts.analyze_topics(topics)
236
+
237
+ # 2. Fetch real articles for the top trend
238
+ top_topic = report.iloc[0]['topic']
239
+ articles = ts.get_hackernews_trends(top_topic, limit=20)
240
+
241
+ # 3. Batch sentiment on the articles
242
+ enriched = ts.analyze_dataframe(articles, text_col="title", domain="tech")
243
+
244
+ # 4. Summary
245
+ bullish_count = (enriched['market_signal'] == 'bullish').sum()
246
+ print(f"Top trend: {top_topic}")
247
+ print(f"Velocity: {report.iloc[0]['velocity_score']:.2f} ({report.iloc[0]['status']})")
248
+ print(f"Positive articles: {bullish_count}/{len(enriched)}")
249
+ ```
250
+
251
+ ---
252
+
253
+ ## License
254
+
255
+ MIT — [Teyfik Öz](https://github.com/teyfikoz)
@@ -0,0 +1,227 @@
1
+ # TrendScout
2
+
3
+ **Real-time trend intelligence** — HackerNews search, RSS feed parsing, trend velocity scoring, and multi-domain sentiment analysis. No API key required.
4
+
5
+ [![PyPI version](https://badge.fury.io/py/trendscout.svg)](https://pypi.org/project/trendscout/)
6
+ [![CI](https://github.com/teyfikoz/trendscout/actions/workflows/ci.yml/badge.svg)](https://github.com/teyfikoz/trendscout/actions/workflows/ci.yml)
7
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install trendscout
14
+ ```
15
+
16
+ ## Quick Start
17
+
18
+ ```python
19
+ from trendscout import TrendScout
20
+
21
+ ts = TrendScout()
22
+
23
+ # Real HackerNews data — no API key needed
24
+ df = ts.get_hackernews_trends("AI agents", limit=10)
25
+ print(df[['title', 'score', 'num_comments']].head())
26
+
27
+ # Sentiment with market signal
28
+ result = ts.analyze_sentiment("GPT-5 crushes every benchmark!", domain="tech")
29
+ print(result)
30
+
31
+ # Trend velocity
32
+ velocity = ts.get_trend_velocity("rust programming language")
33
+ print(velocity)
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Features at a Glance
39
+
40
+ | Feature | Description |
41
+ |---------|-------------|
42
+ | **HackerNews API** | Real stories via Algolia — free, no key, always fresh |
43
+ | **RSS/Atom Feeds** | Tech, AI, business, Python presets + custom URLs |
44
+ | **Trend Velocity** | Momentum score 0–1 with status: emerging/peak/stable/declining |
45
+ | **Sentiment Analysis** | TextBlob + domain-aware lexicons (financial, tech, social) |
46
+ | **Multi-topic Analysis** | Compare topics side-by-side in a ranked DataFrame |
47
+ | **DataFrame Batch** | Bulk sentiment analysis on any text DataFrame |
48
+
49
+ ---
50
+
51
+ ## HackerNews Trends (Real Data)
52
+
53
+ ```python
54
+ from trendscout import TrendScout
55
+
56
+ ts = TrendScout()
57
+
58
+ # Search by keyword — uses HN Algolia API
59
+ df = ts.get_hackernews_trends("large language models", limit=20)
60
+ print(df[['title', 'score', 'num_comments', 'author']].head(5))
61
+ # title score num_comments author
62
+ # 0 LLMs are now good enough for production use 847 312 pg
63
+ # 1 Show HN: Open-source LLM benchmark suite 412 189 teyfikoz
64
+ # ...
65
+
66
+ # Top stories right now
67
+ from trendscout.sources.hackernews import HackerNewsSource
68
+ hn = HackerNewsSource()
69
+ top = hn.get_top_stories(limit=10)
70
+ for story in top:
71
+ print(f"[{story.score:4d}] {story.title[:70]}")
72
+ ```
73
+
74
+ ---
75
+
76
+ ## RSS / Atom Feed Parsing
77
+
78
+ ```python
79
+ ts = TrendScout()
80
+
81
+ # Preset categories: tech | ai | business | python | startup
82
+ tech_news = ts.get_rss_trends(category="tech", limit=15)
83
+ ai_news = ts.get_rss_trends(category="ai", limit=10)
84
+
85
+ print(tech_news[['title', 'published', 'feed_name']].head())
86
+
87
+ # Custom feed URLs
88
+ custom = ts.get_rss_trends(
89
+ feeds=[
90
+ "https://feeds.hnrss.org/newest?points=100",
91
+ "https://planetpython.org/rss20.xml",
92
+ ],
93
+ limit=20,
94
+ )
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Trend Velocity Scoring
100
+
101
+ ```python
102
+ velocity = ts.get_trend_velocity("quantum computing")
103
+ print(velocity)
104
+ # Trend : quantum computing
105
+ # Velocity: [████████░░░░░░░░░░░░] 0.42
106
+ # Status : PEAK
107
+ # Articles: 12 | Avg engagement: 156
108
+ # → Trending now — maximise exposure before it plateaus
109
+
110
+ # Status meanings:
111
+ # emerging (0.70–1.00) — fast-growing, act now
112
+ # peak (0.40–0.70) — trending, maximise reach
113
+ # stable (0.15–0.40) — evergreen, good for long-form
114
+ # declining (0.00–0.15) — losing momentum, pivot keywords
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Multi-Topic Comparison
120
+
121
+ ```python
122
+ report = ts.analyze_topics(
123
+ ["AI agents", "blockchain", "quantum computing", "WebAssembly", "Rust"],
124
+ source="hackernews",
125
+ )
126
+ print(report.to_string(index=False))
127
+ # topic velocity_score status article_count avg_engagement
128
+ # AI agents 0.87 emerging 24 312.4
129
+ # Rust 0.64 peak 18 198.2
130
+ # quantum computing 0.42 peak 12 156.1
131
+ # blockchain 0.21 stable 8 89.3
132
+ # WebAssembly 0.09 declining 4 42.0
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Sentiment Analysis
138
+
139
+ ```python
140
+ # General sentiment
141
+ result = ts.analyze_sentiment("The product launch exceeded all expectations.")
142
+ print(result.label) # positive
143
+ print(result.intensity) # strong
144
+ print(result.polarity) # 0.625
145
+
146
+ # Financial domain (detects bullish/bearish signals)
147
+ fin = ts.analyze_sentiment("Revenue surged 40% beating analyst estimates.", domain="financial")
148
+ print(fin.market_signal) # bullish
149
+ print(fin.confidence) # 0.92
150
+
151
+ # Tech news domain
152
+ tech = ts.analyze_sentiment("Critical vulnerability found in popular library.", domain="tech")
153
+ print(tech.market_signal) # bearish
154
+ print(tech.label) # negative
155
+ ```
156
+
157
+ ### Batch DataFrame Analysis
158
+
159
+ ```python
160
+ import pandas as pd
161
+
162
+ headlines = pd.DataFrame({
163
+ 'headline': [
164
+ "OpenAI releases new model beating GPT-4",
165
+ "Tech stocks plunge amid regulatory fears",
166
+ "Startup raises $50M Series B for AI platform",
167
+ "Security breach affects millions of users",
168
+ ]
169
+ })
170
+
171
+ result = ts.analyze_dataframe(headlines, text_col="headline", domain="financial")
172
+ print(result[['headline', 'sentiment_label', 'market_signal', 'polarity']])
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Direct Source Access
178
+
179
+ ```python
180
+ from trendscout.sources.hackernews import HackerNewsSource
181
+ from trendscout.sources.rss import RSSFeedSource
182
+
183
+ # HackerNews
184
+ hn = HackerNewsSource()
185
+ stories = hn.search("python async", limit=5)
186
+ for s in stories:
187
+ print(f"[{s.score}] {s.title}")
188
+
189
+ # RSS
190
+ rss = RSSFeedSource()
191
+ items = rss.fetch("https://feeds.hnrss.org/newest?points=100", limit=5)
192
+ for item in items:
193
+ print(item.title)
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Full Intelligence Pipeline
199
+
200
+ ```python
201
+ from trendscout import TrendScout
202
+
203
+ ts = TrendScout()
204
+ topics = ["AI agents", "edge computing", "Web3", "open source LLMs"]
205
+
206
+ # 1. Velocity comparison
207
+ report = ts.analyze_topics(topics)
208
+
209
+ # 2. Fetch real articles for the top trend
210
+ top_topic = report.iloc[0]['topic']
211
+ articles = ts.get_hackernews_trends(top_topic, limit=20)
212
+
213
+ # 3. Batch sentiment on the articles
214
+ enriched = ts.analyze_dataframe(articles, text_col="title", domain="tech")
215
+
216
+ # 4. Summary
217
+ bullish_count = (enriched['market_signal'] == 'bullish').sum()
218
+ print(f"Top trend: {top_topic}")
219
+ print(f"Velocity: {report.iloc[0]['velocity_score']:.2f} ({report.iloc[0]['status']})")
220
+ print(f"Positive articles: {bullish_count}/{len(enriched)}")
221
+ ```
222
+
223
+ ---
224
+
225
+ ## License
226
+
227
+ MIT — [Teyfik Öz](https://github.com/teyfikoz)
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["setuptools>=65.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "trendscout"
7
+ version = "1.1.0"
8
+ description = "Real-time trend intelligence with HackerNews, RSS feeds, trend velocity, and multi-domain sentiment"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Teyfik OZ", email = "teyfikoz@yahoo.com" }
12
+ ]
13
+ license = {text = "MIT"}
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Scientific/Engineering :: Information Analysis",
23
+ ]
24
+ keywords = ["trends", "sentiment", "market-analysis", "nlp", "scraping"]
25
+ requires-python = ">=3.10"
26
+ dependencies = [
27
+ "beautifulsoup4>=4.12.0",
28
+ "pandas>=2.0.0",
29
+ "requests>=2.31.0",
30
+ "textblob>=0.17.0",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=7.0",
36
+ "ruff>=0.1.0",
37
+ ]
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/teyfikoz/trendscout"
41
+ Repository = "https://github.com/teyfikoz/trendscout"
42
+ Issues = "https://github.com/teyfikoz/trendscout/issues"
43
+
44
+ [tool.setuptools.packages.find]
45
+ where = ["."]
46
+ include = ["trendscout*"]
47
+
48
+ [tool.ruff]
49
+ line-length = 100
50
+ target-version = "py310"
51
+
52
+ [tool.ruff.lint]
53
+ select = ["E", "F", "W", "I"]
54
+ ignore = ["E501"]