{"action":"created","issue":{"url":"https://api.github.com/repos/wbsoft/python-ly/issues/3","labels_url":"https://api.github.com/repos/wbsoft/python-ly/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/wbsoft/python-ly/issues/3/comments","events_url":"https://api.github.com/repos/wbsoft/python-ly/issues/3/events","html_url":"https://github.com/wbsoft/python-ly/issues/3","id":55459761,"number":3,"title":"Redesigning ly.music","user":{"login":"wbsoft","id":588454,"avatar_url":"https://avatars.githubusercontent.com/u/588454?v=3","gravatar_id":"","url":"https://api.github.com/users/wbsoft","html_url":"https://github.com/wbsoft","followers_url":"https://api.github.com/users/wbsoft/followers","following_url":"https://api.github.com/users/wbsoft/following{/other_user}","gists_url":"https://api.github.com/users/wbsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/wbsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbsoft/subscriptions","organizations_url":"https://api.github.com/users/wbsoft/orgs","repos_url":"https://api.github.com/users/wbsoft/repos","events_url":"https://api.github.com/users/wbsoft/events{/privacy}","received_events_url":"https://api.github.com/users/wbsoft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"wbsoft","id":588454,"avatar_url":"https://avatars.githubusercontent.com/u/588454?v=3","gravatar_id":"","url":"https://api.github.com/users/wbsoft","html_url":"https://github.com/wbsoft","followers_url":"https://api.github.com/users/wbsoft/followers","following_url":"https://api.github.com/users/wbsoft/following{/other_user}","gists_url":"https://api.github.com/users/wbsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/wbsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbsoft/subscriptions","organizations_url":"https://api.github.com/users/wbsoft/orgs","repos_url":"https://api.github.com/users/wbsoft/repos","events_url":"https://api.github.com/users/wbsoft/events{/privacy}","received_events_url":"https://api.github.com/users/wbsoft/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-01-26T09:07:38Z","updated_at":"2015-01-26T13:24:08Z","closed_at":null,"body":"Dear friends, I want to take the lead for redesigning `ly.music`. This issue is to continue the thread at wbsoft/frescobaldi#492, which I'll close.\r\n\r\n`ly.music` currently has two shortcomings:\r\n- it is not easy to build a tree from scratch\r\n- it is not possible to create LilyPond code from scratch (from a tree).\r\n\r\nIt was initially designed to create a tree structure from an existing document, which is done in the `ly.music.read` module.\r\n\r\n@crantila emphasizes on the fact that basing `ly.music` around `xml.etree` or `lxml` would make it much faster as not a python object is created for every single tree item, and we would have powerful search possibilities for free.\r\n\r\nI am willing to design the `ly.music` tree such that it adheres to simple principles, maybe even without creating a class for every type of element.\r\n\r\nWe need the following:\r\n1. build a tree from scratch and have it render a valid LilyPond document from scratch\r\n2. build a tree from tokenized source (from a `ly.document.Document`) and have all tree items know the originating tokens (and thus source position, as every token has the position in the source file in the `pos` attribute)\r\n3. make changes to a tree by changing attributes or adding/removing child nodes\r\n4. deep copy (parts of) a tree\r\n5. when making changes to a tree that was build from a tokenized source, precisely know what changes need to be done to the originating document.\r\n6. fast iteration over the tree and understanding the music, time etc like it is currently. This is currently handled inside the Item class and subclasses, but it should move outside the tree node classes.\r\n7. very quick find the node that is at a certain source position.\r\n8. (if possible) for a tree that is created from tokenized source: update the tree from the position where source text changes without recreating the whole tree.\r\n\r\nFunctions like transpose or translate currently iterate over tokens, but they should operate on the tree in the future, and simply change the tree.\r\n\r\nWhen the tree was built from a tokenized source (i.e. the originating tokens are attached to the tree nodes, while their current value has changed) a dedicated module should be able to find out which changes need to be done to the originating document to have it reflect whatever is changed in the tree. (We won't dump a new LilyPond document because that would bluntly overwrite things that a user might have done different, like whitespace or comments that may or may not be present in the tree, and also that would destroy markings or cursor positions for point-and-click when a document is overwritten inside an editor such as Frescobaldi.)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/wbsoft/python-ly/issues/comments/71459653","html_url":"https://github.com/wbsoft/python-ly/issues/3#issuecomment-71459653","issue_url":"https://api.github.com/repos/wbsoft/python-ly/issues/3","id":71459653,"user":{"login":"wbsoft","id":588454,"avatar_url":"https://avatars.githubusercontent.com/u/588454?v=3","gravatar_id":"","url":"https://api.github.com/users/wbsoft","html_url":"https://github.com/wbsoft","followers_url":"https://api.github.com/users/wbsoft/followers","following_url":"https://api.github.com/users/wbsoft/following{/other_user}","gists_url":"https://api.github.com/users/wbsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/wbsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbsoft/subscriptions","organizations_url":"https://api.github.com/users/wbsoft/orgs","repos_url":"https://api.github.com/users/wbsoft/repos","events_url":"https://api.github.com/users/wbsoft/events{/privacy}","received_events_url":"https://api.github.com/users/wbsoft/received_events","type":"User","site_admin":false},"created_at":"2015-01-26T13:24:08Z","updated_at":"2015-01-26T13:24:08Z","body":"Adding to that, I would like to get rid of the many subclasses of Item that have their own methods. So I want ly.music be a little more \"dumb\", but much more predictable as fas as api and storage method is concerted. Smart things like computing lengths, traversing events etc should be done by separate iterator/accessor modules that have the logic."}}