Pyecore

Latest version: v0.15.2

Safety actively analyzes 701868 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 8 of 11

0.7.0

+++++++++++

**Features**

- Add ``XMLTypes`` implementation. This first implementation relies on
``XMLTypes.ecore`` and had been generated using pyecoregen. The generated code
had been manually modified to deal with some current restriction in PyEcore.
The result is a slightly modified version of some ``EClass`` defined in the
xml types metamodel. These modifications does not affect the model layer which
will work as intended, but can give some false information about some types
when reflection on the xml types metamodel is used.

- Add very basic EMF Editing Domain implementation. This simple implementation
allows the user to create/load a resource and to execute/undo/redo commands
that implies element from a resource contained in the Editing domain's
``ResourceSet``. This implementation will evolve by probably adding read only
resource support and copy/paste functionnality.

- Add basic support for ``OrderedSet``'s' ``__setitem__`` method. This very
simple implementation relies on ``insert`` and ``pop`` and currently does
not support ``slices``.

- Add ``__iadd__`` support for collections. This little addition allows you to
add elements to PyEcore collections using ``+=``. This operator also works
for single element as right operand.

- Add ``del obj.attr`` support for ``EObject`` attributes/references. The
support for the ``del`` keywords is only activated on ``EStructuralFeature``
instances. It allows to clean references on elements for a given object.
**WARNING:** this action does not delete the pointed object, it only clears
the reference/collection from the calling element towards the objects.

- Add support for ``dir`` on ``EObject``. The function ``dir()`` now gives a
sum up of all the attributes/references and operations that can be called on
an object. This is really handy when PyEcore is handled in the Python console.

- Add ``**kwargs`` support for dynamic ``EClass``. This allows to have more
fluent constructors. It is important to note that the default behavior when
a named parameter are used is to set the attribute to the value passed as
parameter. Also, ``args`` are accepted, but they are not directly handled.

- Add new class decorator for PyEcore metaclass definition. This new decorator:
``EMetaclass``, uses the ``MetaEClass`` metaclass and provides a convenient
way of defining static EClass. This decorator also reoder the inheritance
tree so, if the defined class does not inherits from ``EObject``, the
decorator makes the defined class inhertit from ``EObject``.

- Add JSON resource serializer. The JSON serializer is able to get an
``EObject`` and serialize it in JSON. It can also takes a JSON representation
of a model, and transform it as an ``EObject``. The JSON format used for
serialization tries to be closed to the format from the
`emfjson-jackson <https://github.com/emfjson/emfjson-jackson>`_ project.


**Bugfixes**

- Fix missing ``EDatatypes`` registration in their respective ``EPackage``. The
data types defined in code generated by pyecoregen was not properly registered
in their ``EPackage``. The result was a ``None`` value when
``datatype.ePackage`` was accessed.

- Fix resource creation if model loading fails for ``ResourceSet``. Even if the
model loading fails, a resource is created in a ResourceSet. This behavior
was problematic as two successive loading of the same faulty model lead to a
failure the first time, but to a success the next time. This commit fixes
this behavior and adds more tests to detect possible regressions about this.

- Fix load error when metamodel prefix is empty. When a metamodel prefix is
empty, special tags, with the namespace encoded inside, are created by lxml.
This was an issue with the xmi loading method as each tag's node was not
properly decoded.

- Improve OrderedSet ``insert/pop`` methods. The default ``OrderedSet``
implementation does not provide methods for ``insert`` and ``pop``. The
current code provided by PyEcore, monkey patching the library, was mixed
with internal PyEcore code. This new implementation split the two concerns
and proposes a better way of dealing with these two methods.

- Fix missing ``containement`` attribute for ``eParameters`` relation. This
missing attribute was reslting in the placement of each ``EParameter`` at
the root of the model instead of the ``EOperation`` they were linked to.

**Miscellaneous**

- Change ``__repr__`` display for ``EClass`` and ``EStructuralFeature``. The
fact that PyEcore is extensible and the basic ``EClass/EStructural``
metaclasses can be extended requires a better representation.

- Add ``__name__`` attribute on instances of ``EClass`` so they look a little
bit more like a python class.

- Improve inheritance tree building for static ``EClass``. This new detection
relies on the fact that an existing EClass already have an ``eClass``
attribute. This modification will prepare the work for the introduction of a
new method for generating static ``EClass``.

- Add missing ``super().__init__()`` call in base classes. This missing
statement could be an issue for multiple inheritance.

