Skip to content

Commit 11639da

Browse files
committed
Merge branch 'main' into 2.1.x
2 parents e89bf6e + 845e61c commit 11639da

File tree

9 files changed

+174
-155
lines changed

9 files changed

+174
-155
lines changed

AUTHORS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
The following people have contributed to this repository:
44

5-
* [Hanna Shalamitskaya](mailto:[email protected])
6-
* [Andreas Textor](mailto:[email protected])
7-
* [Georg Schmidt-Dumont](mailto:[email protected])
8-
* [Michele Santoro](mailto:[email protected])
5+
* [Hanna Shalamitskaya](https://github.com/Hanna-Shalamitskaya-EPAM), [email protected]
6+
* [Andreas Textor](https://github.com/atextor), Robert Bosch GmbH, [email protected]
7+
* Georg Schmidt-Dumont, Robert Bosch GmbH, [email protected]
8+
* [Michele Santoro](https://github.com/michelu89), Robert Bosch GmbH, [email protected]
99
* Nico Makowe
1010
* Aghyad Farrouh
1111

CONTRIBUTING.md

Lines changed: 99 additions & 121 deletions
Large diffs are not rendered by default.

CONVENTIONS.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,40 @@ The following document contains a compilation of conventions and guidelines to f
44
structure and write code for the ESMF SDK PY Aspect Model Loader.
55

66
## General Conventions
7-
Our code conventions are based on the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) but
8-
detailed and adjusted for the needs of the ESMF SDK py Aspect Model Loader.
7+
8+
Our code conventions are based on the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html),
9+
but detailed and adjusted for the needs of the ESMF SDK PY Aspect Model Loader.
910

1011
## Copyright header
1112
See [CONTRIBUTING](CONTRIBUTING.md)
13+
14+
## Code Recommendations
15+
16+
The code for this project follows the guidelines of [PEP 8](https://peps.python.org/pep-0008/).
17+
The libraries black, flake8 and isort are also used so that the code can be checked for compliance with the PEP 8 style.
18+
19+
## Documentation
20+
21+
### Developer Documentation
22+
Developer documentation is put into a README.md placed in the project root. This should contain documentation like:
23+
* Checking out the source code and getting it to run/build
24+
* Mandatory (external system) dependencies and how to set them up (e.g. databases)
25+
* Configuration options and how to apply them
26+
* General important concepts that are relevant to working on the project but are not directly obvious from the source code
27+
itself. Links to further readings and information, e.g. wiki or other external sources.
28+
29+
### User documentation
30+
31+
User documentation (this includes technical documentation on how to use an application or tool from the
32+
ESMF SDK PY Aspect Model Loader Code Conventions) should be on its own.
33+
34+
It is written in AsciiDoc, rendered with [Antora](https://antora.org) and the generated static content is
35+
publicly hosted for direct user access.
36+
The source files of the documentation are placed in a subfolder /documentation from the project root.
37+
Documentation is structured so that it can be processed by Antora. This e.g. involves structuring the documentation files
38+
according to [Antora's specification](https://docs.antora.org/antora/2.3/organize-content-files/) and organizing resources
39+
so that Antora [can handle them](https://docs.antora.org/antora/2.3/page/resource-id/).
40+
[AsciiDoc's syntax](https://docs.antora.org/antora/2.3/asciidoc/asciidoc/) is pretty close to Markdown, however it is
41+
way more targeted towards writing fully fledged documents and with its multitude of backends (HTML, PDF, ...) it is a
42+
very good source format.
43+
Publishing is realized by means of [GitHub pages](https://docs.antora.org/antora/2.3/publish-to-github-pages/).

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,4 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
370370
---------------------------------------------------------
371371

372372
This Source Code Form is "Incompatible With Secondary Licenses", as
373-
defined by the Mozilla Public License, v. 2.0.
373+
defined by the Mozilla Public License, v. 2.0.

NOTICE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
## Antora
12

3+
This repository contains software developed by the [Antora Project](https://antora.org/).
4+
5+
Your use of Antora is subject to the terms and conditions of the Mozilla Public License 2.0. A copy of the license is contained in the file [LICENSE.txt](/LICENSE.txt) and is also available at https://mozilla.org/MPL/2.0/.
6+
7+
The source code is available from [GitLab](https://gitlab.com/antora).

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,26 @@
2222
## Introduction
2323

2424
The ESMF SDK Python Aspect Model Loader contains artifacts and resources for all parties that intent to use, extend or
25-
integrate with the Semantic Aspect Meta Model, e.g., Solution Developers,
26-
Domain Experts or OEMs.
25+
integrate with the Semantic Aspect Meta Model, e.g., Solution Developers, Domain Experts or OEMs.
2726

2827
At its core are components which help to work with the Semantic Aspect Meta Model (SAMM).
2928

30-
This repository contains a detailed developer documentation written in AsciiDoc. The source files (AsciiDoc) are
31-
located [here](documentation/python-sdk-guide)
32-
and are built using
33-
[Antora](https://antora.org/) which generates the documentation as HTML files.
29+
This repository contains a detailed developer documentation written in AsciiDoc. The source files (AsciiDoc) are
30+
[python-sdk-guide](documentation/python-sdk-guide) and are built using [Antora](https://antora.org/)
31+
which generates the documentation as HTML files.
3432

3533
## Getting help
3634

37-
Are you having trouble with ESMF SDK Python? We want to help!
35+
Are you having trouble with ESMF SDK Python Aspect Model Loader? We want to help!
3836

3937
* Check the [developer documentation](https://eclipse-esmf.github.io)
40-
* Having issues with the ESMF SDK Python? Open
41-
a [GitHub issue](https://github.com/eclipse-esmf/esmf-sdk-py-aspect-model-loader/issues).
38+
* Check the SAMM [specification](https://eclipse-esmf.github.io/samm-specification/snapshot/index.html)
39+
* Having issues with the ESMF SDK Python Aspect Model Loader? Open a [GitHub issue](https://github.com/eclipse-esmf/esmf-sdk-py-aspect-model-loader/issues).
4240

4341
## Getting Started
4442

4543
This document provides an overall overview of the SDK and the concepts applied throughout it. Detailed documentation and
46-
concepts for each component can be found in the respective subfolders or subrepositories.
44+
concepts for each component can be found in the respective subfolders or sub-repositories.
4745

4846
## SDK Structure
4947

@@ -55,7 +53,6 @@ esmf-sdk-py-aspect-model-loader
5553
├─── core # e.g. meta model implementation etc.
5654
│ ├─── esmf-aspect-meta-model-python
5755
│ ├─── ...
58-
└─── samples # sample projects to get you started quickly
5956
```
6057

6158
## Python Core Components
@@ -73,7 +70,8 @@ generated source code artifacts. Any form of source code generator will use the
7370

7471
## Version Handling
7572

76-
The aspect meta model loader work with the SAMM versions specified in the [download_samm_release.py](core/esmf-aspect-meta-model-python/esmf_aspect_meta_model_python//samm_aspect_meta_model/download_samm_release.py). This version will be used for deployment.
73+
The aspect meta model loader work with the SAMM versions specified in the [download_samm_release.py](core/esmf-aspect-meta-model-python/esmf_aspect_meta_model_python//samm_aspect_meta_model/download_samm_release.py).
74+
This version will be used for deployment.
7775

7876
As SAMM evolves over time, the Aspect Meta Model Loader should also adapt and evolve accordingly.
7977
Due to this fact it is important to understand the versioning concept that is applied to the SAMM,

core/esmf-aspect-meta-model-python/README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ Required
3434
- [Install poetry](#install-poetry)
3535
- [Install project dependencies](#install-project-dependencies)
3636
- [Download SAMM files](#download-samm-files)
37-
Optional
38-
- [Download SAMM CLI](#download-samm-cli) (needed to use SAMM CLI functions)
39-
- [Download SAMM test models](#download-test-models) (for running integration tests)
4037

4138
### Install poetry
4239

@@ -109,13 +106,20 @@ aspect = model_elements[0]
109106

110107
SAMMUnitsGraph is a class contains functions for accessing units of measurement.
111108
```python
112-
from esmf_aspect_meta_model_python.samm_meta_model import SammUnitsGraph
109+
from esmf_aspect_meta_model_python.samm_meta_model import units
113110

114-
units_graph = SammUnitsGraph()
115-
unit_data = units_graph.get_info("unit:volt")
111+
unit_name = "unit:volt"
112+
units.print_description(units.get_info(unit_name))
113+
# preferredName: volt
114+
# commonCode: VLT
115+
# ...
116+
# symbol: V
117+
118+
# Get unit data as dictionary
119+
volt_info = units.get_info("unit:volt")
116120
# {'preferredName': rdflib.term.Literal('volt', lang='en'), 'commonCode': rdflib.term.Literal('VLT'), ... }
117121

118-
units_graph.print_description(unit_data)
122+
units.print_description(volt_info)
119123
# preferredName: volt
120124
# commonCode: VLT
121125
# ...

core/esmf-aspect-meta-model-python/esmf_aspect_meta_model_python/samm_meta_model.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,20 @@ def get_info(self, unit: str) -> Dict:
8181

8282
return unit_data
8383

84-
def print_description(self, unit_data: Dict, tabs: int = 0):
84+
def print_info(self, unit_data: Dict, tabs: int = 0):
8585
"""Pretty print a unit data."""
8686
for key, value in unit_data.items():
8787
if isinstance(value, dict):
8888
print("\t" * tabs + f"{key}:")
89-
self.print_description(value, tabs + 1)
89+
self.print_info(value, tabs + 1)
9090
elif isinstance(value, list):
9191
print("\t" * tabs + f"{key}:")
9292
for node in value:
9393
for key, sub_value in node.items():
9494
print("\t" * (tabs + 1) + f"{key}:")
95-
self.print_description(sub_value, tabs + 2)
95+
self.print_info(sub_value, tabs + 2)
9696
else:
9797
print("\t" * tabs + f"{key}: {value}")
98+
99+
100+
units = SammUnitsGraph()

core/esmf-aspect-meta-model-python/scripts/download_test_models.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ def get_resources_folder_path() -> str:
2929
return models_path
3030

3131

32-
def clear_folder():
32+
def clear_folder(resources_folder):
3333
"""Remove all files to clear test models directory."""
34-
resources_folder = get_resources_folder_path()
35-
36-
if exists(resources_folder) or len(listdir(resources_folder)) != 0:
34+
if exists(resources_folder) and len(listdir(resources_folder)) != 0:
3735
shutil.rmtree(resources_folder)
3836

3937
mkdir(resources_folder)
@@ -66,7 +64,7 @@ def download_test_models(version: str = Const.JAVA_CLI_VERSION):
6664
jar_file_path = join(resources_folder, jar_file_name)
6765

6866
print(f"Remove previous version of test models from the folder {resources_folder}")
69-
clear_folder()
67+
clear_folder(resources_folder)
7068

7169
print(f"Start downloading esmf-test-aspect-models version {version}")
7270
download_jar_file(jar_file_path)

0 commit comments

Comments
 (0)