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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9e3c756
Migrate from Flask to FastAPI
Lasall Oct 10, 2024
8458684
Move API doc from README to pydantic model classes (swagger)
Lasall Oct 12, 2024
2277d1f
Add package API documentation generation
b0661 Oct 10, 2024
a1cef1e
Enable Google style source commenting and documentation generation.
b0661 Oct 11, 2024
882aae6
Check Google style source commenting.
b0661 Oct 11, 2024
906c652
Add settings and extension recommendations
Oct 11, 2024
f6e8ada
Add pyright section for pylance extension
Oct 11, 2024
6d09e44
Enable pytest and debugging
Oct 11, 2024
53905cb
Prettier files
Oct 11, 2024
685e855
Bump sphinx from 8.0.2 to 8.1.3
dependabot[bot] Oct 14, 2024
7ab9314
Merge branch 'pr_int_fastapi-rebase-pr-163' into pr_int_fastapi
b0661 Oct 19, 2024
1f50eb5
test_load_corrector
NormannK Oct 10, 2024
e08e2b5
Streamline Dockerfile, remove unused deps
Lasall Oct 7, 2024
0923584
Ruff format
Oct 10, 2024
7763b1f
rebase fixes
NormannK Oct 11, 2024
2952cda
ruff changes
NormannK Oct 11, 2024
676b4d8
Cleanup: Fix violin chart labels, remove debug code
Lasall Oct 11, 2024
1f0ee74
Merge branch 'pr_int_fastapi-rebase-pr-172' into pr_int_fastapi
b0661 Oct 19, 2024
4186937
Add documentation to class_pv_forecast.py.
b0661 Oct 11, 2024
1fbdd18
Add CacheFileStore, to_datetime and get_logger utilities.
b0661 Oct 15, 2024
d38b24a
Improve testability of PVForecast
b0661 Oct 12, 2024
7ad1eea
Add test for PVForecast and newly extracted utility modules.
b0661 Oct 12, 2024
ba52724
Merge branch 'pr_int_fastapi-rebase-pr-174' into pr_int_fastapi
b0661 Oct 19, 2024
1f5abf3
Tool to integrate EOS PRs in an integration branch.
b0661 Oct 19, 2024
14a1be6
Merge branch 'pr_int_fastapi-rebase-pr-176' into pr_int_fastapi
b0661 Oct 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: "3.12"

- name: Install dependencies
run: |
Expand All @@ -26,4 +26,4 @@ jobs:
- name: Run Pytest
run: |
pip install -e .
python -m pytest -vs --cov modules --cov-report term-missing tests/
python -m pytest -vs --cov src --cov-report term-missing tests/
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ output/
# Default ignore folders and files for VS Code, Python

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/*.shared.json
!.vscode/extensions.json
!.vscode/*.code-snippets

Expand Down Expand Up @@ -69,6 +67,9 @@ coverage.xml
.pytest_cache/
cover/

# Documentation generation
_autosummary/

# Translations
*.mo
*.pot
Expand Down Expand Up @@ -248,3 +249,6 @@ $RECYCLE.BIN/

# Visualization side effects
**/visualization_results.pdf

