44PORT ?= 8081
55HOST ?= 127.0.0.1
66PYTHON ?= python3
7- VENV_NAME ?= venv
8- VENV_ACTIVATE = . $(VENV_NAME ) /bin/activate
97LOG_DIR ?= ./logs
108DB_PATH ?= $(LOG_DIR ) /loglama.db
119EXAMPLE_DB_PATH ?= $(LOG_DIR ) /example.db
1210
13- .PHONY : all setup venv install test test-unit test-integration test-ansible lint format clean run-api web run-example view-logs run-integration run-examples build publish publish-test check-publish help
11+ .PHONY : all setup install test test-unit test-integration test-ansible lint format clean run-api web run-example view-logs run-integration run-examples build publish publish-test check-publish help
1412
1513all : help
1614
17- # Create virtual environment
18- venv :
19- @echo " Creating virtual environment..."
20- @$(PYTHON ) -m venv $(VENV_NAME )
21- @echo " Virtual environment created at $( VENV_NAME) /"
22-
2315# Install dependencies
24- install : venv
25- @echo " Installing dependencies..."
26- @$(VENV_ACTIVATE ) && pip install --upgrade pip
27- @$(VENV_ACTIVATE ) && pip install poetry
28- @$(VENV_ACTIVATE ) && poetry install --with dev
16+ install :
17+ @echo " Installing dependencies with Poetry..."
18+ @poetry install --with dev
2919 @echo " Dependencies installed."
3020
31- # Setup the project (create venv and install dependencies)
21+ # Setup the project (install dependencies)
3222setup : install
3323 @echo " LogLama setup completed."
3424
@@ -37,166 +27,160 @@ test: test-unit test-integration
3727 @echo " All tests completed."
3828
3929# Run unit tests
40- # test-unit: venv
41- # @echo "Running unit tests..."
42- # @$(VENV_ACTIVATE) && pytest tests/unit/ -v
43-
44- test-unit : venv
30+ test-unit :
4531 @echo " Running unit tests..."
46- @$( VENV_ACTIVATE ) && pytest tests/ -v
32+ @poetry run pytest tests/ -v
4733
4834# Run integration tests
49- test-integration : venv
35+ test-integration :
5036 @echo " Running integration tests..."
51- @$( VENV_ACTIVATE ) && pytest tests/integration/ -v
37+ @poetry run pytest tests/integration/ -v
5238
5339# Run Ansible tests
54- test-ansible : venv
40+ test-ansible :
5541 @echo " Running Ansible tests..."
56- @$( VENV_ACTIVATE ) && ansible-playbook tests/ansible/test_loglama.yml -v
42+ @poetry run ansible-playbook tests/ansible/test_loglama.yml -v
5743
5844# Run linting checks
59- lint : venv
45+ lint :
6046 @echo " Running linting checks..."
61- @$( VENV_ACTIVATE ) && flake8 webtop /
62- @$( VENV_ACTIVATE ) && mypy webtop /
47+ @poetry run flake8 webtask /
48+ @poetry run mypy webtask /
6349
6450# Format code
65- format : venv
51+ format :
6652 @echo " Formatting code..."
67- @$( VENV_ACTIVATE ) && black webtop /
68- @$( VENV_ACTIVATE ) && isort webtop /
53+ @poetry run black webtask /
54+ @poetry run isort webtask /
6955
7056# Build package with Poetry
71- build : venv
57+ build :
7258 @echo " Building package with Poetry..."
73- @$( VENV_ACTIVATE ) && poetry build
59+ @poetry build
7460 @echo " Package built successfully. Artifacts in dist/"
7561
7662# Check if package is ready for publishing
77- check-publish : venv lint test
78- @echo " Checking if package is ready for publishing..."
79- @$(VENV_ACTIVATE ) && poetry check
80- @echo " Package is ready for publishing."
63+ check-publish : lint test
64+ @echo " Ready to publish."
8165
8266# Publish to TestPyPI
83- publish-test : venv build
67+ publish-test : build
8468 @echo " Publishing to TestPyPI..."
85- @$( VENV_ACTIVATE ) && poetry publish -r testpypi
69+ @poetry publish -r testpypi
8670 @echo " Published to TestPyPI. Test with:"
8771 @echo " pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ loglama"
8872
8973# Publish to PyPI (production)
90- publish : venv check-publish
74+ publish : check-publish
9175 @echo " Publishing to PyPI..."
9276 @echo " WARNING: This will publish to PyPI (production). This action cannot be undone."
9377 @read -p " Are you sure you want to continue? (y/N): " confirm && [ " $$ confirm" = " y" ] || [ " $$ confirm" = " Y" ]
94- @$( VENV_ACTIVATE ) && poetry publish
78+ @poetry publish
9579 @echo " Published to PyPI. Install with: pip install loglama"
9680
9781# Full publishing workflow using the publish script
98- publish-full : venv
82+ publish-full :
9983 @echo " Running full publishing workflow..."
10084 @chmod +x scripts/publish.sh
10185 @./scripts/publish.sh
10286
10387# Dry run of the publishing process
104- publish-dry-run : venv
88+ publish-dry-run :
10589 @echo " Running dry run of publishing process..."
10690 @chmod +x scripts/publish.sh
10791 @./scripts/publish.sh --dry-run
10892
10993# Quick publish (skip tests and TestPyPI)
110- publish-quick : venv
94+ publish-quick :
11195 @echo " Running quick publish (skip tests and TestPyPI)..."
11296 @chmod +x scripts/publish.sh
11397 @./scripts/publish.sh --skip-tests --skip-testpypi
11498
11599# Configure PyPI credentials
116- configure-pypi : venv
100+ configure-pypi :
117101 @echo " Configuring PyPI credentials..."
118102 @echo " You'll need API tokens from PyPI and TestPyPI"
119103 @echo " Get them from:"
120104 @echo " PyPI: https://pypi.org/manage/account/token/"
121105 @echo " TestPyPI: https://test.pypi.org/manage/account/token/"
122106 @echo " "
123107 @read -p " Enter PyPI token: " pypi_token && \
124- $( VENV_ACTIVATE ) && poetry config pypi-token.pypi $$ pypi_token
108+ poetry config pypi-token.pypi $$ pypi_token
125109 @read -p " Enter TestPyPI token: " testpypi_token && \
126- $( VENV_ACTIVATE ) && poetry config pypi-token.testpypi $$ testpypi_token
110+ poetry config pypi-token.testpypi $$ testpypi_token
127111 @echo " Credentials configured successfully."
128112
129113# Show current version
130- version : venv
114+ version :
131115 @echo " Current version:"
132- @$( VENV_ACTIVATE ) && poetry version
116+ @poetry version
133117
134118# Bump version (patch)
135- version-patch : venv
119+ version-patch :
136120 @echo " Bumping patch version..."
137- @$( VENV_ACTIVATE ) && poetry version patch
121+ @poetry version patch
138122 @git add pyproject.toml
139- @git commit -m " Bump version to $$ ($( VENV_ACTIVATE ) && poetry version -s)"
123+ @git commit -m " Bump version to $$ (poetry version -s)"
140124
141125# Bump version (minor)
142- version-minor : venv
126+ version-minor :
143127 @echo " Bumping minor version..."
144- @$( VENV_ACTIVATE ) && poetry version minor
128+ @poetry version minor
145129 @git add pyproject.toml
146- @git commit -m " Bump version to $$ ($( VENV_ACTIVATE ) && poetry version -s)"
130+ @git commit -m " Bump version to $$ (poetry version -s)"
147131
148132# Bump version (major)
149- version-major : venv
133+ version-major :
150134 @echo " Bumping major version..."
151- @$( VENV_ACTIVATE ) && poetry version major
135+ @poetry version major
152136 @git add pyproject.toml
153- @git commit -m " Bump version to $$ ($( VENV_ACTIVATE ) && poetry version -s)"
137+ @git commit -m " Bump version to $$ (poetry version -s)"
154138
155139# Run API server
156- run-api : venv
140+ run-api :
157141 @echo " Starting LogLama API server on $( HOST) :$( PORT) ..."
158- @$( VENV_ACTIVATE ) && python -m loglama.api.server --host $(HOST ) --port $(PORT )
142+ @poetry run python -m loglama.api.server --host $(HOST ) --port $(PORT )
159143
160144# Run web interface (legacy method)
161145run-web : web
162146
163147# Run web interface with new command
164- web : venv
148+ web :
165149 @echo " Starting LogLama web interface on $( HOST) :$( PORT) ..."
166- @$( VENV_ACTIVATE ) && python -m loglama.cli.main web --host $(HOST ) --port $(PORT ) --db $(DB_PATH )
150+ @poetry run python -m loglama.cli.main web --host $(HOST ) --port $(PORT ) --db $(DB_PATH )
167151
168152# Run CLI
169- run-cli : venv
153+ run-cli :
170154 @echo " Starting LogLama CLI..."
171- @$( VENV_ACTIVATE ) && python -m loglama.cli.main
155+ @poetry run python -m loglama.cli.main
172156
173157# Run example application
174- run-example : venv
158+ run-example :
175159 @echo " Running example application..."
176160 @mkdir -p $(LOG_DIR )
177- @$( VENV_ACTIVATE ) && python examples/example_app.py --requests 20 --log-dir $(LOG_DIR ) --db-path $(EXAMPLE_DB_PATH ) --json
161+ @poetry run python examples/example_app.py --requests 20 --log-dir $(LOG_DIR ) --db-path $(EXAMPLE_DB_PATH ) --json
178162
179163# Run multi-language examples
180- run-examples : venv
164+ run-examples :
181165 @echo " Running multi-language examples..."
182166 @mkdir -p $(LOG_DIR )
183- @$( VENV_ACTIVATE ) && python examples/multilanguage_examples.py
167+ @poetry run python examples/multilanguage_examples.py
184168
185169# Run shell examples
186- run-shell-examples : venv
170+ run-shell-examples :
187171 @echo " Running shell examples..."
188172 @mkdir -p $(LOG_DIR )
189- @$( VENV_ACTIVATE ) && bash examples/shell_examples.sh
173+ @poetry run bash examples/shell_examples.sh
190174
191175# View logs from example application
192- view-logs : venv
176+ view-logs :
193177 @echo " Starting web interface to view example logs on $( HOST) :$( PORT) ..."
194- @$( VENV_ACTIVATE ) && python -m loglama.cli.web_viewer --host $(HOST ) --port $(PORT ) --db $(EXAMPLE_DB_PATH )
178+ @poetry run python -m loglama.cli.web_viewer --host $(HOST ) --port $(PORT ) --db $(EXAMPLE_DB_PATH )
195179
196180# Run integration script to integrate LogLama into a component
197- run-integration : venv
181+ run-integration :
198182 @echo " Running LogLama integration script..."
199- @$( VENV_ACTIVATE ) && python scripts/integrate_loglama.py --all
183+ @poetry run python scripts/integrate_loglama.py --all
200184
201185# Clean up generated files
202186clean :
@@ -211,7 +195,7 @@ help:
211195 @echo " LogLama Makefile Commands:"
212196 @echo " "
213197 @echo " Setup and Development:"
214- @echo " make setup - Set up the project (create venv and install dependencies)"
198+ @echo " make setup - Set up the project (install dependencies)"
215199 @echo " make test - Run all tests"
216200 @echo " make test-unit - Run unit tests"
217201 @echo " make test-integration - Run integration tests"
@@ -251,8 +235,6 @@ help:
251235 @echo " Environment variables that can be set:"
252236 @echo " PORT - Port for web/API server (default: 8081)"
253237 @echo " HOST - Host for web/API server (default: 127.0.0.1)"
254- @echo " PYTHON - Python interpreter to use (default: python3)"
255- @echo " VENV_NAME - Name of virtual environment (default: venv)"
256238 @echo " LOG_DIR - Directory for logs (default: ./logs)"
257239 @echo " DB_PATH - Path to SQLite database (default: ./logs/loglama.db)"
258240 @echo " EXAMPLE_DB_PATH - Path to example SQLite database (default: ./logs/example.db)"
0 commit comments