Skip to content
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

Rework class / namespace discovery #456

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

Wuestengecko
Copy link
Member

It should already be stable enough to try out in downstream projects. I can confirm that the model-explorer plus context-diagrams work fine (the parts that I tested, at least).

This also deprecates the DirectProxyAccessor in favor of Containment
(previously known as "RoleTagAccessor").
This commit reworks the discovery of metamodel classes and namespaces.
It introduces the `Namespace` object, whose instances keep track of the
contained classes. Namespace objects are discovered through the Python
entrypoint system. This makes extending the metamodel significantly
easier. It's no longer necessary to add weirdly formatted entries into
barely documented dictionaries, with errors only appearing at some
arbitrary later point.

Discovery of classes now happens via a custom metaclass by simply
inheriting from `ModelElement`. This also allows additional metadata to
be specified at subclassing time, which is especially relevant for
namespace versioning. Due to this, the following decorators are now no
longer needed and have been deprecated:

- `@xtype_handler`: Was used to register classes for discovery, which is
  now done by the metaclass.
- `@attr_equal`: This overwrites the `__eq__` method to compare against
  an attribute. Now handled by the `eq=...` class keyword argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant