-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Okay, this PR got a bit larger than anticipated. But there were just too many small things which I want to cleanup: - General code-style: - Formatting via [black](https://github.com/psf/black) - PEP-8 compliance via [flake8](https://flake8.pycqa.org/en/3.1.1/index.html) - Fix a bunch of code-smells detected by Sonar Cloud - Improve code-quality - Remove `print()` and replace by `logging` module - Replace `.format()`-style string formatting by printf-style for logging module - Revamp CI pipelines: - I removed the in-repo CI action for building the documentation and converted it to a normal workflow - This allowed removing a lot of stuff: - Dockerfile - docu.sh - action.yaml - entrypoint.sh - Removal of GitLab CI config - The documentation is now also build in PR pipelines, but just not deployed. - Migrate to more modern Python packaging practices: - `setup.py` has been replace by `pyproject.toml` - Check code-style, formatting and more with [pre-commit](https://pre-commit.com/) - Will also be enforced by CI workflow
- Loading branch information
Showing
56 changed files
with
931 additions
and
818 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
max-line-length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Documentation | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
branches: | ||
- master | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Graphviz | ||
shell: bash | ||
run: | | ||
sudo apt-get -y install graphviz | ||
- name: Install Python dependencies | ||
run: | | ||
pip install .[doc] | ||
- name: Build documentation | ||
working-directory: documentation | ||
run: | | ||
sphinx-apidoc \ | ||
--full \ | ||
--doc-project "cimpy" \ | ||
--separate \ | ||
--output-dir "." \ | ||
"../" | ||
python3 set_inheritance_diagram.py | ||
make html | ||
touch _build/html/.nojekyll | ||
ls -l _build/html | ||
- name: Upload Artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: documentation/_build/html | ||
|
||
- name: Deploy to GitHub Pages | ||
if: github.ref == 'refs/heads/master' | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/[email protected] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Pytest | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Graphviz | ||
shell: bash | ||
run: | | ||
sudo apt-get -y install graphviz | ||
- name: Install Python dependencies | ||
run: | | ||
pip install .[dev] | ||
- name: Run pytest | ||
run: | | ||
pytest -v -cov --junitxml=report.xml | ||
- name: Upload pytest test results | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ always() }} | ||
with: | ||
name: pytest-results | ||
path: cimpy/report.xml |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
# python folders | ||
# Python folders | ||
*.egg-info/ | ||
__pycache__ | ||
.idea | ||
.venv | ||
./cimpy/__pycache__ | ||
*.egg | ||
build/ | ||
dist/ | ||
|
||
# log files | ||
*.log | ||
|
||
# vs code | ||
# VSCode | ||
.vscode/* | ||
|
||
# documentation | ||
# documentation/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
exclude: ^cimpy/cgmes_ | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 7.1.0 | ||
hooks: | ||
- id: flake8 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
recursive-include cimpy/examples *.xml *.py | ||
recursive-include cimpy *.mustache | ||
recursive-include cimpy *.mustache |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# flake8: noqa | ||
|
||
from cimpy.cimexport import cim_export | ||
from cimpy.cimimport import cim_import | ||
import cimpy.utils | ||
from cimpy.cimexamples import import_example | ||
from cimpy.cimexamples import export_example | ||
from cimpy.cimexamples import addExternalNetworkInjection_example | ||
from cimpy.cimexamples import convertToBusBranch_example | ||
from cimpy.cimexamples import add_external_network_injection_example | ||
from cimpy.cimexamples import convert_to_bus_branch_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.