-
Notifications
You must be signed in to change notification settings - Fork 40
Add Referable Utility Methods and Refactor Key Handling
#410
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
Merged
Conversation
This file contains hidden or 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
…asyx#363) We add a missing import statement of `basyx.aas.adapter.json`. Fixes eclipse-basyx#352
…syx#356) Currently, there are several wrong imports and outdated unittests in the `compliance-tool` package. This fixes these issues. Fixes eclipse-basyx#354
…ce` (eclipse-basyx#337) Previously, if the `semantic_id` was a `ModelReference`, it very often had the generic `type` "`model.Referable`" instead of the actual type of the object it points to. This lead to a bug in the AASX writer, where `ConceptDescription`s were not written to the AASX, even though they existed in the `ObjectStore`. This fixes this problem by tackling three separate points: 1. In `json_deserialization.py`, we now infer the `type` of the `ModelReference` via the Reference's last `Key`. This is more of a hotfix and issue eclipse-basyx#367 tracks the creation of a better solution. 2. In `aasx.py`, an unneccessary `logger.info` call is removed, that previously cluttered the output of the writer if a `semantic_id` was not pointing to a `ConceptDescription`, which is not something worth noting. Furthermore, we improve other log messages. 3. In `examples.data._helper`, we improve the test for `semantic_id` equality, namely by comparing the `ModelReference`'s attributes explicitly, when it happens to be one, instead of relying on simple string comparision.
This updates the minimum version of the dependency `pyecma376` in the `pyproject.toml`, ensuring that our AASX files allow for spaces in file names. Fixes eclipse-basyx#236
…-basyx#369) Previously, some `sdk` dependencies, that are only necessary for testing were included in the mandatory dependencies. For improving package footprint, these are moved into the `[dev]` section of optional dependencies in the `pyproject.toml`. --------- Co-authored-by: s-heppner <[email protected]>
This adds a new `SetObjectStore` that is backed by a set. Its main advantage is that it does not have the problem with not updated `Identifier`s that the `DictObjectStore` has (See eclipse-basyx#216). We make sure to document the differences between `DictObjectStore` and `SetObjectStore` in their respective class docstrings.
… updated (eclipse-basyx#344) Previously, there was no check if the copyright statement on top of each file (due to the MIT license) was up to date. This adapts our `update_copyright_year.sh` script with a checking mode to determine if any file needs adapting and then adds this check to the CI. At the same time, this also updates all necessary files to the year 2025. Fixes eclipse-basyx#260 Fixes eclipse-basyx#331 --------- Co-authored-by: s-heppner <[email protected]>
…pse-basyx#359) Previously, we were accidentally still trying to install dependencies from the already deleted `requirements.txt` when generating the documentation. This fixes this and installs them instead from the `pyproject.toml`. Co-authored-by: s-heppner <[email protected]>
This refactors away from `setup.py` and towards `pyproject.toml` for the `compliance_tool` package. At the same step, we also update the relevant CI checks as well.
This fixes the redirects from the AAS repository paths to the Submodel repository paths to work properly. Furthermore, the installation of dependencies inside the server Docker image was previously using the latest release of the SDK. This means, that we could not ensure that each commit in the `main` branch of our monorepo would be interoperable between SDK and server, as a PR would have to be closed in order for the server CI would not report any errors. In order to fix this, issue in the development process, the server Docker image now installs the SDK from the local repository, rather than from GitHub. Lastly, this fixes a wrong status code reported when specifing a model that is malformed or missing information. The specification expects a 400 (Bad Request) response, but the server sent a 422 (Unprocessable Content). Fixes eclipse-basyx#315
…#376) Previously, the section "Codestyle and Testing" was outdated, still from the time where there was only the SDK inside this repository. This greatly extends the section, renaming it to "Code Quality" and introducing subsections for "Codestyle" and "Testing", where we describe how to run the necessary tests locally on the developer's machine for each of the packages inside this monorepository. Fixes eclipse-basyx#353
We previously refactored the compliance_tool from `setup.py` to `pyproject.toml` (See eclipse-basyx#361). However, somehow the `setup.py` slipped through and is still in the `compliance_tool` directory. This removes the `setup.py` from the `compliance_tool` completely.
This adds a job `compliance-tool-publish` to the `release.yml` that automatically publishes the compliance-tool package to PyPI upon release. It is simply copied from the SDK job, with adapted paths.
…#392) * sdk: Update lxml dependency in pyproject.toml Previously, the `lxml` dependency in the `pyproject.toml` was pinned to versions `>=4.2,<5`. This caused a faulty installation via `pip` on Windows due to missing binary wheels. This updates the `lxml` dependency to versions `>=5.3` to resolve the issue. Additionally, the `mypy` dependency in the `pyproject.toml` was unpinned, leading to the installation of the latest version. The recent release of `mypy 1.16.0` introduced changes not yet supported by our codebase, resulting in CI pipeline failures. This restricts the `mypy` dependency to version `1.15.0` until we have proper support for `1.16.0` and its new features. Fixes eclipse-basyx#391
- The method is added to refactor the usage of KEY_TYPES_CLASSES - Refactor `Key.from_referable`
- Added methods in class `Referable` for getting `identifiable` root object and for getting idShortPath, which can be used e.g. when working with servers/clients - Added tests for new methods - Fixed small typos in `test_base.py`
Contributor
|
@moritzsommer: These new methods should be mentioned in the new tutorial navigation. Depending on which PR (this one or #411) gets closed first, I would adapt the other respectively. |
s-heppner
reviewed
Sep 3, 2025
- Refactored and fixed `get_id_short_path`, so that now it can find out the id_short_path of an SE inside SEList - Added class methods in `Referable` - `parse_id_short_path` - `build_id_short_path` - `validate_id_short_path` - Refactored `IdShortPathConverter` to use the above methods. fixes eclipse-basyx#414
- Renamed id_short to id_short_path, as id_short_path also can be a single id_short - Before the `get_referable` could only accept a single id_short or id_short_path in form of a list. In this commit we added parsing of `id_short_path`, so now it is possible to handover `id_short_path` as a string e.g. "SomeList[3].SomeCollection.SomeProperty"
Contributor
Author
|
So, I found some issues and fixed it. I also refactored some methods and introduced new ones for id short path handling. Now it's ready to be reviewed and merged |
s-heppner
requested changes
Oct 10, 2025
raise TypeError if no matching type found
# Conflicts: # sdk/test/model/test_base.py
Previously we used custom Referable class to test the Reference generation. Actually, it is not allowed, as there is no matching key type for such a class. So we use now custom SubmodelElement class. In this case SubmodelElement will be used for key type.
s-heppner
approved these changes
Oct 15, 2025
moritzsommer
pushed a commit
to rwth-iat/basyx-python-sdk
that referenced
this pull request
Oct 21, 2025
…basyx#410) This introduces several utility methods and refactorings for `Referable` objects and `Key` handling. `idShortPath` Utility Functions - Add `Referable.get_identifiable_root()` to retrieve the root `Identifiable` object of a referable. - Add `Referable.get_id_short_path()` to generate an `idShortPath`, useful in client/server contexts. - Add `Referable.parse_id_short_path` to handle `idShortPath` strings - Add `Referable.build_id_short_path` to generate `idShortPath` string from list[str] - Add `Referable.validate_id_short_path` to check if the `idShortPath` is correct - Refactored `get_referable`, so that now it can accept `id_short_path` as a string `Key` Handling - Add `find_registered_referable_type_in_key_types_classes()` to encapsulate usage of `KEY_TYPES_CLASSES`. - Refactor `Key.from_referable` to leverage the new method. Tests - Add unit tests for the new `Referable` methods. - Fix minor typos in `test_base.py`. Fixes eclipse-basyx#414
Merged
zrgt
added a commit
to rwth-iat/basyx-python-sdk
that referenced
this pull request
Nov 18, 2025
…basyx#410) This introduces several utility methods and refactorings for `Referable` objects and `Key` handling. `idShortPath` Utility Functions - Add `Referable.get_identifiable_root()` to retrieve the root `Identifiable` object of a referable. - Add `Referable.get_id_short_path()` to generate an `idShortPath`, useful in client/server contexts. - Add `Referable.parse_id_short_path` to handle `idShortPath` strings - Add `Referable.build_id_short_path` to generate `idShortPath` string from list[str] - Add `Referable.validate_id_short_path` to check if the `idShortPath` is correct - Refactored `get_referable`, so that now it can accept `id_short_path` as a string `Key` Handling - Add `find_registered_referable_type_in_key_types_classes()` to encapsulate usage of `KEY_TYPES_CLASSES`. - Refactor `Key.from_referable` to leverage the new method. Tests - Add unit tests for the new `Referable` methods. - Fix minor typos in `test_base.py`. Fixes eclipse-basyx#414
s-heppner
added a commit
that referenced
this pull request
Dec 5, 2025
Prepare Release v2.0.0 # Release Notes Version 2.0.0 of the BaSyx-Python SDK comes with a major refactoring of the server and a renewed concept for data persistence. Previously, the server code was split between the `sdk` and `server` packages (due to historic development of the code). Now all the code relevant just for the server is located in `server`, where it belongs. Since this means, some code that was previously in `sdk` is not there anymore, this is a breaking change and warranted the new major release. > [!note] > This release does not have any changes in implemented AAS specification versions. It is the preparotory release in order to get ready for the new versions of the specifications, as well as new features for the SDK, such as Registry and Discovery server. > [!warning] > Due to these major refactorings, there were some backward incompatible changes. Please check the documentation, if you encounter any issues. # Changelog **Notable:** - Backward Incompatible: Refactor server functionality from `sdk` to `server` (See: #388) - Backward Incompatible: Refactor `backend` concept for data persistence (See: #370) - Backward Incompatible: Refactor server `start-up` options (See: #418) - Remove support for Python 3.9 (as it is EoL) (See #433) **Improvements:** - Clarify documentation of running the server with Docker (See: #398) - Document running the server without Docker (See: #403) - Improve XML serialization (See: #406) - Improve server reading of JSON and XML files (See: #408) - Add more utility methods for `Referable` and `Key` handling (See: #410) **Bugfixes:** - Fix type issues found with a new version of `mypy` (See: #399) - Fix parsing of `ConceptDescription`s in the server (See: #420) - Update `pyecma376-2` and `lxml` dependencies (See: #419)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces several utility methods and refactorings for
Referableobjects andKeyhandling.Changes
idShortPathUtility FunctionsReferable.get_identifiable_root()to retrieve the rootIdentifiableobject of a referable.Referable.get_id_short_path()to generate anidShortPath, useful in client/server contexts.Referable.parse_id_short_pathto handleidShortPathstringsReferable.build_id_short_pathto generateidShortPathstring from list[str]Referable.validate_id_short_pathto check if theidShortPathis correctget_referable, so that now it can acceptid_short_pathas a stringKey Handling
find_registered_referable_type_in_key_types_classes()to encapsulate usage ofKEY_TYPES_CLASSES.Key.from_referableto leverage the new method.Tests
Referablemethods.test_base.py.fixes #414