Though note that my master branch is my development branch (since I’ve been changing as I go). The Template class barely changed and most of the changes are within parse/format methods in __init__.py or come in additional files, like schema.py and formatter.py.
All tests are still passing, except for the new schema yaml tests that I’ve been setting up. To get to passing those completely we would need to have optional arguments (??) and nested/referenced templates (#2) implemented in lucidity as well.
cQuery and Open Metadata
@marcus what I like about your setup is that it keeps data very close to what it belongs to, but how paths that are ‘to be constructed’ are defined seems cumbersome. Well, at least cumbersome at this low level. I wonder how you’d go about setting this up in a higher level python package that can manage the file structure easier. So more how do you see a full project being managed like that?
At this stage I feel that your solution reduces the freedom on folder structure more than what an extensive schema could offer. Because the data must be nested under its respective parent. In theory it’s confusing for the code (so the computer) that the asset could live in a separated work and publish folder, where your solution has a conflict. That would mean that same data is duplicated, which is exactly what you’re trying to avoid. Right?
For example
work/asset/hero/.Asset
publish/asset/hero/.Asset
Where would you store the data and how would you manage the file structure pattern?
On the other hand there’re other things your solution could solve, like:
Arbitrary nesting of folders (you always know when you’re IN the asset’s own folder, since it’s tagged like that)
If a folder is deleted its entry is automatically deleted as well, since the data is inside. (On the contrary though, what would happen if a folder gets renamed/moved (not saying that you should)?)
It sounds like you’ve got the gist of how it works by now. We should definitely have a chat about how to solve these more specific issues if you’re interested, how about a separate thread?
Seems like this thread is a mixture of pure folder structure and managing a project solely through folder structure. The second one might mostly be irrelevant to the first. That is with tools like ftrack/shotgun or metadata on folders. At least it seems like you’ve got something nice to bring to the table. If you think some separation is in place feel free to kickstart a thread with a clearer separation.
I’m trying out Lucidity and it looks like tokens cannot contain “/” character? So you have to extract the {project_root} out of the path before parsing it seems.
# The complex regex part that can match any root path (NT and UNIX)
regex_pattern = r'(^[\w]*:*[\/]?(?:(?:(?<=[\/])[^\/]+[\/]?)*))'
# The lucidity formatted *project_root* key
root = '{project_root:%s}' % regex_pattern
# Your token
token = root + "/scene"
We’re using this same regex pattern for the The Deal test project we’re doing with Pyblish Magenta
Though currently it does not match that by default, since {root} and {asset} can only ever be a single folder.
So we overwrite the regex by implementing our custom regex to allow the {root} to match anything up to that point. In theory you could have a very simple regex for {root} to match anything non-greedy up to that point. Something like {root:.+?} where the regex pattern is .+? to match any 1 or more characters in a non-greedy fashion.
Ade is tackling a slightly different (and important problem) I think - it operates at a higher level than Lucidity which is just a simple library at the end of the day.
Ade solves things like (correct me if I am wrong Lorenzo!) what permissions should a directory have in the hierarchy. One way you can do that is come up with a fun config file format, but an arguably nicer way would be to just setup up a real directory structure as a template and reference that, which I think is what Ade does. This is similar to project templates you see in development such as cookiecutter.
For reference, you can also change the default placeholder regex per Template by passing a custom default_placeholder_expression parameter into the constructor.
Ade tries to solve the filesystem management problem using templates, rather than strings (strings are generated from the template folder by the end). It does also provide two commands : create, which will create all the needed folder on disk (file template included, let say for envs) , and parse, so you can do something like : ade parse /foo/projects/smurf/foo/bar and it will return {‘project’: ‘smurf’, ‘sequence’:‘foo’, ‘shot’:‘bar’}
we are using this tool on daily basis for all our clients, and so far has been proven quite robust and flexible.
Let me know if you have any question !
L.
Yes. Lucidity both parses and formats paths, though it doesn’t parse a full schema into its own configuration file. As I understood that is what Ade is capable of?
Had a quick look at Ade but couldn’t get a quick grip it with the documentation. Hopefully I can find some time soon to have another look at it to get a feeling of the differences.