Bugfixes
- Fix issue with the primitive type JSON serialization (Thanks @filippomc for raising the issue).
Features
- Add new JSON options to register a special encoder/decoder for
JsonResource
(Thanks @ewoudwerkman for the suggestion). - Add possibility to "reaffect"
EStructuralFeatures
that are collections. This implies that considering a referencemyref
for an instanceobj
, thenobj.myref = [*instances]
is not allowed. The collection is not replaced per-say, but the collectionmyref
is emptied, and the elements of the collection on the right-side of the affectation are inserted in themyref
collection.
Bugfixes
- Fix issue with JSON resources not using
to_string(...)
forEDataType
instances (Thanks @ewoudwerkman for the issue). - Fix issue with multiple re-loading and writing of a resource in the same target file (Thanks @arrys for the issue and the case study).
Miscellaneous
- Deprecate Python 3.7 (needs a special version of
lxml
) - Fix/update english of the README.rst (Thanks @arrys for the pull request)
En memoria de Rosa Nallely Murillo Vazquez (03/12/2023) quien fue una investigadora muy creativa, una increíble química, y tuve suerte de ser su esposo.
Features
- Add json resource in global registry. The json resource is now registered by default, it's not necessary anymore to explicitly register it
- Add argument passing to
Resource
instances from aResourceSet
. This feature allows the user to pass arguments to a resource when usingget_resources
orcreate_resources
from aResourceSet
.
Bugfixes
- Fix issue with file protocol starting with
file:/
(Thanks @jameswpm for the ticket and the discussion). - Fix deserialization of boolean in json resources.
- Fix enum literals serialization in json resources. Depending on the "level" where's defined the EnumerationLiteral, the serialization should be different: (1) if serialization happens at the metamodel level, all the internal information of the EnumerationLiteral should be written in the json file, (2) if serialization happens at the model level (a model uses a literal defined in the metamodel it conforms to), the EnumerationLiteral should be serialized only by its name.
Miscellaneous
- Pass from "beta" to "stable".
- Add pypy 3.9 and 3.10 as target test Python VM.
- Fix CHANGELOG.rst.
Bugfixes
- Fix Elements not loaded in to
EList
. - Update ResourcePython for CVE-2023-37271.
Bugfixes
- Fix issue with serialization of references in JSON for static metamodels.
- Fix issue with the serialization of
EEnum
in JSON. - Fix issue with the computation of
eResource
for static metamodels.
Features
- Add support for
EGeneric
super types. The support is only for dynamic metamodels right now, right now, it misses a way of encoding/generating them in the static metamodel (if they are dynamically added to a staticEClass
, it will work though). - Add alternative MRO computation in some cases. The inheritance tree in some ecore file cannot be mapped on a normal Python inheritance tree, even after reordering (or it requires a more complex reordering). This patch simply provides a new mro computation if such a case is found. The patch activates itself if needed, in almost all normal cases, it will be disabled.
- Add attribute handling in
DynamicEPackage
. - Add support for item deletion in ordered sets.
- Add preservation of order for XMI/JSON serialization and deserialization. This means that successive serialization/deserialization of a resource without modification will always yield the same result. If a modification is performed in the resource, then saved, a simple textual diff between the old XMI/JSON and the new one will only higlight the modification. Thanks @ubmarco for the suggestion.
Bugfixes
- Fix issue with (de)serialization of references in JSON.
- Fix missing f-string in JSON resources. Thanks @pablo-campillo for the pull request.
- Fix
URI.relative_from_me
method for resources (de)serialization. Thanks @jamoralp for the pull request. - Fix missing import of
chain
. Thanks @ubmarco for the pull request.
Miscellaneous
- Drop Python 3.5 support.
- Some performance improvement.
Bugfixes
- Fix bad deserialization of float values in JSON for value like "42" (no dot). Thanks @pablo-campillo for the issue.
Bugfixes
- Fix issue with serialization of multiple empty strings.
- Fix relative HttpURI computation.
- Add inheritance mix for static/dynamic metaclass.
- Fix issue with moving object from resource root to object back and forth.
Miscellaneous
- Add better pythonic implementation of "behavior".
- Add more detailed messages for XMI deserialization.
- Pass to full f-strings.
- Add cache for resources.
Features
- Add listeners on resources. A listener can be added on a resource to be notified of all the modifications performed on objects of its hierarchy.
- Add new
container
attribute onEReference
that indicates if a reference is a container (it owns an opposite which is a containment).
Bugfixes
- Fix issue with
xmi:type
andxsi:type
for mixed XMI. In some XMI files, the field related to type can be mixed and sometimes prefixed byxmi
orxsi
. The flip-flop between the two mode was only performed once in the previous algorithm, now it is adaptive. Thanks @aacebedo for the pull request. - Fix missing
EShortObject
. Thanks @aacebedo for the pull request. - Fix MRO problem when updating inheritance. The previous algorithm was not taking into account dynamic additions of inheritance relationship. Thanks @mn3mos for the issue.
- Fix issue on metamodel with
@abstract
decorator. - Fix issue with
EEnumLiteral
serialization for JSON resource. Thanks @jinhu and Marc Hamilton for the issues and the pull request. - Fix issue with clearing non unique collections. A set operation was performed on the collection to safely iterate on it, implying that some elements were forget during a full clear. Thanks @ewoudwerkman for the issue.
Miscellaneous
- Improve slightly runtime typechecking performances.
- Improve collection speed.
- Improve eType computation for speed.
- Disabling resolve cache for resources when a resource had been properly load. Thanks @ewoudwerkman for the suggestion.
Bugfixes
- Fix issue with MRO calculation. This happend when the Ecore inheritence tree is not compatible with Python C3 linearization algorithm. Thanks @mn3mos for the issue.
- Fix non-serializable
EDataType
instanceClassName
. The property was not serialized by the XMI resource. Thanks @4ekin for the pull requests.
Bugfixes
- Fix issue with new
ordered_set
version. This new version removed some
parts functions about iterables. Thanks @fgro93 for the issue.
Bugfixes
- Fix issue with default value computation using
defaultValueLiteral
. PyEcore
was providing it's own "default value" mechanism that had an higher priority than the one usually used by EMF. This resulted in the default value not being computed correctly. Thanks @annighoefer for the PR and pointing out the issue.
Bugfixes
- Fix issue with xmi ecore supertype references. When an ecore model has two elements A and B and that B inheriths from
A which is another element in a second ecore model, then, as their name are equivalent, the resolution could, sometimes have problems in resolving the elements, mistaking A from the first ecore with A from the second one. In the case the wrong ecore was referenced, it implied a circular reference for inheritency that caused the ecore file loading to fail.
- Fix issue with weird URI (
plateform:/
). Weird uri that does not contains://
provoques problems in the
automatic object resolving. This fix avoid that the relative uri computation adds the relative path to the external uri it tries to resolve.
- Fix issue with computation of
many
feature. The "algo" used to compute themany
feature was wrong and introduced non-logical behavior when a reference or an attribute was having its lower and upper bound set to a same value higher than0
(e.g.:2..2
).Thanks
@jorensips for the issue.
Bugfixes
- Fix issue with
None
object serialization for containment features. This happened when aNone
is explicitly written in a containment reference and theXMIOptions
for default value serialization is activated. In that case a specialnil
object was supposed to be written, but it was not the case here.
Bugfixes
- Fix change of container of an objet when the reference is single.
Thanks @annighoefer for the fix! The issue came when an object was moved from a single relationship container to another one from the same class, the contained object was contained by the two containers.
- Fix Fix root element id not added to uuid_dict if its feature.ID is set.
Thanks @ewoudwerkman for the fix!
The root node's ID
was not referenced in the uuid_dict
even if the root node had the ID
feature set.
Bugfixes
- Fix XMI serialization compatibility when a proxy to a metaclass is used (typically when a metamodel reference another).
Thanks @stefanq for the simple demo/example/test!
Miscellaneous
- Remove
issubclass
patch, the new version remove this requirement and still assure the same behavior.
Features
- Add an
URIConverter
to transformURIs
to custom ones (Thanks
@ewoudwerkman for the issue and the
pull requests!).
Each new converter can be isolated by ResourceSet
or globaly for every
Resource
.
Bugfixes
- Fix empty valued id attributes to be used as keys in reference links when saving a resource (Thanks @annighoefer!).
Miscellaneous
- Remove dependency on deprecated defusedxml.lxml
Bugfixes
- Fix EDate serialization (Thanks @ewoudwerkman!).
This patch provides a solution to the issues with time zone information in dates. It makes the parsing and serialization of dates compatible with how EMF currently handles dates and UTC offsets.
- Fix xmi empty references refer to root (Thanks @annighoefer!).
Deleted objects that were also referred by non-containment references elsewhere were serialized in xmi as ref="", introducing a BadValueError when loading the file again as the root of the model was found as reference. The fix solves the loading issue by skiping empty references.
Miscellaneous
- Add custom JSON serializer support
(Thanks @rodriguez-facundo and @filippometacell!) This support is not yet documented and will perhaps never be.
Bugfixes
- Fix enumeration literal addition as attribute. In the case literals where
added to an enumeration using the 'eLiterals' collection, this implied that
the
EEnum
instance was not updated with the required instance attribute. This new implementation uses a listener to catch additions that are made to the enumeration in order to either add or remove instance attributes. - Fix issue with XMI serialization for single element container. In those cases the path towards the object was not well serialized. It results in a false XMI path which made the produced XMI not usable with Eclipse EMF. (Thanks @annighoefer!)
- Prevent
id
with spaces from being used. Spaces are used for separating multiple references to other objects. (Thanks @annighoefer!)
Miscellaneous
- Improve error message for
BadValueError
exception.
Features
- Add first support for
EGenerics
. This implementation is currently incomplete as it is not possible to express dedicated types for instances. This capability will be added in future versions. The current version is able to catch only a part of the generic semantic, but at least it does not prevent from opening files and models that uses them (it should not). - Add new XMLType metamodel generation. This new version makes a better use of derived collections and fixes some oddities of the previous one.
- Add first implementation of
allInstances()
method onEClass
instances. This implementation can still benefits from some optimizations. TheallInstances()
method is working by keeping track of all created PyEcore objects in aWeakSet
. This set is then crossed and each matching instances are returned as a generator.
Bugfixes
- Fix missing
EGenericType
features likeeTypeParameter
. These attributes were missing from the Ecore metamodel leading to errors when ecore models using them were deserialized. - Fix collection reaffectation. These kind of reaffectation (e.g:
x.foo = y.bar
, wherefoo
andbar
areEStructuralFeature
instances) now raises and error. The previous implementation could cause side-effects which were hard to anticipate. - Fix bad format for
EDate
. The old format that were parsed and produced by PyEcore was not EMF-Java compatible. This new implementation is using the iso format which seems to be the one used by default by EMF.
Miscellaneous
- Add context manager to unpatch the
issubclass
builtin function. - Add
alias
function to inject alias features that have reserved names.
Features
- Add URI mapper like support. This mapper allows you to map a new URI or an
URI start that can be later resolved if required. The typical use case is When
dealing with Eclipse XMI where there is some
plateforme://xxx/yyy
uri. - Add
iD
attribute support forEAttribute
in XMI serialization. This feature ensure that if anEAttribute
is defined in anEClass
with itsiD
attribute set toTrue
, then, this attribute value will be used in the XMI serialization in order to save the reference towards the element. However, if anxmi:id
is set to the element, the reference will use this xmi id no matter what. - Add safe compilation of generated
EOperation
usingRestrictedPython
(Thanks @CFAndy). The compilation of generated method is now performed using a 'safe' context. Even is the current generated code does not use special methods or functions, in future version, it is planed that PyEcore will be able to fetch behaviors that could be directly added to the.ecore
.
Bugfixes
- Fix issue with resolved fragment in resource when loading it. This bug was
affecting resources with crossrefs towards different resources but whith the
same fragment (eg:
my-uri1#//A
andmy-uri2#//A
). In this case, the first resolved fragment were always returned, even if it was said as part of another resource. - Add missing registration of
ELong
datatype. - Fix issue when an object is moved to another container. An issue was occuring when an object moved from a container to another container. Currently, the object properly saw that it moved to another container, but the container collection/attribute was not aware that the object migrated to another container.
Miscellaneous
- Use a common 'uuid format' for XMI resources (easily overrideable).
- Switch from 'collection' to 'collection.abc' for Python 3.7.
- Update documentation fixing missing
eType
in example.
Bugfixes
- Fix out of sync XMI/JSON serialization (Thanks @CFAndy).
When multiple XMI/JSON are serialized at the end of a program, some files are
not serialized properly. To avoid this behavior, a flush of the produced file
is performed at the end of the
save()
method for eachResource
.
Bugfixes
- Fix Json resource deserialization for primitive collections (Thanks @afonsobspinto). The Json deserialization
was always assuming that when a collection was found in the Json, it always
was a collection of
EObject
whereas they could also be primitive values.
Miscellaneous
- Add some performance improvements in resources deserialization.
Bugfixes
- Fix issue with URI spliting during json deserialization.
- Fix issue with redundant attributes in json format (Thanks @TerryKingston!). Having redundant attributes for opposite containment relationship in the json serialized resource introduced the installation of a new proxy instead of the proper object resolution.
Miscellaneous
- Add performances improvement in json deserialization.
Bugfixes
- Fix issue with the new version of the
ordered-set
dependency. The new version introduces a change in the way the sublist returned from a slices is managed. The fix proposed in PyEcore introduces a patch for theOrderedSet
class that proposes the same behavior from the new version while letting the opportunity to change it when subclassingOrderedSet
.
Bugfixes
- Fix issue with empty strings in XMI for 'many'
EAttribute
.
Features
- Add support for
tag
attributes in XMI. - Add
URI
change support forResource
. - Add patch for
issubclass
so the test works regardless the input parameters areEClass
instances or not. - Add
xsi:schemaLocation
deserialization support.
Bugfixes
- Fix bad containment feature value for
contents
onEAnnotation
. - Fix resource resolving for non-trivial
URI
. - Fix bad crossreferences serialization for "many" features (collections).
- Fix issue for strings serialization in 'many'
EAttribute
. Issue where happening when whitespaces were in a String for 'many'EAttribute
.
Bugfixes
- Fixed
many
faulty computation in cases whereupper == lower > 1
. This case is not very common, but it could occurs. - Fixed missing deserialization for
EDate
datatype. The missing method on resulted in a badstr
object conversion leading to an exception as the adatetime
object was expected instead of astr
.
Miscellaneous
- Improve
many
derived attribute computation, resulting in performance improvements. - Add performance improvement tweaks.
- Move
dispatch
frompyecore.dispatch
topyecore.utils
Features
- Add
dispatch
decorator to mimic thedoSwitch
from EMF. This implementation relies on the use of thesingleDispatch
decorator and does not include aComposedSwitch
equivalent as some restrictions from EMF are no longer an issue in Python.
Bugfixes
- Fixed
lower
andupper
derived attributes computation. The previous implementation were considering the attributes as normal ones instead of derived ones. - Fixed merge issue during
0.8.0
release. A case test was not properly working, and models which have crossref towards models that were using UUID raised an exception.
Miscellaneous
- Improved performances of the
many
derived attribute.
Features
- Add first support for
EDerivedCollection
. The derived collections are obtained from many features that are also marked as derived. A derived collection does not stores nor gets direct information, instead it fetches information from other collection, compute a result and store it. In the realisation, a derived collection will inherits from a generic derived collection that only proposed an empty implementation. Then, the implementation must be manually added. - Add multi-root support for XMI and JSON resources. XMI and JSON with multiple
roots can now be serialized and deserialized. Their handling is pretty
transparent as the addition of a new root goes through the
append(...)
method. - Add a
remove(...)
method on resources. This method is pretty much the opposite of theappend(...)
method on resources, it simply remove a root from the resource.
Bugfixes
- Exception when a wrong type value was inserted in a reference for generated
code. The call to the
EcoreUtils.isinstance
method were raising an exception as the last part of the code tries to deal with an unexisting methods from the generated class. - Fix
EProxy
'force resolve' for static metamodels. When a proxy is set towards a static metaclass, the proxy resolution tries to handle the inverse reference list which only exists in the.eClass
"level". Consequently, when a static metaclass is used, the correspondingEClass
instance must be used.
Miscellaneous
- Add new module for basic values and collections. This module contains the
ECollection
andEValue
classes. These class were formerly in theecore
module, but due to further development, it is better to have it into a dedicated place. This modification is retrocompatible and invisible for existing manual/generated code.
Features
- Add xmi option for default value serialization. This new option allows to save the default value in the produced XMI, and it also gives the ability to store attribute set to None as xsi:nill="true" field.
Features
- Add href uuid (de)serialization for XMI. This new features allows the XMI for having href that directly uses the uuid of the target element.
Bugfixes
- Fix nsmap computation for heteroneous models with crossrefs. When crossrefs are serialized in XMI, they need to add the referenced namespace at the root of the XMI. This fix adds these namespace and their related prefixes.
Bugfixes
- Fix bad
EAttribute
decoding for XMI root element. By default, each field of an XMI root were decoded as strings instead of making use of thefrom_string(...)
method from the type of each attribute. This case is not very common, but could still occur.
Features
- Add option for specific XMI "type" field serialization. XMI uses a special
field to encode the type of the element. This field is almost always named:
xsi:type
, but in some cases,xmi:type
is used instead. To deal with such cases, an option is now available:XMIOptions.OPTION_USE_XMI_TYPE
.
Bugfixes - Add missing 'type' field for XMI href serialization. The 'xsi:type' field is required when a crossreference is serialized. This field is used to check if the resolved resource has the right type (not really, but it help). This field is kinda optional at the moment for PyEcore, but required for Java-EMF, otherwise the EMF will not be able to create the right proxy for the crossreferenced resource.
Features
- Add missing
eAllAttributes()
method for retriving alleStructuralFeatures
that areEAttributes
.
Bugfixes
- Fix issue with double notification for x..1--x..* opposite references. When a relationship with an eOpposite involving a x..1 and a x..* relationship, in case the x..1 was set, the x..* opposite update was doing a "double set", thus throwing two times the notification.
Bugfixes
- Improve
EClass
dynamic modifications. The__init__
method of theEClass
was responsible for the registration of an 'eternal_listener' (a listener that cannot be removed. In case theEClass
instance was created using__new__
then using__init__
to set some values in the parameter, the listener was registered after the set of some values. This implies that some modifications (name modification for example) couldn't be took into account in the method that sync the python class with theEClass
instance.
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 aNone
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.
Features
- Add easier way of dynamically add behavior to
EClass
. This features adds the ability to register function to existing dynamic and staticEClass
.
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.
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 likelru_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, theeClass
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 anEENum
is computed from the first element in theeLiterals
. The change of adefault_value
is performed by 'reordering' theeLiterals
list.
Bugfixes
- Refactor
EProxy
implementation. The newEProxy
implementation get rid of theEPlaceHolder
class that was used for bad reasons. Now, anEProxy
inherits from anEObject
. As a side-effect, this also fixes an issue in the JSON serialization:EProxy
were not resolved, and, consequently, aResource
withEProxy
inside was not serializable. - Remove Ecore metamodel from a Resource. Each metamodel registered in a
ResourceSet
or theglobal_registry
should not be part of aResource
. The fact that they are registered in aResource
implies that they are part of the same level than theResource
which is serialized. However, they are part of something "greater". - Add special deserialization method for
EEnum
. The basic deserialization method forEEnum
instance was the same than the one forEDataType
. They only takes the string and put it in the feature instance. Instead, when a string is found for anEEnum
feature, theEEnumLiteral
must be searched. This newfrom_string
implementation just does this.
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 rootEPackage
uri with theEClass
uri fragment were badly formed. - Fix calls in
XMIResource
andJsonResource
forURI
handling. This new way of calling anURI
input/output stream creation enables a simpler creation of new dedicatedURI
. As example, aStringURI
is added in theREADME.rst
.
Miscellaneous
- Change the usage of
MutableSequence
forUserList
instead, reducing some boilerplate code. - Add missing
@staticmethod
when required.
Features
- Add
XMLTypes
implementation. This first implementation relies onXMLTypes.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 someEClass
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 oninsert
andpop
and currently does not supportslices
. - 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 forEObject
attributes/references. The support for thedel
keywords is only activated onEStructuralFeature
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
onEObject
. The functiondir()
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 dynamicEClass
. 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 theMetaEClass
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 fromEObject
, the decorator makes the defined class inhertit fromEObject
. - 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 anEObject
. The JSON format used for serialization tries to be closed to the format from the emfjson-jackson project.
Bugfixes
- Fix missing
EDatatypes
registration in their respectiveEPackage
. The data types defined in code generated by pyecoregen was not properly registered in theirEPackage
. The result was aNone
value whendatatype.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 defaultOrderedSet
implementation does not provide methods forinsert
andpop
. 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 foreParameters
relation. This missing attribute was reslting in the placement of eachEParameter
at the root of the model instead of theEOperation
they were linked to.
Miscellaneous
- Change
__repr__
display forEClass
andEStructuralFeature
. The fact that PyEcore is extensible and the basicEClass/EStructural
metaclasses can be extended requires a better representation. - Add
__name__
attribute on instances ofEClass
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 aneClass
attribute. This modification will prepare the work for the introduction of a new method for generating staticEClass
. - Add missing
super().__init__()
call in base classes. This missing statement could be an issue for multiple inheritance. - Add better support for
**kwargs
inEObject
constructors. - Improve performance. As attribute are accessed in a lazy-loading way, there is no more need for post object creation initialization.
Features
- Add multiplicity parameter for
EParameter/EOperation
constructors. Parameter and Operations can express a multiplicity like1..*
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
. Theisinstance
method from theEcoreUtils
class was not very effective and was gathering all cases in a bigif/elif/else
block. This commit defers all theisinstance
to a method__isinstance__
, implemented in each required elements. This commit also introduce a new way of init for eachEStructuralFeature
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 theResourceSet
. This search was done in a 'file' like only researched, while the uri could be a logical one (for theplateform:/
like uri). - Fix missing
name
feature validation. The name feature was only handled as a simple python attribute instead of an EAttribute. This time, thename
feature is handled as anEAttribute
. As each instance ofEAttribute
needs to use its own name (which is anEAttribute
), it is required to cut the recursive call. To do so, theEStructuralFeature
listen to each changes performed on itself. If a modification occurs on thename
feature, it keeps a simple python attribute version which can be used in theEStructuralFeature
descriptor.
Bugfixes
- Add missing
iD
feature forEAttribute
. In EMF, theiD
feature can be se forEAttribute
. This attribute was missing from the pyecore metamodel. This new version also adds theiD
keyword for theEAttribute
constructor. - Add missing basic
EDataType
. The addedEDataTypes
are: EDate
,EBigDecimal
,EBooleanObject
,ELongObject
,EByte
,EByteObject
,EByteArray
,EChar
,ECharacterObject
,EShort
,EJavaClass
.
- Add missing basic
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 themaxsplit
option from thesplit()
method. - Fix issue when
name
feature was called as part of descriptor. This error was simple, thename
feature defined as a static meta-attribute of theENamedElement
metaclass was overriding the property implementation in theEStructuralFeature
. This issue was also preventing from properly monkey patching pyecore forname
access.
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.
Bugfixes
- Fix default value for
EAttribute
.EAttribute
let the ability to express default values. This value is assigned when anEClass
instance is created. Thedefault_value
is computed as follow: if theEAttribute
'sdefault_value
is set, thisdefault_value
is returned. If the default_value of theEattribute
is not set, then thedefault_value
of theEAttribute
associated EDataType is set. This way of computing elements was not properly used during instance initialization.
Miscellaneous
- Fix some examples in the
README.rst
.
Features
- Add missing
EDataType
management in the Acceleo generator.
Miscellaneous
- Add missing data type conversion for
EDataType
. - Fix once and for all the
setup.py
(hopefully).
Bugfixes
- Fix
__update()
method inEClass
when many elements are added at once. This case occurs whenappend()
is used on anEClass
in order to add manyEStructuralFeature
. - Fix shared content for mutable
EDataType
. When mutable EDatataypes are defined (e.g:EStringToStringMapEntry
), each default value was pointing to the same shared value (exactly the same thing that whendef x(self, n={})
). The default_value is now computed, if a special attribute is set, the default value is always created as a new empty value. - Fix default value for property instances accessed after the instance creation.
Miscellaneous
- Add missing
EFeatureMapEntry
. - Add missing LICENCE file in dist package.
- Add default value managmeent for 'instanceClass' derived datatypes.
Features
Add new static metamodel generator (@moltob contribution, thanks!). The generator, named pyecoregen, is written in full Python/Jinja2 using pymultigen a framework for multiple files generation. The generator usage is prefered over the MTL/Acceleo one as it can be launched from the command line directly and does not requires Java or Java-dependencies to run. The generated code is also automatically formatted using the
autopep8
project.Add EMF command support. The EMF command support gives the ability to represent actions that modify the model as single or composed modification command. There is 5 existing commands: * Set, * Add, * Remove, * Delete, * Compound.
Each command affects the model in a certain way. The main advantage of using commands over direct modification is the fact that each of these commands can be undo/redo.
Add Command Stack support. The Command stack gives the ability to easily schedule the execution of each commands. It also gives a simpler access to the undo/redo function of each commands and ensure that they are played/re-played in the right order.
Bugfixes
- Fix handling of 'non-required' parameters for
EOperations
. When a parameter is set as 'non-required', the Python translation must consider that the parameter is defined as an optional named parameter. - Fix issue with the computation of some internal properties for the
delete()
method (the_inverse_rels
set). The current algorithm keep track of each inverse relationships, and when an element is removed, the old record is deleted while a new one is added to the record set. The bug was affecting the registration of the new record during the deletion of the old one. - Fix
__update()
method inEClass
when an object deletion occurs. The update method deals with notifications to add/remove elements on the fly from the listened notification. When a REMOVE was notified, the wrong notification property was accessed resulting in aNoneTypeError
exception.
Miscellaneous
- Add
getEAnnotation()
method onEModelElement
. - Change 'getargspec' by 'getfullargspec' as it seems that 'getargspec' is deprecated since Python 3.0 and replaced by 'getfullargspec'.
- Add some performance improvements.
- Add missing
pop()
operation forEList/EBag
. - Monkey patch
insert()/pop()
methods inOrderedSet
. - Add missing
@staticmethod
when required. - Add missing
*args
and**kwargs
to the meta-instance creation inEClass
. This addition allows the user to create it's own '__init__' method for dynamic metaclasses using some trickery.
Features
- Add new class to ease dynamic metamodel handling. The dynamic metamodel manipulation is a little bit cumbersome when it comes to extract all the existing EClass from a loaded EPackage. A new class is provided: 'DynamicEPackage' which constructs, using reflection, an object that has direct references to each EClass/sub-EPackage by name. This greatly helps the user to easily call and get EClass from a freshly loaded dynamic EPackage.
Bugfixes
- Fix missing double notification raised for eopposite references. When an eopposite reference were set, the notification system were called three times: one for the main feature (the feature on which the add/remove/set/unset have been made by the user) and two for the eopposite. The first eopposite notification were normal, but the second one was a residual notification sent by the algorithm. This new commit simply removes the extra-notifications and adds new tests to detect these issues.
Miscellaneous
- Add better semantic differentiation for
EBag
andESet
collections. - Add slicing support for
EList
. - Add missing
ordered
andunique
parameters forEAttribute
.
Features
- Add new static metamodel code generator (@moltob contribution, thanks!). The new generator gives more flexibility to the user as it allows the direct assignment of attributes/references values from the constructor. The feature reduces the amount of LOC required to create a fully initialized instance and also helps for the instance creation as IDE smart-completion feature can propose the attributes/references to the user.
Miscellaneous
- Fix some PEP8/Pylint refactoring and docstrings.
- Small performance improvement in the
EcoreUtils.isinstance
.
Bugfixes
- Fix missing types from Ecore (@moltob contribution, thanks!). These types are
the E*Object types for numbers. The modification had been done in the
ecore.py
file as these are default Ecore types and not XML types (or coming from another EMF lib). This commit increases the compatibility with existing.ecore
files.
Features
- Add support for object deletion in PyEcore. The delete feature allows the user to remove parts of the model. Those parts can be a simple element or a sub-graph if a container object is deleted. The delete tries to keep up to date a special list that gathers the non-inverse navigable relation. When called, the method gathers all the EReferences of the object to delete and these special relations. It then update the pointed references. There is a special behavior if the object to delete is a proxy. If unresolved, the proxy can only be removed from the main location, but not from the remote one. If resolved, the proxy keep the classical behavior. This behavior tries to match the EMF-Java one: https://www.eclipse.org/forums/index.php/t/127567/
Bugfixes
- Fix double resources loading in same
ResourceSet
. When twoget_resource(...)
call with the same URI as parameter were done in the sameResourceSet
, two different resources were returned. The new behavior ensure that once the resource had been loaded, a second call toget_resource(...)
with the same URI will return the resource created in the first place.
Miscellaneous
- Make use of
ChainMap
forglobal_registry
management (simplify code). - Raise a better exception when a 'broken' proxy is resolved.
- Add small performances improvement.
Features
- Add support for object proxies. The PyEcore proxy works a little bit differently from the Java EMF proxy, once the proxy is resolved, the proxy is not removed but is used a a transparent proxy (at the moment) and is not an issue anymore for type checking. Proxies are used for cross-document references.
- Remove resource-less objects from XMI serialization. This is a first step towards objects removal. The added behavior allows the user to "remove" elements in a way. If an element is not contained in a resource anymore, the reference towards the object is not serialized. This way, anytime an object is removed from a container and let 'in the void', XMI serialization will get rid of it. However, this new addition requires that the Ecore metamodel is always loaded in the global_registry (in case someone wants to serialize ecore files) as a metamodel can references basic types (EString, EBoolean) which are basically not contained in a resource.
Bugfixes
- Fix bug on EStructuralFeature owner assignment when EClass is updated.
Bugfixes
- Only the default
to_string
method on EDataType was called, even if a new one was passed as parameter. The issue was a simple typo in the__init__
method. - The EBoolean EDataType was missing a dedicated
to_string
method. This issue introduced a 'desync' between XMI that EMF Java can read and PyEcore. In cas of EBoolean, the serialized value was eitherTrue
orFalse
which is not understood by Java (onlytrue
orfalse
, lower case).
Features
- Improved performances on big files deserialization (2x faster). This new
version relies on descriptor instead of
__getattribute__/__setattr__
. The code is not more compact, but more clear and split. - New static metamodel generator, producing code related to this new version.
- Add XML type transtyping in the static metamodel generator.
Bugfixes
- When an
eOpposite
feature was set on an element, the actual opposite referenceeOpposite
was not updated. - Subpackages managements for the static metamodel generator. The
eSubpackages
andeSuperPackage
variables were not placed in the package, but in the module.
Miscellaneous
- Update bad examples in the README.rst
Project State
- First full working version