Application that display the weather information for any given city made with Python's FastAPI framework inspired in Clean Architecture and DDD principles.
This project is comprised of the following languages and libraries:
- Language: Python 3.8+
- Package management: Poetry
- Web framework: FastAPI
- Production web server: Uvicorn
- Functional programming utilities: Toolz
- Data parsing and validation: Pydantic
- Testing: Pytest
- Linter: Flake8
- Static type checker: Mypy
- Formatter: Black
Auxiliary libraries were omitted but can be found in the pyproject file.
Change in the environment variable OPEN_WEATHER_MAP_API_TOKEN
on docker-compose file.
- Start a container with:
docker-compose run --rm --service-ports app ash
- Inside the container run:
poetry install
- Start the web server with:
poetry run web_server
- The app will be running on http://0.0.0.0:8000
- Just make a GET request to http://0.0.0.0:8000/weather/info?{city_name}
- Start a container with:
docker-compose run --rm --service-ports tests ash
- Inside the container run:
poetry install
- Test the API with:
pytest
- Test the API with:
pytest
- Check code style with:
black --check weather
- Format code with:
black weather tests
- Lint the code with:
flake8 weather tests
- Run static analysis with:
mypy weather tests
- The Feature Test isn't passing fully, I had a problem to mock the lib request_async, so when running the feature test the request to Open Weather Map is made.
- The API should be capable to receive a geolocation and return the weather conditions, at the moment only city names are available.
- Cache the fetched weather data, unfortunately, I don't have time to implement the request cache, my original plan was implementing a Redis to cache the API data.
- Types: some functions and variables not has types.