A type-safe Python library for querying, streaming, and exporting Google Trends data
Project description
Trendflow
A type-safe Python library for querying, streaming, and exporting Google Trends data
- GitHub: https://github.com/dariomory/trendflow/
- PyPI package: https://pypi.org/project/trendflow-py/ (install name
trendflow-py; import astrendflow) - Created by: Dario Mory | GitHub https://github.com/dariomory | PyPI https://pypi.org/user/dariomory/
- Free software: MIT License
Features
- Type-safe API: regions, timeframes, resolutions, and export formats use enums instead of raw strings.
- Rich queries: interest over time, regional breakdown, live trending searches, and related queries, with dataclass results.
- Exports: JSON, CSV, or load results into a pandas
DataFrame.
Usage
import trendflow
from trendflow import Region, Timeframe, Resolution, ExportFormat
# Initialize client (optional API config)
tf = trendflow.Client(language="en", timeout=10)
# --- Enums for type safety ---
# Region.US, Region.GB, Region.DE ...
# Timeframe.PAST_DAY, Timeframe.PAST_WEEK, Timeframe.PAST_YEAR, Timeframe.PAST_5_YEARS
# Resolution.COUNTRY, Resolution.REGION, Resolution.CITY
# Fetch interest over time
data = tf.interest_over_time(
keywords=["Python", "JavaScript", "Rust"],
timeframe=Timeframe.PAST_YEAR,
region=Region.US,
)
# Dataclass-backed results
print(data.keywords) # ["Python", "JavaScript", "Rust"]
print(data.granularity) # "weekly"
print(data.points) # list of TrendPoint(date, scores: dict)
# Get regional breakdown (region defaults to Region.US)
regional = tf.interest_by_region(
keyword="Python",
resolution=Resolution.COUNTRY,
)
# Trending searches right now
trending = tf.trending_now(region=Region.US)
for item in trending.results:
print(item.title, item.traffic, item.articles) # TrendingItem dataclass
# Related queries — returns RelatedResult dataclass
related = tf.related_queries("machine learning")
for query in related.top:
print(query.term, query.value) # RelatedQuery(term, value)
for query in related.rising:
print(query.term, query.breakout) # RelatedQuery(term, breakout%)
# --- Exports ---
data.export(ExportFormat.CSV, path="trends.csv")
data.export(ExportFormat.JSON, path="trends.json")
data.to_dataframe() # pandas DataFrame
Documentation
Documentation is built with Zensical and deployed to GitHub Pages.
- Live site: https://dariomory.github.io/trendflow/
- Preview locally:
just docs-serve(serves at http://localhost:8000) - Build:
just docs-build
API documentation is auto-generated from docstrings using mkdocstrings.
Docs deploy automatically on push to master or main via GitHub Actions.
Development
To set up for local development:
# Clone your fork
git clone git@github.com:dariomory/trendflow.git
cd trendflow
# Install in editable mode with live updates
uv tool install --editable .
This installs the CLI globally but with live updates - any changes you make to the source code are immediately available when you run trendflow.
Run tests:
uv run pytest
Run quality checks (format, lint, type check, test):
just qa
Author
Trendflow was created in 2026 by Dario Mory
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trendflow_py-0.1.1.tar.gz.
File metadata
- Download URL: trendflow_py-0.1.1.tar.gz
- Upload date:
- Size: 192.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1690250c0ff7f3000bbe87f1123073dac12b30498f7049a82a3358a7f70c1a2
|
|
| MD5 |
668ac532298f7a3c836a6d36dbb0e937
|
|
| BLAKE2b-256 |
9838d0c89b234584216379867fff33b2994a2b5d788ceba0dfb8c52b3052ada3
|
Provenance
The following attestation bundles were made for trendflow_py-0.1.1.tar.gz:
Publisher:
publish.yml on dariomory/trendflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trendflow_py-0.1.1.tar.gz -
Subject digest:
a1690250c0ff7f3000bbe87f1123073dac12b30498f7049a82a3358a7f70c1a2 - Sigstore transparency entry: 1391881370
- Sigstore integration time:
-
Permalink:
dariomory/trendflow@5b964bfa3f603dd0851fccb4ac368413e41f6ff1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/dariomory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b964bfa3f603dd0851fccb4ac368413e41f6ff1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file trendflow_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: trendflow_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5656d2b420718f2ae6554f1b9bff2556e7b5fe3957ab05c690e5199c85d519f1
|
|
| MD5 |
a6b16d3215e66a94e6fa0b1d472372c4
|
|
| BLAKE2b-256 |
5680ffb8c2535b7ed5ce9c35e529d473becc439772ea7bbac5147790cf41d2af
|
Provenance
The following attestation bundles were made for trendflow_py-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on dariomory/trendflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trendflow_py-0.1.1-py3-none-any.whl -
Subject digest:
5656d2b420718f2ae6554f1b9bff2556e7b5fe3957ab05c690e5199c85d519f1 - Sigstore transparency entry: 1391881381
- Sigstore integration time:
-
Permalink:
dariomory/trendflow@5b964bfa3f603dd0851fccb4ac368413e41f6ff1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/dariomory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5b964bfa3f603dd0851fccb4ac368413e41f6ff1 -
Trigger Event:
push
-
Statement type: