Skip to content

Commit a97e545

Browse files
committed
refactor: bump up version / fix import modules / add test
1 parent f49ef28 commit a97e545

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tool.pytest.ini_options]
2+
pythonpath = [
3+
".", "src", "tests", "src",
4+
]

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import setuptools
2+
from src.version import __version__
23

34
with open("README.md", "r") as ld:
45
long_description = ld.read()
56

67
setuptools.setup(
78
name="myeia",
8-
version="0.2.0",
9+
version=__version__,
910
url="https://github.com/philsv/myeia",
1011
license="MIT",
1112
author="philsv",

src/myeia.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
import pandas as pd
77
import requests
88
from dotenv import load_dotenv
9-
from pandas.core.common import SettingWithCopyWarning
109

11-
warnings.simplefilter(action="ignore", category=SettingWithCopyWarning)
10+
warnings.simplefilter(action="ignore", category=pd.errors.PerformanceWarning)
1211
load_dotenv()
1312

1413

@@ -37,9 +36,7 @@ def get_data(
3736
"Accept": "*/*",
3837
}
3938

40-
api_route = (
41-
f"{route}/data/?api_key={self.token}&data[]=value&frequency={frequency}"
42-
)
39+
api_route = f"{route}/data/?api_key={self.token}&data[]=value&frequency={frequency}"
4340

4441
series = f"&facets[{facet}][]={series}"
4542

@@ -73,15 +70,4 @@ def get_data(
7370
df.rename(columns={df.columns[0]: "Date"}, inplace=True)
7471
df["Date"] = pd.to_datetime(df["Date"])
7572
df.set_index("Date", inplace=True)
76-
7773
return df
78-
79-
80-
# if __name__ == "__main__":
81-
82-
# # Example
83-
# eia = API()
84-
# df = eia.get_data(
85-
# route="steo", series="PAPR_OPEC", frequency="monthly", facet="seriesId"
86-
# )
87-
# print(df.head())

src/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.2.1"

tests/test_myeia.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import pandas as pd
2+
3+
from src import myeia
4+
5+
6+
def test_get_data():
7+
eia = myeia.API()
8+
df = eia.get_data(route="natural-gas/pri/fut", series="RNGC1", frequency="daily")
9+
assert isinstance(df, pd.DataFrame)

0 commit comments

Comments
 (0)