From c72224efd2219db9b926de9c7ca8d312132ab592 Mon Sep 17 00:00:00 2001 From: dr-leo Date: Sat, 25 Feb 2023 20:23:44 +0100 Subject: [PATCH] Remove tests-based code example from walkthrough. More precise requirements, back to python 3.9 importlib.resources --- doc/requirements.txt | 3 ++- doc/walkthrough.rst | 11 ++--------- pandasdmx/source/__init__.py | 3 +-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index f788e9dfe..133aa04ce 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,6 @@ lxml=4.9.2 -requests==2.28 +requests==2.28.1 +requests-cache==0.9.7 pandas==1.5.2 sphinx==5.3 ipython==8.7.0 diff --git a/doc/walkthrough.rst b/doc/walkthrough.rst index 6c24c767a..49f116155 100644 --- a/doc/walkthrough.rst +++ b/doc/walkthrough.rst @@ -555,15 +555,8 @@ e.g., to access a cloud storage provider's file system. Likewise, :func:`.read_sdmx` can be used to load SDMX messages stored in local files or -remote files using FSSPEC: - -.. ipython:: python - - # Use an example ('specimen') file from the pandaSDMX test suite - from pandasdmx.tests.data import specimen - # …with time-series exchange rate data from the EU Central Bank - with specimen('ECB_EXR/ng-ts.xml') as f: - sdmx.read_sdmx(f) +remote files using +`FSSPEC `__. Handle errors diff --git a/pandasdmx/source/__init__.py b/pandasdmx/source/__init__.py index 862b6847d..74b9a5eda 100644 --- a/pandasdmx/source/__init__.py +++ b/pandasdmx/source/__init__.py @@ -207,8 +207,7 @@ def list_sources(): def load_package_sources(): """Discover all sources listed in ``sources.json``.""" - # py3.9+: with resources.files("pandasdmx").joinpath("sources.json").open("rb") as f: - with resources.open_binary("pandasdmx", "sources.json") as f: + with resources.files("pandasdmx").joinpath("sources.json").open("rb") as f: for info in json.load(f): add_source(info)