# Test files
openapi-new.json
42 changes: 21 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Exclude some file types from automatic code style
exclude: \.(json|csv)$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
name: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
# Run the linter and fix simple issues automatically
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
name: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
# Run the linter and fix simple issues automatically
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
14 changes: 14 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"recommendations": [
//python
"ms-python.python",
"ms-python.debugpy",
"charliermarsh.ruff",
"ms-python.mypy-type-checker",

// misc
"swellaby.workspace-config-plus", // allows user and shared settings
"christian-kohler.path-intellisense",
"esbenp.prettier-vscode"
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.shared.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFoldingRangeProvider": "charliermarsh.ruff",
"editor.formatOnSave": true,
"python.analysis.autoImportCompletions": true,
"mypy-type-checker.importStrategy": "fromEnvironment",
"python.testing.pytestArgs": [],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `EOS` project is in early development, therefore we encourage contribution i

## Bug Reports

Please report flaws or vulnerabilities in the [GitHub Issue Tracker]((https://github.com/Akkudoktor-EOS/EOS/issues)) using the corresponding issue template.
Please report flaws or vulnerabilities in the [GitHub Issue Tracker](https://github.com/Akkudoktor-EOS/EOS/issues) using the corresponding issue template.

## Ideas & Features

Expand Down Expand Up @@ -44,5 +44,5 @@ pre-commit run --all-files
Use `pytest` to run tests locally:

```bash
python -m pytest -vs --cov modules --cov-report term-missing tests/
python -m pytest -vs --cov src --cov-report term-missing tests/
```
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ COPY src .
USER eos
ENTRYPOINT []

CMD ["python", "-m", "akkudoktoreosserver.flask_server"]
CMD ["python", "-m", "akkudoktoreosserver.fastapi_server"]

VOLUME ["${MPLCONFIGDIR}", "${EOS_CACHE_DIR}", "${EOS_OUTPUT_DIR}"]
31 changes: 24 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Define the targets
.PHONY: help venv pip install dist test docker-run docs clean
.PHONY: help venv pip install dist test docker-run docker-build docs read-docs clean format run run-dev

# Default target
all: help
Expand All @@ -10,10 +10,12 @@ help:
@echo " venv - Set up a Python 3 virtual environment."
@echo " pip - Install dependencies from requirements.txt."
@echo " pip-dev - Install dependencies from requirements-dev.txt."
@echo " format - Format source code."
@echo " install - Install EOS in editable form (development mode) into virtual environment."
@echo " docker-run - Run entire setup on docker"
@echo " docker-build - Rebuild docker image"
@echo " docs - Generate HTML documentation (in build/docs/html/)."
@echo " read-docs - Read HTML documentation in your browser."
@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."
Expand Down Expand Up @@ -51,15 +53,26 @@ docs: pip-dev
.venv/bin/sphinx-build -M html docs build/docs
@echo "Documentation generated to build/docs/html/."

# Target to read the HTML documentation
read-docs: docs
@echo "Read the documentation in your browser"
.venv/bin/python -m webbrowser build/docs/html/index.html

# Clean target to remove generated documentation, distribution and virtual environment
clean:
@echo "Cleaning virtual env, distribution and documentation directories"
rm -rf dist
rm -rf .venv
@echo "Cleaning virtual env, distribution and build directories"
rm -rf dist build .venv
@echo "Searching and deleting all '_autosum' directories in docs..."
@find docs -type d -name '_autosummary' -exec rm -rf {} +;
@echo "Deletion complete."

run:
@echo "Starting flask server, please wait..."
.venv/bin/python -m akkudoktoreosserver.flask_server
@echo "Starting FastAPI server, please wait..."
.venv/bin/python -m akkudoktoreosserver.fastapi_server

run-dev:
@echo "Starting FastAPI development server, please wait..."
.venv/bin/fastapi dev src/akkudoktoreosserver/fastapi_server.py

# Target to setup tests.
test-setup: pip-dev
Expand All @@ -68,7 +81,11 @@ test-setup: pip-dev
# Target to run tests.
test:
@echo "Running tests..."
.venv/bin/pytest
.venv/bin/pytest -vs --cov src --cov-report term-missing

# Target to format code.
format:
pre-commit run --all-files

# Run entire setup on docker
docker-run:
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This product may utilize technologies covered under international patents and/or

ADDITIONAL ATTRIBUTIONS:
The following is a list of licensors and other acknowledgements for third-party software that may be contained within this system:
- Flask, licensed under the BSD License, see https://flask.palletsprojects.com/
- FastAPI, licensed under the MIT License, see https://fastapi.tiangolo.com/
- NumPy, licensed under the BSD License, see https://numpy.org/
- Requests, licensed under the Apache License 2.0, see https://requests.readthedocs.io/
- matplotlib, licensed under the matplotlib License (a variant of the Python Software Foundation License), see https://matplotlib.org/
Expand Down
Loading
Loading