Skip to content

Commit

Permalink
Add packaging and use it.
Browse files Browse the repository at this point in the history
Add packaging information and make it usable by Makefile.

Signed-off-by: Bobby Noelte <[email protected]>
  • Loading branch information
b0661 committed Oct 6, 2024
1 parent e869cfe commit 235cb08
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 8 deletions.
28 changes: 22 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down
35 changes: 33 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
[project]
name = "akkudoktor-eos"
version = "0.0.1"
authors = [
{ name="Andreas Schmitz", email="[email protected]" },
]
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"

Expand All @@ -7,8 +39,7 @@ ignore = [
]

[tool.pytest.ini_options]
minversion = "7.0"
minversion = "8.3.3"
addopts = "--cov=src"
pythonpath = [ "src", ]
testpaths = [ "tests", ]

0 comments on commit 235cb08

Please sign in to comment.