lucidity-files


Namelucidity-files JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryList files with lucidity templates.
upload_time2024-01-07 12:27:09
maintainer
docs_urlNone
author
requires_python>=2.7
licenseMIT License Copyright (c) 2022 Eduardo Graña Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords templates files listing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
#  Lucidity Files

Lucidity Files is a project for listing files and folders using the popular Lucidity templating module.

Made this for another project called Lucidity Browser (Aka Browser) that handles files listing and contextual actions across many folders and templates. This was tested with good results in the production Bad Dinos at [Able & Baker studios](https://ableandbakerstudios.com/). Since the focus was on the Browser part, this end up not being a great thing, but it works.

Have not tested this in Mac or Linux, although I plan to do it.




## Badges

[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)

![Python 2.7](https://img.shields.io/badge/Python-2-blue)

![Python 3.7](https://img.shields.io/badge/Python-3-blue)

![Windows](https://img.shields.io/badge/OS-Windows-blue)

![Windows](https://img.shields.io/badge/Status-Beta-yellow)


## Installation

Install module with pip

```bash
  python -m pip install lucidity_files
```

You can also target a folder like this (a pip thing, not anything i did)

```bash
  python -m pip install --target=P:\my\path lucidity_files
```

## Usage/Examples

```python
import os
import lucidity_files

# create 'asset' file template -------

# define roots for files (useful for different os or the farm)
roots = {'root': 'C:'}

# define a relative path from the root
pattern = '{root:[\w_.\-:]+}/{project}/{entitytype}/{entity}/{step}/{task}/{entity}_{step}_{task}_{name}_v{version}.{ext}'
lf_template = lucidity_files.TemplateFile.create('assets', pattern, roots=roots)

# lets create a file to be listed
path = r"C:\test\asset\car\mod\hi\car_mod_hi_default_v001.txt"

# we could also use the template to do this!
input_data = {'entity': 'car', 'entitytype': 'asset', 'ext': 'txt', 'name': 'default',
    'project': 'test', 'root': 'C:', 'step': 'mod', 'task': 'hi', 'version': '001'}
path2 = lf_template.format(input_data)
print(path == path2)
# will print True

os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, 'w'):
    pass


# list all assets in project 'test'
paths_found = lf_template.getPaths({'project': 'test'})

# now get each path's data
for path in paths_found:
    data = lf_template.parse(path)
    print(path)
    print('\t', data)

# # will print something like
# C:\test\asset\car\mod\hi\car_mod_hi_default_v001.txt
#          {'entity': 'car', 'entitytype': 'asset', 'ext': 'txt', 'name': 'default',
#  'project': 'test', 'root': 'C:', 'step': 'mod', 'task': 'hi', 'version': '001'}

# lets get a partial template to the entity folder
partial_template = lf_template.getPartialTemplateFile('entity')

# list all entity folders. Will use the strict check to make sure that what get listed
# is parsable with the same template (some other folders might match the glob but
# not the specifics of the template, and we want to avoid those)
paths_found = partial_template.getPaths({'project': 'test'}, strict_check=True)

# now get each path's data
for path in paths_found:
    print(path)
    data = partial_template.parse(path)
    print('\t', data)

# # will print something like
# C:\test\asset\car
#          {'entity': 'car', 'entitytype': 'asset', 'project': 'test', 'root': 'C:'}
# ...


```


## Documentation

[Documentation on Read The Docs](https://lucidity-files.readthedocs.io/en/latest/)




## Environment Variables

To run this project, you can add the following environment variables to your .env file

`LUCIDITY_TEMPLATE_PATH` 
Where you store files defining your lucidity templates.



## Acknowledgements

 - Thanks to Jordi Amposta, Angel Galindo and Marco Sancho for the patience while testing this in production!
 - This depends on the [Lucidity Project](https://pypi.org/project/Lucidity/), please check it out!

## Authors

- [eduardograna](https://gitlab.com/eduardograna)


## License

[MIT](https://choosealicense.com/licenses/mit/)


## Used By

This project is used by the following companies:

- [Able & Baker studios](https://ableandbakerstudios.com/)


## Roadmap

- Make module pip installable :)

- Test on Linux


## Support

For questions, email eduardo@eduardograna.com.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "lucidity-files",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": "",
    "keywords": "templates,files,listing",
    "author": "",
    "author_email": "Eduardo Grana <eduardo@eduardograna.com>",
    "download_url": "https://files.pythonhosted.org/packages/50/c3/82b7fd5a7892b0f213cbd031c423169c93e95c3d6fcd0ca34c4276ceb3db/lucidity_files-0.1.1.tar.gz",
    "platform": null,
    "description": "\r\n#  Lucidity Files\r\n\r\nLucidity Files is a project for listing files and folders using the popular Lucidity templating module.\r\n\r\nMade this for another project called Lucidity Browser (Aka Browser) that handles files listing and contextual actions across many folders and templates. This was tested with good results in the production Bad Dinos at [Able & Baker studios](https://ableandbakerstudios.com/). Since the focus was on the Browser part, this end up not being a great thing, but it works.\r\n\r\nHave not tested this in Mac or Linux, although I plan to do it.\r\n\r\n\r\n\r\n\r\n## Badges\r\n\r\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\r\n\r\n![Python 2.7](https://img.shields.io/badge/Python-2-blue)\r\n\r\n![Python 3.7](https://img.shields.io/badge/Python-3-blue)\r\n\r\n![Windows](https://img.shields.io/badge/OS-Windows-blue)\r\n\r\n![Windows](https://img.shields.io/badge/Status-Beta-yellow)\r\n\r\n\r\n## Installation\r\n\r\nInstall module with pip\r\n\r\n```bash\r\n  python -m pip install lucidity_files\r\n```\r\n\r\nYou can also target a folder like this (a pip thing, not anything i did)\r\n\r\n```bash\r\n  python -m pip install --target=P:\\my\\path lucidity_files\r\n```\r\n\r\n## Usage/Examples\r\n\r\n```python\r\nimport os\r\nimport lucidity_files\r\n\r\n# create 'asset' file template -------\r\n\r\n# define roots for files (useful for different os or the farm)\r\nroots = {'root': 'C:'}\r\n\r\n# define a relative path from the root\r\npattern = '{root:[\\w_.\\-:]+}/{project}/{entitytype}/{entity}/{step}/{task}/{entity}_{step}_{task}_{name}_v{version}.{ext}'\r\nlf_template = lucidity_files.TemplateFile.create('assets', pattern, roots=roots)\r\n\r\n# lets create a file to be listed\r\npath = r\"C:\\test\\asset\\car\\mod\\hi\\car_mod_hi_default_v001.txt\"\r\n\r\n# we could also use the template to do this!\r\ninput_data = {'entity': 'car', 'entitytype': 'asset', 'ext': 'txt', 'name': 'default',\r\n    'project': 'test', 'root': 'C:', 'step': 'mod', 'task': 'hi', 'version': '001'}\r\npath2 = lf_template.format(input_data)\r\nprint(path == path2)\r\n# will print True\r\n\r\nos.makedirs(os.path.dirname(path), exist_ok=True)\r\nwith open(path, 'w'):\r\n    pass\r\n\r\n\r\n# list all assets in project 'test'\r\npaths_found = lf_template.getPaths({'project': 'test'})\r\n\r\n# now get each path's data\r\nfor path in paths_found:\r\n    data = lf_template.parse(path)\r\n    print(path)\r\n    print('\\t', data)\r\n\r\n# # will print something like\r\n# C:\\test\\asset\\car\\mod\\hi\\car_mod_hi_default_v001.txt\r\n#          {'entity': 'car', 'entitytype': 'asset', 'ext': 'txt', 'name': 'default',\r\n#  'project': 'test', 'root': 'C:', 'step': 'mod', 'task': 'hi', 'version': '001'}\r\n\r\n# lets get a partial template to the entity folder\r\npartial_template = lf_template.getPartialTemplateFile('entity')\r\n\r\n# list all entity folders. Will use the strict check to make sure that what get listed\r\n# is parsable with the same template (some other folders might match the glob but\r\n# not the specifics of the template, and we want to avoid those)\r\npaths_found = partial_template.getPaths({'project': 'test'}, strict_check=True)\r\n\r\n# now get each path's data\r\nfor path in paths_found:\r\n    print(path)\r\n    data = partial_template.parse(path)\r\n    print('\\t', data)\r\n\r\n# # will print something like\r\n# C:\\test\\asset\\car\r\n#          {'entity': 'car', 'entitytype': 'asset', 'project': 'test', 'root': 'C:'}\r\n# ...\r\n\r\n\r\n```\r\n\r\n\r\n## Documentation\r\n\r\n[Documentation on Read The Docs](https://lucidity-files.readthedocs.io/en/latest/)\r\n\r\n\r\n\r\n\r\n## Environment Variables\r\n\r\nTo run this project, you can add the following environment variables to your .env file\r\n\r\n`LUCIDITY_TEMPLATE_PATH` \r\nWhere you store files defining your lucidity templates.\r\n\r\n\r\n\r\n## Acknowledgements\r\n\r\n - Thanks to Jordi Amposta, Angel Galindo and Marco Sancho for the patience while testing this in production!\r\n - This depends on the [Lucidity Project](https://pypi.org/project/Lucidity/), please check it out!\r\n\r\n## Authors\r\n\r\n- [eduardograna](https://gitlab.com/eduardograna)\r\n\r\n\r\n## License\r\n\r\n[MIT](https://choosealicense.com/licenses/mit/)\r\n\r\n\r\n## Used By\r\n\r\nThis project is used by the following companies:\r\n\r\n- [Able & Baker studios](https://ableandbakerstudios.com/)\r\n\r\n\r\n## Roadmap\r\n\r\n- Make module pip installable :)\r\n\r\n- Test on Linux\r\n\r\n\r\n## Support\r\n\r\nFor questions, email eduardo@eduardograna.com.\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Eduardo Gra\u00f1a  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "List files with lucidity templates.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://gitlab.com/eduardograna/lucidity_files"
    },
    "split_keywords": [
        "templates",
        "files",
        "listing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a27338028719cd85826118c36267737c150d03759ff5181e43bdc168264b4228",
                "md5": "1fb66dbe48edccd717745aad743800ce",
                "sha256": "7302de3606502b48e10780e0acd63159534e12d5550e4e7ef9afc16f3e83c416"
            },
            "downloads": -1,
            "filename": "lucidity_files-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1fb66dbe48edccd717745aad743800ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=2.7",
            "size": 11048,
            "upload_time": "2024-01-07T12:27:08",
            "upload_time_iso_8601": "2024-01-07T12:27:08.507076Z",
            "url": "https://files.pythonhosted.org/packages/a2/73/38028719cd85826118c36267737c150d03759ff5181e43bdc168264b4228/lucidity_files-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50c382b7fd5a7892b0f213cbd031c423169c93e95c3d6fcd0ca34c4276ceb3db",
                "md5": "8f824c76ea2deb6d028e838f9b469d69",
                "sha256": "db1a865df0b66f4a758adc09aea8bd478bc7af47f272bfe18ba58bb30bf79a7a"
            },
            "downloads": -1,
            "filename": "lucidity_files-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8f824c76ea2deb6d028e838f9b469d69",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 15045,
            "upload_time": "2024-01-07T12:27:09",
            "upload_time_iso_8601": "2024-01-07T12:27:09.574544Z",
            "url": "https://files.pythonhosted.org/packages/50/c3/82b7fd5a7892b0f213cbd031c423169c93e95c3d6fcd0ca34c4276ceb3db/lucidity_files-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-07 12:27:09",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "eduardograna",
    "gitlab_project": "lucidity_files",
    "lcname": "lucidity-files"
}
        
Elapsed time: 0.15609s