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 ba31734bd8
commit 95322e69ce
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:

View File

@ -1,3 +1,35 @@
[project]
name = "akkudoktor-eos"
version = "0.0.1"
authors = [
{ name="Andreas Schmitz", email="author@example.com" },
]
description = "This project provides a comprehensive solution for simulating and optimizing an energy system based on renewable energy sources. With a focus on photovoltaic (PV) systems, battery storage (batteries), load management (consumer requirements), heat pumps, electric vehicles, and consideration of electricity price data, this system enables forecasting and optimization of energy flow and costs over a specified period."
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.8"
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
[project.urls]
Homepage = "https://github.com/Akkudoktor-EOS/EOS"
Issues = "https://github.com/Akkudoktor-EOS/EOS/issues"
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = { file = ["requirements-dev.txt"] }}
[tool.setuptools.packages.find]
where = ["src/"]
include = ["akkudoktoreos", "akkudoktoreosserver", ]
[tool.isort]
profile = "black"
@ -7,8 +39,7 @@ ignore = [
]
[tool.pytest.ini_options]
minversion = "7.0"
minversion = "8.3.3"
addopts = "--cov=src"
pythonpath = [ "src", ]
testpaths = [ "tests", ]