Pyecore

Latest version: v0.15.1

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

Scan your dependencies

Page 7 of 11

0.7.6

+++++

**Features**

- Add options support for JSON serialization. Currently, the only JSON
serialization option that is added is: ``SERIALIZE_DEFAULT_VALUE``. This
option allows the user to serialize feature values that are equal to the
default ones.


**Bugfixes**

- Fix bad default value for ``xxxObject`` data types. These data types (e.g:
``EIntegerObject``) must have a ``None`` default value as they do not represent
the Java boxed type, but their **object** version. This fix introduces a real
difference between boxed types and non-boxed types.

0.7.5

+++++

**Features**

- Add easier way of dynamically add behavior to ``EClass``. This features adds
the ability to register function to existing dynamic and static ``EClass``.

**Bugfixes**

- Fix missing exception when affecting single element to collection. When a
single assignement is done on a collection-kind meta-attribute, an exception
must be raised as the 'attribute' type is, somehow, modified.

**Miscellaneous**

- Improve the ``eResource`` management. This reduces memory footprint, slightly
improves big model serialization, and avoides 'unsync' objects with their
resource.

0.7.4

+++++

**Features**

- Add dedicated method for eclass ref serialization in ``JsonResource``. This
method allows the user to override it if required in order to control a little
bit the way the JSON will be produced. If the users override this method by
providing a new implementation, they also should override the eclass resolve
method. Otherwise, the deserialization of a previously serialized model with
this new implementation will fail. The two methods to override are the
following:

- ``serialize_eclass(self, eclass)``
- ``resolve_eclass(self, uri_eclass)``

Note that for the ``resolve_eclass`` method, the use of a cache like
``lru_cache`` is often a good idea.

- Remove systematic serialization of ``EClass`` reference in JSON serializer. In
some cases where the containing feature type is the same than the serialized
object, the ``eClass`` entry in the JSON resource is not required. This allows
to reduce the resource size a little bit more.

- Change the ``EEnum`` implementation for default values. The default value of
an ``EENum`` is computed from the first element in the ``eLiterals``. The
change of a ``default_value`` is performed by 'reordering' the ``eLiterals``
list.


**Bugfixes**

- Refactor ``EProxy`` implementation. The new ``EProxy`` implementation get rid
of the ``EPlaceHolder`` class that was used for bad reasons. Now, an
``EProxy`` inherits from an ``EObject``. As a side-effect, this also fixes an
issue in the JSON serialization: ``EProxy`` were not resolved, and,
consequently, a ``Resource`` with ``EProxy`` inside was not serializable.

- Remove Ecore metamodel from a Resource. Each metamodel registered in a
``ResourceSet`` or the ``global_registry`` should not be part of a
``Resource``. The fact that they are registered in a ``Resource`` implies that
they are part of the same level than the ``Resource`` which is serialized.
However, they are part of something "greater".

- Add special deserialization method for ``EEnum``. The basic deserialization
method for ``EEnum`` instance was the same than the one for ``EDataType``.
They only takes the string and put it in the feature instance. Instead, when
a string is found for an ``EEnum`` feature, the ``EEnumLiteral`` must be
searched. This new ``from_string`` implementation just does this.

0.7.3

+++++

**Features**

- Performance improvement for JSON deserialization. The use of the ``lru_cache``
enables the JSON resource to quickly identify metaclasses once they are
resolved.

**Bugfixes**

- Fix issue with JSON serializer when multiples subpackages are used. The
``eClass`` relationship, serialized in the form of the root ``EPackage`` uri
with the ``EClass`` uri fragment were badly formed.

- Fix calls in ``XMIResource`` and ``JsonResource`` for ``URI`` handling. This
new way of calling an ``URI`` input/output stream creation enables a simpler
creation of new dedicated ``URI``. As example, a ``StringURI`` is added in
the ``README.rst``.

0.7.2

+++++

**Miscellaneous**

- Change the usage of ``MutableSequence`` for ``UserList`` instead, reducing
some boilerplate code.
- Add missing ``staticmethod`` when required.

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.

Page 7 of 11

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.