Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: v1.0 refactor & rewrite #69

Merged
merged 1 commit into from
Jan 31, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v1.1.1
uses: actions/setup-python@v5
- name: Install Poetry
uses: dschep/install-poetry-action@v1.2
uses: snok/install-poetry@v1.3.4
- name: Publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.pypi_token }}
Expand Down
49 changes: 41 additions & 8 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,60 @@
name: Tests
on:
push:
branches:
- 'master'
pull_request:
schedule:
- cron: "1 1 1 * *"
jobs:
lint:
name: Lint
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install Ruff
run: pip install ruff
- name: Run Tests
run: ruff check wbdata
types:
name: Types
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install Poetry Action
uses: snok/install-poetry@v1.3.4
- name: Install Dependencies
run: poetry install --only main,types
- name: Run mypy
run: poetry run mypy wbdata
test:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v1.1.1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: dschep/install-poetry-action@v1.2
- name: Install Poetry Action
uses: snok/install-poetry@v1.3.4
- name: Install Dependencies
run: poetry install -E pandas
run: poetry install --only main,tests -E pandas
- name: Run Tests
run: poetry run pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ nosetests.xml

# Docs
docs/_build/

.mypy_cache
7 changes: 7 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
version: 2
formats: all
build:
os: ubuntu-22.04
tools:
python: "3"
python:
install:
- method: pip
path: .
extra_requirements:
- pandas
- docs
mkdocs:
configuration: mkdocs.yml
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
poetry 1.7.1
python 3.8.13
7 changes: 0 additions & 7 deletions CHANGES.txt

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# wbdata

| Branch | Status |
|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| master | [![master branch status](https://github.com/OliverSherouse/wbdata/workflows/Tests/badge.svg?branch=master)](https://github.com/OliverSherouse/wbdata/actions?query=workflow%3A%22Tests%22+branch%3Amaster) |
| dev | [![dev branch status](https://github.com/OliverSherouse/wbdata/workflows/Tests/badge.svg?branch=dev)](https://github.com/OliverSherouse/wbdata/actions?query=workflow%3A%22Tests%22+branch%3Adev) |
[![Tests](https://github.com/OliverSherouse/wbdata/actions/workflows/tests.yaml/badge.svg?branch=master)](https://github.com/OliverSherouse/wbdata/actions/workflows/tests.yaml)
[![Documentation Status](https://readthedocs.org/projects/wbdata/badge/?version=stable)](https://wbdata.readthedocs.io/en/stable/?badge=stable)
[![PyPI version](https://badge.fury.io/py/wbdata.svg)](https://badge.fury.io/py/wbdata)
[![Downloads](https://static.pepy.tech/badge/wbdata/month)](https://pepy.tech/project/wbdata)

Wbdata is a simple python interface to find and request information from the
World Bank's various databases, either as a dictionary containing full metadata
or as a [pandas](http://pandas.pydata.org) DataFrame or series. Currently,
wbdata wraps most of the [World Bank
API](http://data.worldbank.org/developers/api-overview), and also adds some
convenience functions for searching and retrieving information.
convenience functionality for searching and retrieving information.

Documentation is available at <http://wbdata.readthedocs.org/> .
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

90 changes: 90 additions & 0 deletions docs/basic_functionality.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Basic functionality

The basic functionality for `wbdata` users is provided by a set of functions in
the topic level package namespace.

## Data Retrieval

These are the functions for actually getting data values from the World Bank
API.

### Raw Data Retrieval

::: wbdata.client.Client.get_data
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4


### Pandas Data Retrieval

These functions require Pandas to be installed to work.

::: wbdata.client.Client.get_series
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4

::: wbdata.client.Client.get_dataframe
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4

## Metadata Retrieval

These functions, for the most part, are for finding the parameters you want to
put into the data retrieval functions. These all return
[SearchResult][wbdata.client.SearchResult], which are lists that pretty-print
the table in an interactive environment, and which contain dictionary
representations of the requested resource.

### Searchable Metadata

There are enough indicators and countries that it's annoying to look through
them, so the functions for retrieving information about them can be narrowed
with additional facets and filtered with a search term or regular expression
supplied to the `query` parameter.

::: wbdata.client.Client.get_countries
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4


::: wbdata.client.Client.get_indicators
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4

### Indicator Facets

::: wbdata.client.Client.get_sources
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4

::: wbdata.client.Client.get_topics
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4

### Country Facets

::: wbdata.client.Client.get_incomelevels
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4

::: wbdata.client.Client.get_lendingtypes
options:
show_root_heading: true
show_root_full_path: false
heading_level: 4
Loading