Add packaging and use it.

Add packaging information and make it usable by Makefile.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
Bobby Noelte
2024-10-06 13:47:16 +02:00
committed by Andreas
parent 9f78966c89
commit 2c5c612cab
2 changed files with 55 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
# Define the targets
.PHONY: help venv pip test docker-run docs clean
.PHONY: help venv pip install dist test docker-run docs clean
# Default target
all: help
@@ -9,10 +9,12 @@ help:
@echo "Available targets:"
@echo " venv - Set up a Python 3 virtual environment."
@echo " pip - Install dependencies from requirements.txt."
@echo " install - Install EOS in editable form (development mode) into virtual environment."
@echo " docker-run - Run entire setup on docker
@echo " docs - Generate HTML documentation using pdoc."
@echo " run - Run flask_server.py in the virtual environment."
@echo " clean - Remove generated documentation and virtual environment."
@echo " run - Run flask_server in the virtual environment (needs install before)."
@echo " dist - Create distribution (in dist/)."
@echo " clean - Remove generated documentation, distribution and virtual environment."
# Target to set up a Python 3 virtual environment
venv:
@@ -21,22 +23,36 @@ venv:
# Target to install dependencies from requirements.txt
pip: venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r requirements.txt
@echo "Dependencies installed from requirements.txt."
# Target to install EOS in editable form (development mode) into virtual environment.
install: pip
.venv/bin/pip install build
.venv/bin/pip install -e .
@echo "EOS installed in editable form (development mode)."
# Target to create a distribution.
dist: pip
.venv/bin/pip install build
.venv/bin/python -m build --wheel
@echo "Distribution created (see dist/)."
# Target to generate HTML documentation
docs: pip
pdoc --html --force modules -o docs
# Clean target to remove generated documentation and virtual environment
# Clean target to remove generated documentation, distribution and virtual environment
clean:
@echo "Cleaning virtual env and documentation directories"
@echo "Cleaning virtual env, distribution and documentation directories"
rm -rf docs
rm -rf dist
rm -rf .venv
run:
@echo "Starting flask server, please wait..."
.venv/bin/python ./flask_server.py
.venv/bin/python -m akkudoktoreosserver.flask_server
# Target to run tests.
test: