Skip to content

Commit

Permalink
Merge pull request #104 from OpenEnergyPlatform/rewrite
Browse files Browse the repository at this point in the history
Rewrite OMI
  • Loading branch information
jh-RLI authored Oct 24, 2024
2 parents d68e78f + 69b9370 commit 0cb3646
Show file tree
Hide file tree
Showing 117 changed files with 12,344 additions and 8,327 deletions.
20 changes: 0 additions & 20 deletions .bumpversion.cfg

This file was deleted.

38 changes: 38 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[tool.bumpversion]
current_version = "0.2.1"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
regex = false
ignore_missing_version = false
ignore_missing_files = false
tag = true
sign_tags = false
tag_name = "v{new_version}"
tag_message = "v{new_version}"
allow_dirty = false
commit = true
message = "Bump version: {current_version} → {new_version}"
commit_args = ""

[[tool.bumpversion.files]]
filename = "pyproject.toml"

[[tool.bumpversion.files]]
filename = "CHANGELOG.md"
search = "[Unreleased]"
replace = "[Unreleased] - {now:%Y-%m-%d}"

[[tool.bumpversion.files]]
filename = "CHANGELOG.md"
search = "Unreleased"

[[tool.bumpversion.files]]
filename = "README.rst"

[[tool.bumpversion.files]]
filename = "docs/conf.py"

[[tool.bumpversion.files]]
filename = "omi/__init__.py"
56 changes: 0 additions & 56 deletions .cookiecutterrc

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/automated-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- master
- develop
- dev
pull_request:

jobs:
Expand All @@ -26,4 +26,4 @@ jobs:
run: pip install tox
- name: Run tox
# Run tox using the version of Python in `PATH`
run: tox -v
run: tox -v
35 changes: 35 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1

on:
pull_request:
branches: [ "master", "dev" ]
paths-ignore: [ "docs/**" ]

push:
branches: [ "master", "dev" ]
paths-ignore: [ "docs/**" ]

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
linter:
runs-on: ubuntu-latest
steps:

- name: Checkout Code Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Run pre-commit
uses: pre-commit/action@v3.0.1
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ docs/_build


# manual testing scripts
/local_test
/local_test
/script
/.venv/
36 changes: 30 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
exclude: 'docs|node_modules|vendors|migrations|.git|.tox'
default_stages: [commit]
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-json
exclude: tests/test_data/validation/invalid_metadata/*
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files

- repo: https://github.com/pre-commit/mirrors-jshint
rev: v2.13.6
hooks:
- id: jshint

- repo: https://github.com/psf/black
rev: stable
rev: 23.3.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/pre-commit/mirrors-isort
rev: master
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.277'
hooks:
- id: ruff

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: isort
language_version: python3
- id: flake8
args: [ "--config=setup.cfg" ]
additional_dependencies: [ flake8-isort ]
56 changes: 0 additions & 56 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
Authors
=======

* Martin Glauer - openenergy-platform.org
* Jonas Huber - openenergy-platform.org
* Hendrik Huyskens - openenergyplatform.org
* Martin Glauer - openenergyplatform.org
* Jonas Huber - openenergyplatform.org
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Changelog
=========

current (2024-XX-XX)
current
--------------------
*
* Fully rewrite OMI and implement the json schema spec only, remove python class based parsing (#104)[https://github.com/OpenEnergyPlatform/omi/pull/104]

0.2.1 (2024-01-26)
--------------------
Expand All @@ -30,7 +30,7 @@ current (2024-XX-XX)
0.0.9 (2022-10-31)
--------------------

* Fix bug that is raised if the input oemetadata does not contain the key _comment (PR#74)
* Fix bug that is raised if the input oemetadata does not contain the key _comment (PR#74)

0.0.8 (2022-10-20)
--------------------
Expand Down
21 changes: 0 additions & 21 deletions MANIFEST.in

This file was deleted.

24 changes: 12 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ Usage
=====

**Parse, Compile, Render, Convert and Validate**
Omi can read(parse), compile, Render(json compilant), convert(convert metadata from v1.4 to v1.5 structure) and validate - a json
file or object that is compliant with the oemetadata spec. This is usefull to do various operations that help to integrate with - as
well as in interact with the oemetadata. Some parts of this tool might still be volatile but the code quality is conventionsly improved
Omi can read(parse), compile, Render(json compilant), convert(convert metadata from v1.4 to v1.5 structure) and validate - a json
file or object that is compliant with the oemetadata spec. This is usefull to do various operations that help to integrate with - as
well as in interact with the oemetadata. Some parts of this tool might still be volatile but the code quality is conventionsly improved
as this module is a core component of the oeplatfroms metadata integration system.

Check if omi is able to read a oemetadata file (for version 1.4 and 1.5)
Expand All @@ -96,8 +96,8 @@ CLI - oemetadata version 1.4::

omi translate -f oep-v1.4 -t oep-v1.4 examples/data/metadata_v14.json

omi is able to read a JSON file and parse it into one of the internal Python structures (depending on the oemetadata version).
The OEPMetadata Python object can then be compiled and converted back to JSON. You can manipulate a successfully parsed
omi is able to read a JSON file and parse it into one of the internal Python structures (depending on the oemetadata version).
The OEPMetadata Python object can then be compiled and converted back to JSON. You can manipulate a successfully parsed
OEPMetadata object.

Module usage::
Expand All @@ -120,7 +120,7 @@ by using a CLI command.

CLI - oemetadata conversion from v1.4 to v1.5::

omi convert -i {input/path} -o {output/path}
omi convert -i {input/path} -o {output/path}

**Validation**

Expand All @@ -142,21 +142,21 @@ Module usage::

parser = JSONParser()
parser.validate(metadata)
# check if your metadata is valid for the given schmea

# check if your metadata is valid for the given schmea
schema = ... get a schema or import form oemetadata module
parser.is_valid(metadata, schema)

**Additional Fields - not related to the OEMetadata specification**

Sometimes it is necessary to store additional key-value pairs along with the keys included in the OEMetadata specification.
OMI's compiler methods are capable of handling additional arguments or key-value arguments, but this must be
be explicitly specified.
OMI's compiler methods are capable of handling additional arguments or key-value arguments, but this must be
be explicitly specified.

To add additional key-value pairs, you must:
To add additional key-value pairs, you must:

NOTE: If you save the renderer return value in a json file and try to parse the file, the extra field is not included.
You must read the json file using Python and then add the extra field back oemetadata object as shown below.
You must read the json file using Python and then add the extra field back oemetadata object as shown below.

1 Parse the oemetadata from json file / variable into omis internal structure::

Expand Down
Loading

0 comments on commit 0cb3646

Please sign in to comment.