Skip to content

This library easily obtains weather data across various locations and dates.

License

Notifications You must be signed in to change notification settings

e7kim/forecast-weather

Repository files navigation

forecast-weather

This python library easily obtains weather data across various locations and dates.

License Build Status codecov PyPI Docs

Overview

forecast-weather is a library that allows a user to easily obtain weather data (temperatures, pressure, humidity, precipitation, wind, cloud coverage, etc.) across various locations and dates. The library will make calls to a public weather API and will organize the returned data for ease of use. Some extra functionality in consideration include some form of visual plot/graph generation.

Install

pip install forecast-weather

API Key

Go to weatherapi.com to register an account for your free api key. Create a new file ./api_key and paste your api key here.

Usage

import forecast_weather as fw

fw.show_current(location = "10027")
fw.show_forecast(location = "10027", days = "2")
current = fw.get_current(location = "10027")
forecast = fw.get_forecast(location = "10027", days = "3")

Example

Running the following code

import forecast_weather as fw

fw.show_current(location = "10027")

Outputs something like this to the console

Current weather at New York is: 
Temperature: 68.0 F/ 20.0 C
Condition: Overcast
Wind speed: 2.2 mph
Pressure: 1017.0 mb
Precipitation: 0.0 in
Humidity: 55%
Cloud coverage: 100%
UV: 4.0

Demo

Details

This project is a pure python project using modern tooling. It uses a Makefile as a command registry, with the following commands:

  • make: list available commands
  • make develop: install and build this library and its dependencies using pip
  • make build: build the library using setuptools
  • make lint: perform static analysis of this library with flake8 and black
  • make format: autoformat this library using black
  • make annotate: run type checking using mypy
  • make test: run automated tests with pytest
  • make coverage: run automated tests with pytest and collect coverage information
  • make dist: package library for distribution