2025-04-01 20:42:55 +02:00
|
|
|
|
CELERY_APP ?= app.celery_app
|
|
|
|
|
|
CELERY_BROKER_URL ?= redis://localhost:6379/0
|
|
|
|
|
|
TASK_NAME ?= app.apps.tasks.update_app_state_task
|
|
|
|
|
|
TASK_ARGS ?= '[]'
|
|
|
|
|
|
TASK_KWARGS ?= '{}'
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: celery-list-tasks celery-run-task
|
|
|
|
|
|
|
2021-10-02 12:10:52 +02:00
|
|
|
|
# The @ makes sure that the command itself isn't echoed in the terminal
|
|
|
|
|
|
help:
|
|
|
|
|
|
@echo "---------------HELP-----------------"
|
|
|
|
|
|
@echo "To clean the workspace type 'make clean'"
|
|
|
|
|
|
@echo "To install the projects dependencies type 'make install'"
|
|
|
|
|
|
@echo "To install the projects dependencies for development type 'make install-dev'"
|
|
|
|
|
|
@echo "To run the project type 'make run'"
|
|
|
|
|
|
@echo "To test the project type 'make test'"
|
|
|
|
|
|
@echo "To assess test coverage type 'make coverage'"
|
2024-01-03 21:19:56 +01:00
|
|
|
|
@echo "To generate the requirements.txt file for pip type 'make update-requirements-file'"
|
2025-11-10 11:51:15 +01:00
|
|
|
|
@echo "To sync current changes to a blitz for testing, type 'make sync-to-blitz'.\n ℹ️ Adjust connection values in scripts/push_to_blitz.sh"
|
2022-08-07 07:38:02 +02:00
|
|
|
|
@echo "To generate the client libraries type 'make generate-client-libs'"
|
2025-04-01 20:42:55 +02:00
|
|
|
|
@echo "To list all celery tasks type 'make celery-list-tasks'"
|
|
|
|
|
|
@echo "To manually trigger a celery task type 'make celery-run-task [TASK_NAME TASK_ARGS TASK_KWARGS]'"
|
2021-10-02 12:10:52 +02:00
|
|
|
|
@echo "------------------------------------"
|
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
|
echo "Removing htmlcov folder and .coverage file"
|
|
|
|
|
|
rm -rf htmlcov .coverage
|
2025-11-10 11:51:15 +01:00
|
|
|
|
uv run python -m pyclean .
|
2022-03-20 16:00:25 +01:00
|
|
|
|
|
2021-10-02 12:10:52 +02:00
|
|
|
|
install:
|
2025-11-10 11:51:15 +01:00
|
|
|
|
uv pip install -r requirements.txt
|
2021-10-02 12:10:52 +02:00
|
|
|
|
|
2022-05-28 12:38:10 +02:00
|
|
|
|
install-dev:
|
2025-11-10 11:51:15 +01:00
|
|
|
|
# This command reads pyproject.toml and installs all dependencies (main + dev)
|
|
|
|
|
|
uv sync
|
2021-10-02 12:10:52 +02:00
|
|
|
|
|
|
|
|
|
|
run:
|
2025-11-10 11:51:15 +01:00
|
|
|
|
uv run python -m uvicorn app.main:app --reload
|
2021-10-02 12:10:52 +02:00
|
|
|
|
|
2022-03-20 16:00:25 +01:00
|
|
|
|
test:
|
2025-11-10 11:51:15 +01:00
|
|
|
|
uv run python -m pytest
|
2021-10-02 12:10:52 +02:00
|
|
|
|
|
|
|
|
|
|
coverage:
|
2025-11-10 11:51:15 +01:00
|
|
|
|
uv run python -m coverage run --source=. -m pytest
|
|
|
|
|
|
uv run python -m coverage html
|
2021-11-18 10:57:27 +01:00
|
|
|
|
|
2022-05-28 12:38:10 +02:00
|
|
|
|
update-requirements-file:
|
2026-07-03 17:37:46 +02:00
|
|
|
|
# --upgrade: don't keep stale pins from the existing requirements.txt
|
|
|
|
|
|
uv pip compile --all-extras --universal --upgrade --output-file requirements.txt pyproject.toml
|
2021-12-05 21:14:25 +01:00
|
|
|
|
|
2022-05-28 12:38:10 +02:00
|
|
|
|
sync-to-blitz:
|
2022-03-20 16:00:25 +01:00
|
|
|
|
bash scripts/sync_to_blitz.sh
|
|
|
|
|
|
|
2022-08-07 07:38:02 +02:00
|
|
|
|
generate-client-libs:
|
2025-11-10 11:51:15 +01:00
|
|
|
|
uv run python gen_client_libs.py
|
2022-11-29 21:05:20 +01:00
|
|
|
|
|
2023-06-25 08:01:43 +02:00
|
|
|
|
remote-debugging-help:
|
|
|
|
|
|
bash scripts/remote_debugging.sh help
|
|
|
|
|
|
|
|
|
|
|
|
enable-remote-debugging:
|
|
|
|
|
|
bash scripts/remote_debugging.sh enable
|
|
|
|
|
|
|
|
|
|
|
|
disable-remote-debugging:
|
|
|
|
|
|
bash scripts/remote_debugging.sh disable
|
2025-04-01 20:42:55 +02:00
|
|
|
|
|
|
|
|
|
|
celery-list-tasks:
|
|
|
|
|
|
@echo "Listing registered Celery tasks..."
|
2025-11-10 11:51:15 +01:00
|
|
|
|
@uv run celery -A $(CELERY_APP) inspect registered
|
2025-04-01 20:42:55 +02:00
|
|
|
|
|
|
|
|
|
|
celery-run-task:
|
|
|
|
|
|
@echo "Manually triggering Celery task: $(TASK_NAME)"
|
|
|
|
|
|
@echo " Args: $(TASK_ARGS)"
|
|
|
|
|
|
@echo " Kwargs: $(TASK_KWARGS)"
|
2025-11-10 11:51:15 +01:00
|
|
|
|
@uv run celery -A $(CELERY_APP) call $(TASK_NAME) --args=$(TASK_ARGS) --kwargs=$(TASK_KWARGS)
|