Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
__pycache__/
*.pyc

node_modules/
.env
npm-debug.log*
Expand Down
58 changes: 58 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Finland Weather CLI
====================

A terminal application that prints current weather statistics for major
cities in Finland: Helsinki, Espoo, Tampere, Vantaa, Oulu, Turku,
Jyvaskyla, and Lahti.

Weather data comes from Open-Meteo (https://open-meteo.com), a free
service that requires no API key or signup. The script uses only the
Python standard library, so there is nothing to install.

Requirements
------------
- Python 3.x
- An internet connection (to fetch live weather data)
- No pip installation needed - the script uses only the Python standard
library, so there are no third-party packages to install

Usage
-----
Run from inside the weather_app folder:

python weather.py

This prints a table with current temperature, feels-like temperature,
humidity, wind speed/direction, and conditions for all cities.

To see detailed stats for a single city, pass its name as an argument
(case-insensitive):

python weather.py tampere
python weather.py Helsinki

If the city name is not recognized, the script prints the list of valid
city names and exits with a non-zero status.

To see a 7-day forecast instead of current conditions, add the -f (or
--forecast) flag. It works both with a single city and with all cities:

python weather.py Helsinki --forecast
python weather.py -f

Each forecast shows, per day: condition, high/low temperature, total
precipitation, and max wind speed.

By default, temperatures are shown in Celsius. Use -u (or --units) to
show Fahrenheit instead. This works with any of the modes above:

python weather.py -u fahrenheit
python weather.py Helsinki -u fahrenheit
python weather.py Helsinki -f -u fahrenheit

Notes
-----
- If a city's data cannot be fetched (e.g. no internet connection), the
script prints an error for that city instead of crashing.
- Non-ASCII city names (like Jyvaskyla) are displayed correctly even on
Windows terminals that don't default to UTF-8.
87 changes: 87 additions & 0 deletions skill.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Manual Verification Steps: weather.py

Run these checks after any change to `weather.py` to confirm the CLI still
works end to end. All commands are run from inside `weather_app/` with an
active internet connection (the app calls the live Open-Meteo API).

## 1. Default table (all cities, current conditions)

```
python weather.py
```

Expect: a table with one row per city (Helsinki, Espoo, Tampere, Vantaa,
Oulu, Turku, Jyväskylä, Lahti) showing temp, feels-like, humidity, wind
speed/direction, and condition. "Jyväskylä" must render correctly, not as
mojibake (e.g. `Jyv?skyl?`).

## 2. Single city, current conditions

```
python weather.py Tampere
python weather.py tampere
```

Expect: both commands (case-insensitive) print the same detailed block
(condition, temperature, feels like, humidity, wind, precipitation,
observed-at timestamp) for Tampere.

## 3. Unknown city

```
python weather.py NotACity
echo $?
```

Expect: an error message listing the 8 valid city names, printed to
stderr, and a non-zero exit code (1).

## 4. 7-day forecast

```
python weather.py -f
python weather.py Helsinki --forecast
```

Expect: `-f` alone prints a 7-day forecast block for every city in turn
(date, condition, high/low, precipitation, max wind). `Helsinki --forecast`
prints just Helsinki's block. Columns should stay aligned even when the
condition text is long (e.g. "Slight rain showers").

## 5. Units flag

```
python weather.py -u fahrenheit
python weather.py Helsinki -u fahrenheit
python weather.py Helsinki -f -u fahrenheit
python weather.py -u kelvin
```

Expect: the first three print Fahrenheit values (suffixed `F`) in the
table, single-city, and forecast modes respectively, with sensible values
(e.g. ~50-60F for a Finnish autumn day, not obviously wrong). The last
command should reject `kelvin` with an argparse usage/error message and
exit code 2, since only `celsius` and `fahrenheit` are valid choices.

## 6. Network failure handling

Simulate an unreachable API by temporarily pointing the script at a bad
host, e.g.:

```
python -c "
import weather
weather.API_URL = 'https://nonexistent.invalid.example/v1/forecast'
weather.print_table(weather.CITIES)
"
```

Expect: one error line per city (not a raw traceback), and the script
does not crash.

## 7. Readme accuracy

Re-read `readme.txt` after any CLI flag change and confirm every documented
command still matches the actual `argparse` options in `weather.py`
(currently: optional `city` positional, `-f`/`--forecast`,
`-u`/`--units {celsius,fahrenheit}`).
Loading
Loading