https://github.com/wamirez/ppp-calc
Purchasing Power Parity Calculator
https://github.com/wamirez/ppp-calc
cli nix nix-shell ppp python python3
Last synced: 27 days ago
JSON representation
Purchasing Power Parity Calculator
- Host: GitHub
- URL: https://github.com/wamirez/ppp-calc
- Owner: wamirez
- License: gpl-2.0
- Created: 2023-04-05T21:20:55.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-31T17:33:50.000Z (2 months ago)
- Last Synced: 2026-03-31T19:38:48.663Z (2 months ago)
- Topics: cli, nix, nix-shell, ppp, python, python3
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Purchasing power parity calculator
Adjust a given amount for a given country after the [purchasing power parity (PPP)](https://en.wikipedia.org/wiki/Purchasing_power_parity) indicator using the Netherlands as reference. Corresponding ratios are computed from the amounts provided by the [Google Summer of Code Stipend Amounts Table](https://developers.google.com/open-source/gsoc/help/student-stipends) (CC-BY-4.0), and rounded to an integer.
## Usage
Specify amount and country in order to get the adjusted amount for the given country:
```console
$ python ppp.py 500 Brazil
278
```
Set a different reference country with `--reference`:
```console
$ python ppp.py 500 Brazil --reference Australia
227
```
The year can be specified when needed, defaulting to the current year:
```console
$ python ppp.py 500 Brazil 2022
333
```
Add exceptions for countries listed in a file:
```console
$ python ppp.py 500 Luxembourg --ignore european-union.txt
500
```
## Purchasing power parity data
The year has to correspond to a `.csv` table whose contents can be fetched by using the helper script `update.py`. This script takes a URL to the GSoC contributor stipends page, or a snapshot of it from previous years (see e.g., the [Wayback Machine](https://web.archive.org/web) of the Internet Archive to get a snapshot). Its contents can then be stored in the working directory as follows:
```console
$ python update.py https://web.archive.org/web/20220809160247/https://developers.google.com/open-source/gsoc/help/student-stipends >> 2022.csv
```
Update the list of member states of the European Union:
```console
$ python update_eu.py > european-union.txt
```
## Nix
A Nix derivation, `shell.nix`, has been added to ensure reproducibility across the board.
- [Install Nix](https://nix.dev/tutorials/install-nix)
- Clone this repository
```console
git clone https://github.com/wamirez/ppp-calc
```
- Enter the Nix shell
```console
$ cd ppp-calc
$ nix-shell
```
`nix-shell` picks up `shell.nix` automatically installing required packages and creating a custom Python environment.