From 424710adb75a668cfe1a2bb01a881d1ae71d423f Mon Sep 17 00:00:00 2001 From: VAN BOSSUYT Nicolas Date: Wed, 12 Jun 2024 11:09:09 +0200 Subject: [PATCH] Initial commit. --- .gitignore | 5 ++ license.md | 9 ++++ meta/plugins/__init__.py | 21 +++++++++ project.json | 6 +++ readme.md | 89 +++++++++++++++++++++++++++++++++++ src/ce-uti-core/manifest.json | 6 +++ src/ce-uti-core/res/_uti.json | 12 +++++ 7 files changed, 148 insertions(+) create mode 100644 .gitignore create mode 100644 license.md create mode 100644 meta/plugins/__init__.py create mode 100644 project.json create mode 100644 readme.md create mode 100644 src/ce-uti-core/manifest.json create mode 100644 src/ce-uti-core/res/_uti.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e230253 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.cutekit +__pycache__ +.DS_Store +.vscode +.idea diff --git a/license.md b/license.md new file mode 100644 index 0000000..a6dc92b --- /dev/null +++ b/license.md @@ -0,0 +1,9 @@ +MIT License + +Copyright © 2024 Cute Engineering + +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. diff --git a/meta/plugins/__init__.py b/meta/plugins/__init__.py new file mode 100644 index 0000000..1644cd8 --- /dev/null +++ b/meta/plugins/__init__.py @@ -0,0 +1,21 @@ +import cutekit + +cutekit.ensure((0, 7, 0)) + +from cutekit import cli, model + + +@cli.command(None, "uti", "Manage uti definitions") +def _(): + pass + + +@cli.command(None, "uti/graph", "Show uti graph") +def _(args: model.RegistryArgs): + r = model.Registry.use(args) + + # Iter all components and finds revelants res/_uti.json + for c in r.iter(model.Manifest): + path = c.subpath("res/_uti.json") + if path.exists(): + print(c.path, path) diff --git a/project.json b/project.json new file mode 100644 index 0000000..3960346 --- /dev/null +++ b/project.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schemas.cute.engineering/stable/cutekit.manifest.project.v1", + "id": "cute-engineering/ce-uti", + "type": "project", + "description": "Utilities and repository for/of Uniform Type Identifier (UTI)" +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..d33dd77 --- /dev/null +++ b/readme.md @@ -0,0 +1,89 @@ +# 🗄️ Cute Engineering Uniform Type Identifier Library + +Common uniform type identifier. + +## What are UTIs? + +Uniform Type Identifiers (UTIs) are a type of identifier used identify the type of a ressource in a computer system. UTIs are hierarchical, meaning that they can be related to each other in a parent-child relationship. For example, the UTI for a JPEG image is `public.jpeg`, and the UTI for a PNG image is `public.png`. The `public.image` UTI is the parent of both `public.jpeg` and `public.png`. + +## Why use UTIs? + +UTIs are more flexible than file extensions, and can be used to identify any type of ressource, not just files. UTIs can also be used to identify ressources that don't have a file extension, or that have a non-standard file extension. + +## How to use UTIs? + +UTIs are strings that follow a specific format. The format of a UTI is a series of components separated by dots. Each component is a string that represents a category of ressource. For example, the UTI for a JPEG image is `public.jpeg`, which consists of two components: `public` and `jpeg`. + +## Examples + +- `public.jpeg`: JPEG image +- `public.png`: PNG image +- `public.audio`: Audio file +- `public.video`: Video file +- `public.text`: Text file + +## Relationship with Apple's UTIs + +While inspired by Apple's UTIs, this specification is its own thing and is not affiliated with Apple in any way. The goal of this specification is to provide a common set of UTIs that can be used across different platforms and programming languages. + +## Format + +The format of a UTI is a series of components separated by dots. Each component is a string that represents a category of ressource. For example, the UTI for a JPEG image is `public.jpeg`, which consists of two components: `public` and `jpeg`. + +## Namespaces + +UTIs are divided into namespaces, which are used to group related UTIs together. Common namespaces include `public`, `vendor`, `private`, and `local`. + +- `public`: UTIs that are intended to be used by everyone. +- `vendor`: UTIs that are intended to be used by a specific vendor. +- `private`: UTIs that are intended to be used by a specific application. +- `local`: UTIs that are intended to be used by a specific user/computer. + +### The `local` Namespace + +The `local` namespace is intended to be used for UTIs that are specific to a particular system or user, and that may not be applicable to other systems or users. For example a UTI for the user's device `local.device` could conform to `public.device.mobile` or `public.device.desktop` depending on the device type. + +## Declaration + +A UTI is declared as JSON object following the `https://schemas.cute.engineering/stable/common.uti.v1` schema. + +```json +{ + "$schema": "https://schemas.cute.engineering/stable/common.uti.v1", + "exports": [ + { + "id": "public.jpeg", + "description": "JPEG image", + "conforms": [ + "public.image" + ], + "references": [ + "https://en.wikipedia.org/wiki/JPEG" + ], + "specifications": [ + ".jpg", + ".jpeg", + ".jpe", + "image/jpeg", + "image/jpg" + ] + } + ] +} + +``` + + +## Contributing + +Contributions are welcome! If you have a UTI that you would like to add, please open a pull request. Please make sure to follow the format of existing UTIs, and to provide a description of the UTI and its intended use. + +## License + + + MIT License + + +This software projet is licensed under the **MIT License**. + +The full text of the license can be accessed via [this link](https://opensource.org/licenses/MIT) and is also included in the [license.md](license.md) file of this software package. diff --git a/src/ce-uti-core/manifest.json b/src/ce-uti-core/manifest.json new file mode 100644 index 0000000..936da30 --- /dev/null +++ b/src/ce-uti-core/manifest.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schemas.cute.engineering/stable/cutekit.manifest.component.v1", + "id": "ce-uti-core", + "type": "lib", + "description": "Core UTI definitions" +} diff --git a/src/ce-uti-core/res/_uti.json b/src/ce-uti-core/res/_uti.json new file mode 100644 index 0000000..0bd080a --- /dev/null +++ b/src/ce-uti-core/res/_uti.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://schemas.cute.engineering/stable/common.uti.v1", + "exports": [ + { + "id": "public.data", + "description": "A data stream", + "conforms": [ + "public.item" + ] + } + ] +}