sogno-platform / dpsim

Real-time power system simulator including powerflow, (dynamic) phasors and EMT
https://sogno.energy/dpsim/
Mozilla Public License 2.0
67 stars 49 forks source link

Use pyproject.toml instead of setup.cfg, pytest.ini & requirements.txt and other Python related config files #276

Open stv0g opened 7 months ago

stv0g commented 7 months ago

Modern Python is slowly adopting pyproject.toml as a single place to define a Python package and related tool settings like black for formatting, flake8 for linting and pytest for testing.

Lets try to move as much of the Python-related project configuration to this file and unclutter the root of the repo.

This PR does:

stv0g commented 7 months ago

I am interested in your opinions @leonardocarreras and @m-mirz. What do you think about consolidate all the Python related project files in pyproject.toml

m-mirz commented 7 months ago

Good idea 👍

leonardocarreras commented 7 months ago

I think it is a great idea 🙌🏻

stv0g commented 7 months ago

This is ready for review :)

I've also added pre-commit as a tool to perform several checks against changes which are staged for commit. Such as removing trailing whitespaces, checking JSON, YAML and XML syntax and Python / C++ code formatting.

While doing so, I realized that much of the Python code was ugly formatted. We are now using the de-facto standard Python formatter Black. It even can format Python code with in Jupyter notebooks :)

stv0g commented 7 months ago

@m-mirz I guess the SonarCloud warnings are false-positives. Its at least not code which I've touched.

stv0g commented 7 months ago

Hi @martinmoraga @leonardocarreras @dinkelbachjan,

Markus has reviewed and approved this change. However, we would like to find more approvals before going ahead and merging it.

Do you have a second to look at this change?

leonardocarreras commented 7 months ago

Side topic: Apparently, the more changes are here, the more Sonar complains and demands higher quality from reformatted existing code...

sonarcloud[bot] commented 7 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
5 Security Hotspots
E Security Review Rating on New Code (required ≥ A)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

m-mirz commented 5 months ago

@stv0g @leonardocarreras I think this can be merged after the question regarding pip install have been resolved.