-
Notifications
You must be signed in to change notification settings - Fork 12
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
Open
Wuestengecko
wants to merge
6
commits into
master
Choose a base branch
from
class-discovery
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Wuestengecko
force-pushed
the
class-discovery
branch
3 times, most recently
from
October 14, 2024 15:07
ab8e8a6
to
12d008f
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
4 times, most recently
from
October 18, 2024 08:01
bf99b03
to
98e903d
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
3 times, most recently
from
November 14, 2024 09:03
7e13af6
to
e6a3963
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
from
November 14, 2024 11:23
e6a3963
to
1bb1abe
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
3 times, most recently
from
November 18, 2024 13:18
1ca4fa8
to
bb63451
Compare
This was referenced Nov 18, 2024
Wuestengecko
force-pushed
the
class-discovery
branch
from
November 19, 2024 15:05
bb63451
to
2b0b8c2
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
3 times, most recently
from
November 27, 2024 14:12
58ce90d
to
c1cf3c0
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
6 times, most recently
from
December 13, 2024 13:41
c3f5125
to
43f0f85
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
2 times, most recently
from
December 20, 2024 15:55
c3d890c
to
ed5d538
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
2 times, most recently
from
December 23, 2024 10:07
8d3e8d2
to
64b7e6e
Compare
Wuestengecko
force-pushed
the
uv
branch
2 times, most recently
from
December 23, 2024 10:52
5fa9035
to
d2b94dc
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
from
December 23, 2024 10:52
64b7e6e
to
154891f
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
2 times, most recently
from
December 23, 2024 16:56
78fad73
to
e9ea787
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
from
January 6, 2025 10:10
e9ea787
to
291defb
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
4 times, most recently
from
January 13, 2025 17:05
0aec4d1
to
110a0dd
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
from
January 17, 2025 13:09
110a0dd
to
6d2209d
Compare
Wuestengecko
force-pushed
the
class-discovery
branch
2 times, most recently
from
January 24, 2025 16:27
274ef3c
to
4c532a4
Compare
This commit reworks the code that handles 'by_X' style list filtering. The new code can now also filter on attributes that contain lists, where an element matches if a filtering target is contained (or not contained) in the list. Note that the new implementation no longer special-cases Enum PODs for comparison purposes, and instead delegates the string comparison to the enum itself. This special-casing was incomplete anyways, as it wasn't properly accounting for enums being passed in as filter argument. For example, the following call would actually do a string comparison of the enum member's name: mylist.by_kind(ComponentExchangeKind.ASSEMBLY) This also deprecates the use of 'by_type' and 'exclude_types' for filtering on the type of object (i.e. the Python class). These filters collide with the commonly used 'type' attribute, which may link to another model object of interest. Which one of these two options gets used is very non-obvious and can lead to hard to diagnose bugs. Instead, users are advised to use 'by_class' and 'exclude_classes', or the '__class__' attribute for nested filter attributes. For the time until the next major release, 'by_type' will keep the current behavior by automatically translating it to '__class__' where applicable. A UserWarning will be emitted in these cases to inform users about needed actions.
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.
Wuestengecko
force-pushed
the
class-discovery
branch
from
January 24, 2025 16:34
4c532a4
to
9c97c61
Compare
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.
No description provided.