12 Commits

Author SHA1 Message Date
Dominique Lasserre
1163ddb4ac Mypy (#217)
* Mypy: Initial support

 * Add to pre-commit (currently installs own deps, could maybe changed
   to poetry venv in the future to reuse environment and don't need
   duplicated types deps).
 * Add type hints.

* Mypy: Add missing annotations
2024-11-26 22:28:05 +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
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
Chris
5503b8876c Extend line length 2024-10-11 09:07:53 +02:00
Dominique Lasserre
12c9e4428e Replace pytz with stdlib zoneinfo/timezone, Bump python to 3.10
* Timezone support comes with the standard lib since 3.9
 * Bump to 3.10 because typing.TypeGuard
2024-10-10 14:18:40 +02:00
Bobby Noelte
b9f65ef7db Adapt data to package directory structure.
Move static data to server package directory.
Assure data/*.npz data is included in the server package.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-07 17:51:44 +02:00
Bobby Noelte
2c5c612cab Add packaging and use it.
Add packaging information and make it usable by Makefile.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-07 08:12:33 +02:00
Bobby Noelte
9f78966c89 Adapt tests to package directory structure.
Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-07 08:12:33 +02:00
Michael Osthege
c3f10df277 Manual edits to remove remaining code style errors 2024-10-03 17:28:49 +02:00
Michael Osthege
bbaaacaca0 Add pre-commit configuration 2024-10-03 17:28:49 +02:00