-
Notifications
You must be signed in to change notification settings - Fork 5
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
Improve Documentation #822
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
0712a55
🚛 rename file to rst
hf-krechan 5a1dbbb
🎨 convert to rst
hf-krechan ea3fbe6
📝 Update authors
hf-krechan 7136d98
🔥 remove copyright hochfrequenz
hf-krechan 742f657
📝 change order in side bar
hf-krechan 7c176fe
⚙️ Remove footer
hf-krechan ac3dbf1
🚛 rename file
hf-krechan b37495f
📝 add contributing
hf-krechan addc36f
📝 add introduction content
hf-krechan 4c0cede
🚛 Move
hf-krechan cd19608
📝 WIP
hf-krechan 97b6d10
🎨 Merge the two changelog files
hf-krechan 0db4ebc
🩹 Fix documentation
hf-krechan 2e467e8
🩹 Fix documentation build
hf-krechan 8b61ac2
🩹 Write Data Model
hf-krechan c45a3fe
Merge branch 'main' into improve-documentation-2
hf-krechan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,9 +1,30 @@ | ||
============ | ||
Contributors | ||
Contributing | ||
============ | ||
|
||
We're thrilled that you're interested in contributing to the BO4E (Business Object for Energy) project. | ||
This is an open-source project and we love to see new contributors. | ||
|
||
Our project has already benefited from the contributions of amazing developers. | ||
We're excited to see your name join this list! | ||
|
||
Whether you're fixing bugs, adding new features, or improving documentation, your work will make a significant impact. | ||
|
||
Please make sure to read our [Contributing Guide](LINK_TO_CONTRIBUTING_GUIDE) and feel free to reach out if you have any questions or need help. | ||
Just open an issue or send us an email. | ||
We can also provide you with an invitation link to our Slack workspace. | ||
|
||
Thank you for your interest in BO4E, and we look forward to seeing your contributions! | ||
|
||
Contributors | ||
------------ | ||
|
||
The following people have contributed to the development of this project: | ||
|
||
* Kevin Krechan <kevin.krechan@hochfrequenz.de> | ||
* Leon Haffmans <leon.haffmans@hochfrequenz.de> | ||
* Annika Schlögl <annika.schloegl@hochfrequenz.de> | ||
* Franziska Vesely <franziska.vesely@hochfrequenz.de> | ||
* Konstantin Klein <konstantin.klein@hochfrequenz.de> | ||
* Tim Steufmehl <tim.steufmehl@enet.eu> | ||
* Kevin Frenken <kevin.frenken@enet.eu> |
This file was deleted.
Oops, something went wrong.
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
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
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
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,133 @@ | ||
How to Contribute Code | ||
====================== | ||
|
||
This document describes how the BO4E Python implementation is written and what to watch out for. | ||
|
||
Technical Setup in your IDE | ||
=========================== | ||
|
||
We're using tox. Please follow the instructions in our `Python Template Repository <https://github.com/Hochfrequenz/python_template_repository#how-to-use-this-repository-on-your-machine>`_. Feel free to open an issue if you run into any kind of problems. | ||
|
||
Coding Style and Guidelines | ||
=========================== | ||
|
||
General Rules | ||
------------- | ||
|
||
- We use (and enforce in the CI): | ||
- black for formatting | ||
- pylint for linting | ||
- mypy for static type checking | ||
- pytest for unittests | ||
- Sphinx and Plantuml (and kroki web service) for documentation | ||
- Technical Documentation is in English; For example: "Don't use the builtin validator here because …" | ||
- But data model docstrings are in German; For example: "Ist das Ende nicht gesetzt, so ist der Zeitraum als offen zu verstehen." | ||
- Docstrings should not be trivial/useless | ||
- Bad: "Energiemenge ist eine Klasse zur Abbildung von Energiemengen." ❌ (no shit Sherlock) | ||
- Good: "Eine Energiemenge ordnet einer :class:`Marktlokation` oder :class:`Messlokation`, die über die `lokations_id` referenziert werden, einen oder mehrere Energieverbräuche zu." ✔ | ||
- Only sentences have a full stop at the end. | ||
- We use ``snake_case`` internally but serialize as ``camelCase`` by overriding the ``data_key`` property of the schema fields. | ||
|
||
How to Define an ENUM? | ||
---------------------- | ||
|
||
All Enums inherit from ``bo4e.enum.StrEnum``. The latter is just a usual Enum with a ``str`` mixin (see `the official docs <https://docs.python.org/3/library/enum.html?highlight=strenum#others>`_ for details). This allows us to precisely define how an enum value will be serialized. All enum values have UPPER_CASE names. | ||
|
||
.. code-block:: python | ||
|
||
# pylint:disable=missing-module-docstring | ||
|
||
from bo4e.enum.strenum import StrEnum | ||
|
||
class MyBo4eEnum(StrEnum): | ||
""" | ||
Hier sollte ein deutscher Text stehen, der Sinn und Zweck des Enums beschreibt. | ||
""" | ||
|
||
FOO = "FOO" #: FOO ist, wenn der Himmel blau ist | ||
BAR = "BAR" | ||
""" | ||
Der Docstring für BAR kann auch hier drunter stehen, wenn er besonders lang ist und mehr sagen will, | ||
als dass BAR für die grüne Wiese steht. Denn manchmal braucht es mehr als hundert Zeichen. | ||
""" | ||
EIGENSCHAFT_0815 = "0815" #: manchmal heißen eigenschaften anders (EIGENSCHAFT_0815) als sie serialisiert werden ("0815") | ||
# this typically happens for annoying enum values that contains "-" or start with digits | ||
|
||
How to Define COMs or BOs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🥰 |
||
------------------------- | ||
|
||
All COMponents inherit from ``bo4e.com.com.COM``. All Business Objects inherit from ``bo4e.bo.geschaeftsobjekt.Geschaeftsobjekt``. | ||
|
||
For data validation and de/serialization we use `pydantic <https://pydantic-docs.helpmanual.io/>`_. | ||
|
||
.. code-block:: python | ||
|
||
""" | ||
Give the module a docstring to describe what it contains | ||
""" | ||
|
||
from pydantic import validator | ||
|
||
from datetime import datetime | ||
from typing import Optional, Dict, Any | ||
|
||
from ..bo.geschaeftsobjekt import Geschaeftsobjekt | ||
from ..com.menge import Menge | ||
from ..enum.typ import BoTyp | ||
|
||
# pylint: disable=too-few-public-methods | ||
class MeinBo(Geschaeftsobjekt): | ||
""" | ||
MeinBo ist ein ganz besonderes Business Objekt. | ||
Es kommt nur bei meinem Strom-Lieferanten zum Einsatz und beschreibt dort all die tollen Eigenschaften, die mein Verbrauchsverhalten hat. | ||
""" | ||
|
||
typ: Annotated[Optional[Typ], Field(alias="_typ")] = Typ.MEINBO | ||
|
||
#: Der Lieferbeginn beschreibt den Zeitpunkt ab dem (inklusiv) mich ein Versorger seinen Kunden nennen darf | ||
lieferbeginn: Optional[datetime] = None | ||
|
||
anzahl_freudenspruenge: Optional[int] = None | ||
""" | ||
Anzahl Freudensprünge beschreibt, wie oft der CEO des Stromkonzerns in die Luft gesprungen ist, als ich den Vertrag unterschrieben habe. | ||
""" | ||
|
||
#: Menge (Elektrische Energie oder Gas oder Wärme), die ich zum Lieferbeginn umsonst erhalte | ||
freimenge: Optional[Menge] = None | ||
|
||
# we can help you with anything you might be missing or unable to implement. | ||
# ToDo comments are just fine. | ||
# You don't need to be a perfect programmer to contribute to bo4e :) | ||
|
||
Unittests | ||
--------- | ||
|
||
Ideally provide unittests that show: | ||
|
||
- that the BO/COM can be instantiated | ||
- with only the required attributes | ||
- with all attributes | ||
- can be serialized and deserialized again | ||
- with only the required attributes | ||
- with all attributes | ||
|
||
Therefore, copy one of the existing "roundtrip" tests, see f.e. ``TestTarifeinschraenkung``. | ||
|
||
Pull Request | ||
============ | ||
|
||
Open a Pull Request against the main/default branch of this repository. We'd appreciate if you allowed maintainer edits. | ||
|
||
Release Workflow | ||
================ | ||
|
||
- Check with tox all tests and linting: ``tox`` | ||
- Check with tox if the packaging works fine: ``tox -e test_packaging`` | ||
- Squash Merge all your changes you would like to have in the release into the main/default branch | ||
- Check that all GitHub Actions for tests and linting do pass (should be automatically enforced for PRs against main) | ||
- Go to the repositorys right sidebar and click on `Draft a new release <https://github.com/Hochfrequenz/BO4E-python/releases/new>`_ | ||
- Write in the *Tag version* field and in the *Release title* your new version, i.e. ``v0.0.6`` | ||
- Add a description to the release (or just autogenerate the change log which will be fine for 95% of cases) | ||
- Publish the release | ||
|
||
There is a GitHub Action which gets triggered by a release event. It will run all default tests with tox. If they pass, it will take the tag title to replace the version information in the *setup.cfg* file. After checking the package with ``twine check`` it will finally upload the new package release. |
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,13 @@ | ||
============ | ||
Fundamentals | ||
============ | ||
|
||
The BO4E data model is constructed around three main parts: Business Objects, Components, and Enumerations. | ||
|
||
**Business Objects** and **Components** are the primary building blocks of the data model. | ||
They inherit from a main Business Object and a main Component respectively. | ||
These main objects contain meta data fields such as `_id`, `_typ`, and `_version` that are common to all Business Objects and Components. | ||
|
||
**Enumerations** are used to represent a set of named values in the data model, providing a way to enforce specific values for a field. | ||
|
||
This structure allows for a high degree of flexibility and extensibility, enabling the data model to adapt to the evolving needs of the German energy market. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wollen wir die beiden Zeilen weglassen? Ich habe das Gefüglh wir wiederholen uns zu sehr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ich finde sie nicht schlimm, kann sie aber auch gerne entfernen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nee so schlimm finde ich sie auch nicht, kann auch bleiben 😁