Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration branch for FastAPI and other PRs #177

Closed
wants to merge 25 commits into from

Conversation

b0661
Copy link
Contributor

@b0661 b0661 commented Oct 19, 2024

The integration branch is mainly to check whether these PRs will also work with FastAPI. At least for the following pull requests this could be achieved:

Other PRs were either not integrated or I could not manage to properly rebase them (my Fault). Nearly all integrated pull requests had to be adapted on rebase. Thus I may have done something wrong there.

The integration branch was semi-automatically created using the tool from #176.

Lasall and others added 25 commits October 11, 2024 20:10
 * 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)
 * Add API to sphynx doc (rudimental, due to outdated plugin).
 * 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.
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 <[email protected]>
Enable automatic documentation generation from Google style docstrings in the source.

Signed-off-by: Bobby Noelte <[email protected]>
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 <[email protected]>
- replace outdated modules with src
- removed cov arg from pyproject toml
- add settings
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 8.0.2 to 8.1.3.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES.rst)
- [Commits](sphinx-doc/sphinx@v8.0.2...v8.1.3)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
 * 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.
Added documentation. Beware mostly generated by ChatGPT.

Signed-off-by: Bobby Noelte <[email protected]>
The `CacheFileStore` class is a singleton-based, thread-safe key-value store for managing
temporary file objects, allowing the creation, retrieval, and management of cache files.

The utility modules offer a flexible logging setup (`get_logger`) and utilities to handle
different date-time formats (`to_datetime`, `to_timestamp`).

- Cache files are automatically valid for the the current date unless specified otherwise.
  This is to mimic the current behaviour used in several classes.
- The logger supports rotating log files to prevent excessive log file size.
- The `to_datetime` and `to_timestamp`functions support a wide variety of input types and formats.
  They provide the time conversion that is e.g. used in PVForecast.

Signed-off-by: Bobby Noelte <[email protected]>
Improvements for testing of PVForecast
- Use common utility functions to allow for general testing at one spot.
  - to_datetime
  - CacheFileStore
- Use logging instead of print to easily capture in testing.
- Add validation of the json schema for Akkudoktor PV forecast data.
- Allow to create an empty PVForecast instance as base instance for testing.
- Make process_data() complete for filling a PVForecast instance for testing.
- Normalize forecast datetime to timezone of system given in loaded data.
- Do not print report but provide report for test checks.
- Get rid of cache file path using the CachFileStore to automate cache file usage.
- Improved module documentation.

Signed-off-by: Bobby Noelte <[email protected]>
- Add test for PVForecast
- Add test for CacheFileStore in the new cachefilestore module
- Add test for to_datetime in the new datetimeutil module
- Add test for get_logger in the new logutil module

Signed-off-by: Bobby Noelte <[email protected]>
This script automates the integration of multiple GitHub pull requests (PRs)
into a specified integration branch. It fetches each PR, creates a branch
from the PR, rebases the branch onto the integration branch, and then merges
it back into the integration branch. The process is logged to a branch-specific
log file, and if any step fails, the script exits and saves the current progress
(PR number and step) to a branch-specific JSON file. The script can be rerun,
and it will resume from where the last step failed. If the script is run again
on the same branch without providing PR numbers, it will reuse the PR numbers
from the first run.

Signed-off-by: Bobby Noelte <[email protected]>
@drbacke drbacke marked this pull request as draft October 22, 2024 08:51
@drbacke
Copy link
Contributor

drbacke commented Oct 22, 2024

Please re-run all tests, code changed quite a lot

@b0661
Copy link
Contributor Author

b0661 commented Oct 24, 2024

Outdated

@b0661 b0661 closed this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants