'A simplified aggegate of FRED data using fredapi package'
Project description
lazy_fred: Effortless FRED Data Collection
lazy_fred is a Python library designed to simplify collecting economic data from the Federal Reserve Economic Data (FRED) API. It searches across categories, filters series by popularity/frequency, and exports results to CSV files.
Features
- Automated search across FRED categories
- Filtered selection by frequency (daily/weekly/monthly) and popularity
- Retry and logging for robust data collection
- CSV exports for the filtered series + daily/weekly/monthly observations
Installation
From PyPI (recommended)
python -m pip install --upgrade lazy_fred
From source (Poetry)
poetry install
Configure your FRED API key
lazy_fred expects a FRED API_KEY. You can provide it either by:
- Creating a local
.envfile in your working directory:API_KEY=your_fred_api_key_here
- Or exporting it as an environment variable:
set API_KEY=your_fred_api_key_here
If API_KEY is missing, the CLI will prompt you for it and write it to .env.
Quick start (CLI)
After installation, run one of these:
lazy-fred
# or
lazy_fred
Then type:
run-allto pull all default categories, orrunto use your current selected categories.
Quick start (Colab/Jupyter UI)
Use this if you want buttons instead of terminal prompts:
!pip install -U lazy_fred ipywidgets
import lazy_fred as lf
lf.launch_notebook_ui("YOUR_FRED_API_KEY")
In the UI:
- select categories and click Run collection, or
- click Run all defaults.
Beginner guide (step-by-step)
If you just want this to work, follow these exact steps.
Step 1: Install Python
- Install Python 3.10+ from https://www.python.org/downloads/
- During install on Windows, check "Add Python to PATH"
Step 2: Install lazy_fred
Open a terminal and run:
python -m pip install --upgrade pip
python -m pip install --upgrade lazy_fred
Step 3: Get a free FRED API key
- Create/sign in to FRED: https://fred.stlouisfed.org/
- Generate your API key: https://fred.stlouisfed.org/docs/api/api_key.html
- Copy the key
Step 4: Set your API key
Pick one option:
Option A (recommended): create a .env file in the folder where you will run commands:
API_KEY=paste_your_real_key_here
Option B: set it in your terminal session.
Windows (PowerShell):
$env:API_KEY="paste_your_real_key_here"
macOS/Linux (bash/zsh):
export API_KEY="paste_your_real_key_here"
Step 5: Run the app
lazy-fred
# or
lazy_fred
You will see this menu:
a= add a search categoryr= remove a search categoryc= clear categoriesrun= start data collectionq= quit
For first run: type run and press Enter.
Step 6: Find your output files
After it finishes, these files will be created in your current folder:
filtered_series.csvdaily_data.csvweekly_data.csvmonthly_data.csv
Common beginner issues
lazy-fred/lazy_fredcommand not found: runpython -m pip install --upgrade lazy_fredagain, then open a new terminal.- API key error: confirm key is valid and named exactly
API_KEY. - No output yet: first run can take time because it queries many series.
- Running in notebooks/background tasks: this tool is interactive (
input()), so use a normal terminal.
Output files
When you choose run, the project will generate these CSV files in your current directory:
filtered_series.csvdaily_data.csvweekly_data.csvmonthly_data.csv
Programmatic usage
import lazy_fred as lf
lf.run_fred_data_collection("insert_api_key_here")
This will also start the interactive menu (it blocks on input()).
Favorite quick-run commands (most popular themes)
Use these to pull popular groups quickly without menu prompts:
import lazy_fred as lf
api_key = "YOUR_FRED_API_KEY"
lf.run_favorites(api_key, "macro") # GDP, inflation, unemployment, rates
Other profiles:
lf.run_favorites(api_key, "rates") # rates + FX + monetary
lf.run_favorites(api_key, "labor") # employment + openings + income
lf.run_favorites(api_key, "markets") # financial + banking + housing + retail
If you want custom categories:
lf.run_fred_data_collection(
api_key,
categories=["gdp", "unemployment", "retail trade"],
interactive=False
)
Terminal power-user shortcuts
Inside the TUI menu:
rs= reset categories to defaultsrun-all= reset to defaults and run everything immediately
Development
- Lint:
poetry run ruff check . - Tests (requires a real key):
API_KEY=<your_key> poetry run pytest
Release process
1) Bump version
Update version in pyproject.toml (for example, 0.1.66 -> 0.1.67), then commit and push.
2) Publish via GitHub Trusted Publishing (recommended)
This repository includes .github/workflows/publish-pypi.yml.
It publishes to PyPI automatically when you:
- publish a GitHub Release, or
- push a version tag matching
v*(example:v0.1.67)
Example:
git tag v0.1.67
git push origin v0.1.67
Requirements:
- PyPI project
lazy_fredmust have this GitHub repository configured as a Trusted Publisher.
3) Poetry fallback publish (manual)
If you need a manual fallback path, run the same GitHub workflow from the Actions tab with:
publish_method = poetry
This method uses:
poetry publish --build --skip-existing- repository secret
PYPI_API_TOKEN
4) Verify release
After publish, confirm the new version appears at:
Disclaimer
This library is not affiliated with or endorsed by the Federal Reserve Bank of St. Louis or the FRED project.
Acknowledgments
This project utilizes the fredapi and fred libraries for interacting with the FRED API.
Contributions
Contributions are welcome. Feel free to open issues or submit pull requests.
License
MIT
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 lazy_fred-0.1.67.tar.gz.
File metadata
- Download URL: lazy_fred-0.1.67.tar.gz
- Upload date:
- Size: 25.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6fbfafa7ebc9aa3ee451c02bb95dabbea197637233814de9947b612d3995e3a
|
|
| MD5 |
c2d14cbf658dc1307449924f737879d3
|
|
| BLAKE2b-256 |
0167d6cf7f9d3d4bcf34cc0bf9e66558ecb51406679ed56557d5204ebe118add
|
File details
Details for the file lazy_fred-0.1.67-py3-none-any.whl.
File metadata
- Download URL: lazy_fred-0.1.67-py3-none-any.whl
- Upload date:
- Size: 25.2 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 |
3c01047e7ac43987d040edc94bffb84fd7c998cb69b5ccd71d816e3e3677b304
|
|
| MD5 |
9922c5459bc0365a9cdcfe17adf2b6fc
|
|
| BLAKE2b-256 |
9e08787d1c21b848a997fb384aa51c1d81867f58f519e2b3d5264460a5acbe75
|