diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92edc06..28ab43d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-yaml - id: end-of-file-fixer @@ -13,12 +13,12 @@ repos: hooks: - id: seed-isort-config - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort # flake8 - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 args: # arguments to configure flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 820491c..9178a02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to ## [Unreleased] +## [v2.12.1] - 2024-05-02 +### Fixed +- AttributeError when ibond interest rates are fetched. +- Add dependency to latest version of yfinance (removes some warnings that +older version is throwing). + ## [v2.12.0] - 2023-11-18 ### Fixed - yfinance threw error while fetching names of tickers from yahoo finance. diff --git a/lakshmi/assets.py b/lakshmi/assets.py index bc06ea1..ac38a87 100644 --- a/lakshmi/assets.py +++ b/lakshmi/assets.py @@ -881,7 +881,8 @@ def get(self): if self._interest_rates.is_current(): return self._interest_rates else: - self._interest_rates = self.get_interest_rates() + self._interest_rates = ibonds.InterestRates( + self.get_interest_rates()) return self._interest_rates def cache_key(self): diff --git a/lakshmi/constants.py b/lakshmi/constants.py index 55b1308..af24487 100644 --- a/lakshmi/constants.py +++ b/lakshmi/constants.py @@ -1,4 +1,4 @@ """Lakshmi constants.""" NAME = 'lakshmi' -VERSION = '2.12.0' +VERSION = '2.12.1' diff --git a/lakshmi/table.py b/lakshmi/table.py index 745b8db..46de97f 100644 --- a/lakshmi/table.py +++ b/lakshmi/table.py @@ -20,8 +20,8 @@ class Table(): 'str': lambda x: x, 'dollars': lambda x: utils.format_money(x), 'delta_dollars': lambda x: utils.format_money_delta(x), - 'percentage': lambda x: f'{round(100*x)}%', - 'percentage_1': lambda x: f'{round(100*x,1)}%', + 'percentage': lambda x: f'{round(100 * x)}%', + 'percentage_1': lambda x: f'{round(100 * x, 1)}%', 'float': lambda x: str(float(x)), } diff --git a/requirements.txt b/requirements.txt index 9f25c8b..7d74694 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ appdirs==1.4.4 -backports.entry-points-selectable==1.2.0 -beautifulsoup4==4.12.2 +backports.entry-points-selectable==1.3.0 +beautifulsoup4==4.12.3 bleach==6.1.0 -certifi==2023.11.17 +certifi==2024.2.2 cffi==1.16.0 cfgv==3.4.0 chardet==5.2.0 @@ -10,55 +10,59 @@ charset-normalizer==3.3.2 click==8.1.7 colorama==0.4.6 commonmark==0.9.1 -cryptography==41.0.5 -distlib==0.3.7 -docutils==0.20.1 -filelock==3.13.1 -frozendict==2.3.8 +cryptography==42.0.5 +distlib==0.3.8 +docutils==0.21.2 +filelock==3.14.0 +frozendict==2.4.2 html5lib==1.1 -ibonds==1.0.3 -identify==2.5.32 -idna==3.4 -importlib-metadata==6.8.0 -jaraco.classes==3.3.0 +ibonds==1.0.4 +identify==2.5.36 +idna==3.7 +importlib_metadata==7.1.0 +jaraco.classes==3.4.0 +jaraco.context==5.3.0 +jaraco.functools==4.0.1 jeepney==0.8.0 -keyring==24.3.0 -lxml==4.9.3 +keyring==25.2.0 +lxml==5.2.1 markdown-it-py==3.0.0 mdurl==0.1.2 -more-itertools==10.1.0 +more-itertools==10.2.0 multitasking==0.0.11 -nh3==0.2.14 +nh3==0.2.17 nodeenv==1.8.0 -numpy==1.26.2 -packaging==23.2 -pandas==2.1.3 -peewee==3.17.0 -pkginfo==1.9.6 -platformdirs==3.11.0 -pre-commit==3.5.0 -pycparser==2.21 -Pygments==2.17.0 -pyparsing==3.1.1 -python-dateutil==2.8.2 -pytz==2023.3.post1 -pyxirr==0.9.3 +numpy==1.26.4 +packaging==24.0 +pandas==2.2.2 +peewee==3.17.3 +pkginfo==1.10.0 +platformdirs==4.2.1 +pre-commit==3.7.0 +pycparser==2.22 +Pygments==2.17.2 +pyparsing==3.1.2 +python-dateutil==2.9.0.post0 +pytz==2024.1 +pyxirr==0.10.3 PyYAML==6.0.1 -readme-renderer==42.0 +readme_renderer==43.0 requests==2.31.0 requests-toolbelt==1.0.0 rfc3986==2.0.0 -rich==13.7.0 +rich==13.7.1 SecretStorage==3.3.3 +setuptools==69.5.1 six==1.16.0 soupsieve==2.5 tabulate==0.9.0 toml==0.10.2 -tqdm==4.66.1 -twine==4.0.2 -tzdata==2023.3 -urllib3==2.1.0 -virtualenv==20.24.6 +tqdm==4.66.4 +twine==5.0.0 +tzdata==2024.1 +urllib3==2.2.1 +virtualenv==20.26.1 webencodings==0.5.1 -yfinance==0.2.32 -zipp==3.17.0 +wheel==0.43.0 +yfinance==0.2.38 +zipp==3.18.1 diff --git a/setup.py b/setup.py index 66fc109..aaf2995 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ 'PyYAML>=5.4,<7.0', 'requests~=2.25', 'tabulate~=0.8', - 'yfinance>=0.2.32,<0.3', + 'yfinance>=0.2.38,<0.3', ], entry_points={ 'console_scripts': [ diff --git a/tests/test_data.py b/tests/test_data.py index a4bba9b..d8afee4 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -1,7 +1,9 @@ """Tests for lakshmi/data directory. Simply checks if the files parses.""" import unittest from pathlib import Path +from unittest.mock import patch +import ibonds import yaml import lakshmi @@ -26,7 +28,17 @@ def test_ee_bonds(self): self.assertIsNotNone(self.parse_dict('lakshmi/data/EEBonds.yaml', lakshmi.assets.EEBonds.from_dict)) - def test_i_bonds(self): + @patch('lakshmi.assets.IBonds._InterestRates.get') + def test_i_bonds(self, mock_get): + INTEREST_RATE_DATA = """ + 2020-11-01: + - 0.00 + - 0.84 + 2021-05-01: + - 0.00 + - 1.77 + """ + mock_get.return_value = ibonds.InterestRates(INTEREST_RATE_DATA) self.assertIsNotNone(self.parse_dict('lakshmi/data/IBonds.yaml', lakshmi.assets.IBonds.from_dict))