Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ jobs:
runs-on: ubuntu-latest
name: Build documentation
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Set up Python 3.10
run: uv python install 3.10

- name: Install package
run: poetry install
run: uv sync --extra dev

- name: Build documentation
run: poetry run make html --directory docs/
run: uv run make html --directory docs/
20 changes: 8 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ jobs:

steps:
- name: Check-out repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Set up Python
run: uv python install 3.11

- name: Install package
run: poetry install
run: uv sync

- name: Build wheels and source tarball
run: poetry build
run: uv build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -38,4 +34,4 @@ jobs:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
verify_metadata: true
verbose: true
verbose: true
22 changes: 9 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,27 @@ jobs:
- { os: ubuntu-latest, py: "3.10" }

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.config.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config.py }}
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Set up Python ${{ matrix.config.py }}
run: uv python install ${{ matrix.config.py }}

- name: Install package
run: poetry install
run: uv sync --extra dev

- name: Test with pytest
run: poetry run pytest tests/ --cov=imf_reader --cov-report=xml
run: uv run pytest tests/ --cov=imf_reader --cov-report=xml

- name: Use Codecov to track coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml # coverage report
files: ./coverage.xml
fail_ci_if_error: true
verbose: true

- name: Check code style
run: poetry run black src tests --check
run: uv run black src tests --check
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v1.4.0 (2025-12-05)
- The October 2025 release of WEO removed bulk downloads and moved everything towards the SDMX API. This update provides a way to parse new releases from the API instead of relying on the XML files. Note that thew new API response does not include observation-level notes or information on when projections start for each country-indicator.

## v1.3.0 (2025-2-05)
- Made function available to fetch latest holdings and allocations date
- Improved handling of unavailable dates
Expand Down
2,297 changes: 0 additions & 2,297 deletions poetry.lock

This file was deleted.

64 changes: 35 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
[tool.poetry]
[project]
name = "imf-reader"
version = "1.3.1"
version = "1.4.0"
description = "A package to access imf data"
authors = ["The ONE Campaign"]
license = "MIT"
authors = [{ name = "The ONE Campaign" }]
license = { text = "MIT" }
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"pandas>=2.2.2",
"requests>=2.32.1",
"chardet>=5.2.0",
"beautifulsoup4>=4.12.3",
"diskcache>=5.6.0",
]

[tool.poetry.dependencies]
python = "^3.10"
pandas = "^2.2.2"
requests = "^2.32.1"
chardet = "^5.2.0"
beautifulsoup4 = "^4.12.3"

[tool.poetry.dev-dependencies]

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.0"
black = "^24.4.2"
sphinx = "^7.3.7"
myst-nb = "^1.1.0"
autoapi = "^2.0.1"
sphinx-autoapi = "^3.0.0"
sphinx-rtd-theme = "^2.0.0"
pytest-cov = "^5.0.0"
[project.optional-dependencies]
dev = [
"pytest>=8.2.0",
"black>=24.4.2",
"sphinx>=7.3.7",
"myst-nb>=1.1.0",
"autoapi>=2.0.1",
"sphinx-autoapi>=3.0.0",
"sphinx-rtd-theme>=2.0.0",
"pytest-cov>=5.0.0",
]

[tool.semantic_release]
version_toml = [
"pyproject.toml:tool.poetry.version",
] # version location
branch = "main" # branch to make releases of
changelog_file = "CHANGELOG.md" # changelog file
build_command = "pip install poetry && poetry build" # build dists
"pyproject.toml:project.version",
]
branch = "main"
changelog_file = "CHANGELOG.md"
build_command = "pip install uv && uv build"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["uv_build>=0.9.15,<0.10"]
build-backend = "uv_build"

[dependency-groups]
dev = [
"pytest>=9.0.1",
]
14 changes: 0 additions & 14 deletions requirements.txt

This file was deleted.

1 change: 1 addition & 0 deletions src/imf_reader/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ class UnexpectedFileError(Exception):
shell_formatter = logging.Formatter(fmt_shell) # Create formatters
shell_handler.setFormatter(shell_formatter) # Add formatters to handlers
logger.addHandler(shell_handler) # Add handlers to the logger
logger.propagate = False # Prevent duplicate logs when user configures root logger
14 changes: 9 additions & 5 deletions src/imf_reader/sdr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@

"""

from imf_reader.sdr.read_interest_rate import fetch_interest_rates
from imf_reader.sdr.read_exchange_rate import fetch_exchange_rates
from imf_reader.sdr.read_interest_rate import (
fetch_interest_rates as fetch_interest_rates,
)
from imf_reader.sdr.read_exchange_rate import (
fetch_exchange_rates as fetch_exchange_rates,
)
from imf_reader.sdr.read_announcements import (
fetch_allocations_holdings,
fetch_latest_allocations_holdings_date,
fetch_allocations_holdings as fetch_allocations_holdings,
fetch_latest_allocations_holdings_date as fetch_latest_allocations_holdings_date,
)
from imf_reader.sdr.clear_cache import clear_cache
from imf_reader.sdr.clear_cache import clear_cache as clear_cache
4 changes: 1 addition & 3 deletions src/imf_reader/sdr/read_interest_rate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""Module to read SDR interest and exchange rates from the IMF website

"""
"""Module to read SDR interest and exchange rates from the IMF website"""

import requests
import pandas as pd
Expand Down
11 changes: 10 additions & 1 deletion src/imf_reader/weo/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
from imf_reader.weo.reader import fetch_data, clear_cache
from typing import Literal, Tuple

# Type definitions must come before imports to avoid circular import
ValidMonths = Literal["April", "October"] # Type hint for valid months
Version = Tuple[ValidMonths, int] # Type hint for version as a tuple of month and year

from imf_reader.weo.reader import ( # noqa: E402
clear_cache as clear_cache,
fetch_data as fetch_data,
)
Loading