- Add better support for ``**kwargs`` in ``EObject`` constructors.

- Improve performance. As attribute are accessed in a lazy-loading way, there
is no more need for post object creation initialization.

0.6.0

+++++

**Features**

- Add multiplicity parameter for ``EParameter/EOperation`` constructors.
Parameter and Operations can express a multiplicity like ``1..*`` if wanted.
This attribute can be modified after one of these object had been created,
but it wasn't possible to give the multiplicity during the object creation.
This commit simply add the missing parameters in the constructors.

- Add new way of dealing with ``isinstance``. The ``isinstance`` method from
the ``EcoreUtils`` class was not very effective and was gathering all cases
in a big ``if/elif/else`` block. This commit defers all the ``isinstance``
to a method ``__isinstance__``, implemented in each required elements. This
commit also introduce a new way of init for each ``EStructuralFeature``
attributes when an instance is created.

**Bugfixes**

- Fix intra-document references by proxy. A reference between elements can also
be done using a 'full' URI, i.e: specifying the uri/path of the resource to
access and the path towards the object. This way of referencing elements is
not reserved to metamodel references, but can be done with any kind of
references. To deal with this, a proxy is introduced each time such a
reference is done. This allows to relies on the same mechanism as the href
one and gives a better control over their resolutions.

- Fix ``ResourceSet`` local resource resolving. When a local resource is searched,
the path and its uri is split. Once the uri is split, its path is searched in
the 'resources' of the ``ResourceSet``. This search was done in a 'file' like only
researched, while the uri could be a logical one (for the ``plateform:/``
like uri).

- Fix missing ``name`` feature validation. The name feature was only handled as
a simple python attribute instead of an EAttribute. This time, the ``name``
feature is handled as an ``EAttribute``. As each instance of ``EAttribute``
needs to use its own name (which is an ``EAttribute``), it is required to cut
the recursive call. To do so, the ``EStructuralFeature`` listen to each
changes performed on itself. If a modification occurs on the ``name`` feature,
it keeps a simple python attribute version which can be used in the
``EStructuralFeature`` descriptor.

0.5.11

++++++

**Bugfixes**

- Add missing ``iD`` feature for ``EAttribute``. In EMF, the ``iD`` feature can
be se for ``EAttribute``. This attribute was missing from the pyecore
metamodel. This new version also adds the ``iD`` keyword for the
``EAttribute`` constructor.

- Add missing basic ``EDataType``. The added ``EDataTypes`` are:
* ``EDate``,
* ``EBigDecimal``,
* ``EBooleanObject``,
* ``ELongObject``,
* ``EByte``,
* ``EByteObject``,
* ``EByteArray``,
* ``EChar``,
* ``ECharacterObject``,
* ``EShort``,
* ``EJavaClass``.

0.5.9

++++++++++++

**Bugfixes**

- Fix decoding issue when HttpURI with http-href is used. When a href is used,
the ResourceSet resolver tries to concatenate the path built from the main uri
resource and the href uri fragment. In the case of HttpURI, the concatenation
provided a 'http://abc/http://cde' like uri. The ``normalize()`` method of URI
was spliting on '://' and used unpacking to two vars exactly. With this kind
of uri, it resulted in an exception. This commit fixes this issue using simply
the ``maxsplit`` option from the ``split()`` method.

- Fix issue when ``name`` feature was called as part of descriptor. This error was
simple, the ``name`` feature defined as a static meta-attribute of the
``ENamedElement`` metaclass was overriding the property implementation in the
``EStructuralFeature``. This issue was also preventing from properly monkey
patching pyecore for ``name`` access.

0.5.8

+++++

**Bugfixes**

- Fix issue when multiple undo/redo are performed. Each time an undo is
performed, the command stack top pointer is decremented. It only points to the
command before the last one. Obviously, each time a redo is performed, the
command stack needs to be incremented, and it points to the previously undone
command. The 'redo' method was missing the top stack incrementation.

0.5.7

+++++

**Bugfixes**

- Fix default value for ``EAttribute``. ``EAttribute`` let the ability to express
default values. This value is assigned when an ``EClass`` instance is created.
The ``default_value`` is computed as follow: if the ``EAttribute``'s
``default_value`` is set, this ``default_value`` is returned. If the
default_value of the ``Eattribute`` is not set, then the ``default_value`` of
the ``EAttribute`` associated EDataType is set. This way of computing elements
was not properly used during instance initialization.

**Miscellaneous**

- Fix some examples in the ``README.rst``.

Page 8 of 11

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.