CLI and API to interact with a Water Jug Riddle app
Many of these actions can be achieved using the commands in Makefile
:
- testing with several flavors
- docker commands
- etc.
In a Windows env you can use makefile installing
make
with Chocolatey:choco install make
.
- Ensure you have Docker daemon/desktop running.
- Clone this repo and cd into
water-jug-riddle
. - Build the repo with
docker-compose up -d --build
- In OpenAPI docs, in your local you'll see OpenAPI docs from the app.
- Execute
docker-compose up
. - You'll see all the API options in the app docs in http://localhost:8000/docs.
- Run docker
docker-compose up -d --build
- Enter docker bash
docker exec -it fastapi-app bash
- Run the cli interface
python app/cli.py
- Follow the instructions you see in the screen.
- After cloning the repo, create a virtual environment
cd
intowater-jug-riddle
and install the requirements in it.
- Run the tests with
pytest .
- Debugging and local running
- CLI:
uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8000
- IDE (PyCharm):
- In the running selector, click Edit configurations and add a new one.
- Change Script path selector to Module name, and type in with
uvicorn
. - In parameters, type
app.main:app --reload --port 8000
(given the working directory below iswater-jug-riddle/app
)
- CLI:
pre-commit run --all-files --show-diff-on-failure
pre-commit autoupdate