Skip to content

Commit

Permalink
Patch:
Browse files Browse the repository at this point in the history
Update dependencies
Fix pyproject.toml bug
Automate publishing to PyPi
  • Loading branch information
chriscarrollsmith committed Apr 23, 2024
1 parent 232a850 commit be4d2b8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: build-test

on:
push:
branches: [main, master]
branches: [main]
pull_request:
branches: [main, master]
branches: [main]

jobs:
build:
Expand All @@ -25,21 +25,20 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
- name: Configure Poetry
- name: Build and install project
run: |
poetry config virtualenvs.in-project true
- name: Install project
run: |
poetry install --no-interaction
poetry build
poetry install
- name: Run tests with pytest
run: |
source .venv/scripts/activate
poetry shell
pytest --version
pytest tests
if: runner.os == 'Windows'
- name: Activate venv other
- name: Publish any new version to PyPi
run: |
source .venv/bin/activate
pytest --version
pytest tests
if: runner.os != 'Windows'
- name: Publish to PyPi
run: |
poetry publish --build
if [ $? -ne 0 ]; then
echo "Warning: Version has not been incremented. No new version published."
fi
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# imfp

[![Tests](https://github.com/chriscarrollsmith/imfp/actions/workflows/actions.yml/badge.svg)](https://github.com/chriscarrollsmith/imfp/actions/workflows/actions.yml)
[![PyPI Version](https://img.shields.io/pypi/v/imfp.svg)](https://pypi.python.org/pypi/imfp)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

`imfp`, by Christopher C. Smith, is a Python package for downloading data from the [International Monetary
Fund's](http://data.imf.org/) [RESTful JSON
API](http://datahelp.imf.org/knowledgebase/articles/667681-using-json-restful-web-service). (R user? [See here](https://github.com/christophergandrud/imfr) for the R version, `imfr v2`.)
API](http://datahelp.imf.org/knowledgebase/articles/667681-using-json-restful-web-service).

## Installation

Expand Down Expand Up @@ -97,7 +98,6 @@ This function returns the IMF’s listing of 259 databases available through the
To view and explore the database list, it’s possible to explore subsets of the data frame by row number with `databases.loc`:



```python
# View a subset consisting of rows 5 through 9
databases.loc[5:9]
Expand Down Expand Up @@ -697,6 +697,16 @@ By default, `imfp` enforces a mandatory 1.5-second wait time between API calls t

Also note that by default, `imfp` functions will retry any API call rejected for bandwidth or rate limit reasons. The number of times `imfp` will attempt the call is set by the `times` argument, with a default value of 3. (With this value, requests will be retried twice after an initial failure.) Note that `imfp` enforces an exponentially increasing wait time between function calls, with a base wait time of 5 seconds on the first retry, so it is not recommended to set a high value for `times`.

## Planned features

- Implement automatic build/render of readthedocs documentation with Sphinx
- Implement automatic build/release/publish of package updates
- Move response mocking functionality from `_download_parse` to `_imf_get`
- Investigate and implement different and more appropriate exception types, as we're currently handling too many different cases with `ValueError`
- More fully investigate the types of metadata available through the API and the most appropriate way to return them when a user calls `include_metadata`
- Implement optional response caching for `imf_databases` and `imf_parameters`
- Simplify and modularize some of the code, particularly in `imf_dataset`

## Contributing

I would love to have your help in improving `imfp`. If you encounter a bug while using the library, please open an issue. Alternatively, fix the bug and open a pull request. Thanks in advance for your help!
12 changes: 5 additions & 7 deletions build-workflow.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
Change README.ipynb

poetry run python README_files/render.py

Change code
Change README
Change NEWS

black imfp
black tests
py README_files\render.py
poetry version patch/minor/major
poetry lock
poetry build
poetry install
pytest tests
poetry publish

poetry version patch/minor/major
Git commit/push
Github release
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "imfp"
version = "1.1.0"
version = "1.1.1"
description = "Python package for downloading economic data from the International Monetary Fund JSON RESTful API endpoint."
authors = ["Christopher C. Smith <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit be4d2b8

Please sign in to comment.