This is a command line weather application built in Python to view weather information directly from the terminal using the CLI. One can take a city name as required input and an optional flag to display whether in Fahrenheit instead of Celsius if desired. What one gets back is a display of the city name, the current weather conditions, and the current temperature formatted visually with colors, spacing and emojis.
- Ensure that you have Python version 3.12.0 setup locally, you can set this up using pyenv if you have multiple versions of Python on your local development environment.
- Poetry is used for managing dependencies, ensure you have that setup locally.
- Virtualenv Not a hard requirement as poetry should setup a virtual environment for you, but can be used as well to setup a virtual environment.
- OpenWeather API Key. Register on OpenWeather and setup an API Key. This is going to be used with interacting with the API. If you already have an account, then this step can be skipped.
-
After cloning the project, install the dependencies required with:
poetry install
When using poetry
Or
make install
When using GNU Make, this is a wrapper around the top commend
-
Setup secrets in a secrets.ini file from a sample secrets.ini.sample. This can be done with the command:
cp secrets.ini.sample secrets.ini
Copies over the sample file to a newly created file secrets.ini file. Note that this file is not pushed to a VCS.
The file should look like this:
[openweather] base_url=http://api.openweathermap.org/data/2.5/weather api_key=<YOUR-OPENWEATHER-API-KEY>
Enter your Open Weather API Key in the provided placeholder. You can optionally change the base url, but this is already defaulted
-
Install
pyweather
in editable mode:cd pyweather pip install -e .
To execute pyweather
, go ahead and run the below command:
python pyweather --help