Skip to main content

Simple currency converter

Project description

Simple Currency Converter

A simple Python package for currency conversion using the Currency API.

Installation

pip install simple_currency_converter

Usage

As a Python module

from simple_currency_converter import convert

# Convert 100 USD to AUD
result = convert("usd", "aud", 100)
print(f"100 USD = {result:.2f} AUD")

Available currencies

You can access currency code dictionaries:

from simple_currency_converter import common_codes, crypto_codes, all_codes

# Print available common currencies
print(common_codes)

As a command-line tool

Basic conversion:

currency-convert usd aud 100

This will output something like:

100.0 USD = 152.34 AUD

List available currencies:

# List common currencies
currency-convert --list-common

# List cryptocurrency codes
currency-convert --list-crypto

# List all supported currencies
currency-convert --list-all

Development

Running tests

The project includes a comprehensive test suite using pytest. To run the tests:

  1. Clone the repository
  2. Install the package in development mode:
# Install package in development mode
pip install -e .

# Install test dependencies
pip install pytest pytest-cov
  1. Run the tests:
# Run all tests
pytest

# Run tests with coverage report
pytest --cov=simple_currency_converter

GitHub Actions

This project uses GitHub Actions for continuous integration. Tests are automatically run on push and pull requests to the main branch, across multiple Python versions.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_currency_converter-0.1.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_currency_converter-0.1.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file simple_currency_converter-0.1.2.tar.gz.

File metadata

File hashes

Hashes for simple_currency_converter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b936149f34e3b7cbadb853c5951e5afaedb06a0c5441fbda7b6423a30611be5e
MD5 bdd2ca5bcde922cb96c6ff74384a66be
BLAKE2b-256 648efab5abdddb743d2c97c3ed07d694ef244713af32a8778a058f1f2bafd9fe

See more details on using hashes here.

File details

Details for the file simple_currency_converter-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_currency_converter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 50d4810bff93eef2c8981aefb6ffcde2988e5fdf6919b3aa08f80f5072ff58a9
MD5 a93cf029e0e038b4a1fcd9d96ceef0ae
BLAKE2b-256 4ae0ab17942123eb4e27a6609b62e1a1919ad64e6da65fc2d7322e8ce1069cbc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page