17 Commits

Author SHA1 Message Date
Dominique Lasserre
79ecf71353 Optimize states (#256)
* optimization states for AC, DC and IDLE now similar probab. Also AC states taken from config. Maybe a single config option for AC and E-Auto States is sensefull.
 * Ruff
 * test_class_optimize: Update testdata
 * Write pdf and json to test/testdata/new.... so it can be analyzed
   manually or just copied as new expected result.
 * workflow: Upload pytest optimization result artifacts (pdf, json)

---------

Co-authored-by: Andreas <drbacke@gmx.de>
2024-12-16 13:37:16 +01:00
Dominique Lasserre
edfe309a26 Update README/CONTRIBUTING Closes #180 (#204)
* Update README/CONTRIBUTING Closes #180

 * Remove duplicated files in docs/develop and copy them from project
   root to there on documentation generation.

* Makefile: Use fastapi to start server, set port to 8503
2024-11-17 15:27:43 +01:00
Dominique Lasserre
f61665669f Migrate from Flask to FastAPI (#163)
* Migrate from Flask to FastAPI

 * FastAPI migration:
    - Use pydantic model classes as input parameters to the
      data/calculation classes.
    - Interface field names changed to constructor parameter names (for
      simplicity only during transition, should be updated in a followup
      PR).
    - Add basic interface requirements (e.g. some values > 0, etc.).
 * Update tests for new data format.
 * Python requirement down to 3.9 (TypeGuard no longer needed)
 * Makefile: Add helpful targets (e.g. development server with reload)

* Move API doc from README to pydantic model classes (swagger)

 * Link to swagger.io with own openapi.yml.
 * Commit openapi.json and check with pytest for changes so the
   documentation is always up-to-date.

* Streamline docker

* FastAPI: Run startup action on dev server

 * Fix config for /strompreis, endpoint still broken however.

* test_openapi: Compare against docs/.../openapi.json

* Move fastapi to server/ submodule

 * See #187 for new repository structure.
2024-11-15 22:27:25 +01:00
Chris
ed3226e522 Json configuration (#141)
* Add json config
* Adjust code to new config

---------

Co-authored-by: Chris <git@nootch.de>
2024-11-11 21:38:13 +01:00
Bobby Noelte
94467e1a69 Add API documentation generation and use Markdown (#160)
* Add package API documentation generation

Add generation of the API documentation for akkudoktoreos
and akkudoktoreosserver packages.

The API documentation is generated by the Sphinx autosummary extension.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Enable Google style source commenting and documentation generation.

Enable automatic documentation generation from Google style docstrings in the source.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Check Google style source commenting.

Check Google style commenting by the appropriate ruff rules.

Commenting is _NOT_ enforced. Missing docstrings are ignored.

Minor commenting quirks of the code base are adapted.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Improve Markdown handling and switch to Markdown documentation.

Switch to Markdown for the documentation files to improve the user and developer experience (see issue #181).

Keep files with special directives for automatic API documentation in RST format. The
directives expect RST.

Also add dummy handling for openai/ swagger server documentation. The openai interface definition is
for now taken from the fastapi PR as EOS will switch to fastAPI.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

---------

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
Co-authored-by: Normann <github@koldrack.com>
2024-11-10 23:27:52 +01:00
Dominique Lasserre
3652298134 Add more optimization tests (#171)
* Integrated single_test_optimization into pytest to run a basic optimization test with tolerance set to 1e-6, ensuring quick detection of deviations.
* Added a long-run test (400 generations, like single_test_optimization), which can be triggered using --full-run in pytest.
* Mocked PDF creation in optimization tests and added a new PDF generation test with image comparison validation.

Note: Current tolerance is set to 1e-6; feedback on whether this tolerance is tight enough is welcome.

---------

Co-authored-by: Normann <github@koldrack.com>
Co-authored-by: Michael Osthege <michael.osthege@outlook.com>
2024-11-10 23:22:30 +01:00
Chris
de9fe2ddc9 Add settings and extension recommendations (#139)
- Added recommended settings for the Pylance and Pyright extensions
- Enabled pytest and debugging support in configuration
- Reformatted code with Prettier
---------
Co-authored-by: Chris <git@nootch.de>
2024-11-10 23:00:16 +01:00
Dominique Lasserre
a71eab3bd0 Streamline Dockerfile, remove unused deps
* Dockerfile: Use non-root user, buildx cache, setup for readonly
   container, remove unused apt deps.
   For now don't install pip package and keep development flask server
   as this will be replaced in the future (fastapi). Then a proper
   webserver (e.g. nginx) should be used and the pip package can be
   created and deployed just to the run-stage (with the webserver).
 * docker-compose: Set to readonly (anonymous volumes declared in
   Dockerfile should maintain all writable data).
   Mount config.py for easier development. Should be replaced by
   environment support for all config file variables.
 * Remove unused runtime dependencies: mariadb, joblib, pytest,
   pytest-cov.
 * Move pytest-cov to dev dependencies.
 * Add output_dir to config.py.
 * Fix visualization_results.pdf endpoint.
 * Update docs.
2024-10-11 08:39:14 +02:00
Bobby Noelte
86639b9437 Add documentation infrastructure
Add documentation infrastructure and some sample content.

Documentation is generated by sphinx using extensions to support
Markdown an restructuredText for simple documentation writing.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-10 15:22:34 +02:00
Bobby Noelte
5bd8c532af Fix Adapt data to package directory structure
Due to .gitignore directive files in data/ were ignored. Thus data was not moved to correct location by pr #122.

Add load_profiles.npz and remove gitignore directive.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-09 18:18:35 +02:00
Michael Osthege
f4661b0043 Remove and ignore visualization side-effect outputs 2024-10-09 17:05:36 +02:00
Fortrieb
af7b745d15 Add english translation for readme.
Moving german readme to READEME-DE.md. Add sensible gitignore defaults for most operating systems, VS code and Python.
2024-09-30 08:02:40 +02:00
Dominik Siebel
acd4da57f0 ignore data dir 2024-09-17 09:06:56 +02:00
Dominik Siebel
173977156f use directory path prefixes 2024-09-17 09:06:56 +02:00
Dominik Siebel
d9b0131322 remove unused volume 2024-09-17 09:06:56 +02:00
Dominik Siebel
db80e260c6 ci: dockerize setup 2024-09-17 09:06:56 +02:00
Daniel Molkentin
e54f14bea1 feat: add documentation, enable makefile driven usage
This introduces a One-Stop-Shop Makefile.

Also brings back tensorflow as dependency, it is still needed
2024-09-13 08:01:25 +02:00