{"id":18349173,"url":"https://github.com/ddeutils/ddeutil-io","last_synced_at":"2025-04-09T23:45:46.515Z","repository":{"id":194814178,"uuid":"690849953","full_name":"ddeutils/ddeutil-io","owner":"ddeutils","description":"🚅 Input/Output transport utility objects","archived":false,"fork":false,"pushed_at":"2025-04-03T02:06:36.000Z","size":488,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T23:45:39.364Z","etag":null,"topics":["file-interface","io"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddeutils.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-13T02:25:43.000Z","updated_at":"2025-04-03T02:06:33.000Z","dependencies_parsed_at":"2023-09-15T08:06:36.370Z","dependency_job_id":"43c15668-91c4-4bc3-93c1-e0f24a32a38f","html_url":"https://github.com/ddeutils/ddeutil-io","commit_stats":null,"previous_names":["korawica/ddeutil-io","ddeutils/ddeutil-io"],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddeutils%2Fddeutil-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddeutils%2Fddeutil-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddeutils%2Fddeutil-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddeutils%2Fddeutil-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddeutils","download_url":"https://codeload.github.com/ddeutils/ddeutil-io/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131465,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-interface","io"],"created_at":"2024-11-05T21:20:56.279Z","updated_at":"2025-04-09T23:45:46.508Z","avatar_url":"https://github.com/ddeutils.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Input/Output Data Transport\n\n[![test](https://github.com/ddeutils/ddeutil-io/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/ddeutils/ddeutil-io/actions/workflows/tests.yml)\n[![codecov](https://codecov.io/gh/ddeutils/ddeutil-io/graph/badge.svg?token=3NDPN2I0H9)](https://codecov.io/gh/ddeutils/ddeutil-io)\n[![pypi version](https://img.shields.io/pypi/v/ddeutil-io)](https://pypi.org/project/ddeutil-io/)\n[![python support version](https://img.shields.io/pypi/pyversions/ddeutil-io)](https://pypi.org/project/ddeutil-io/)\n[![size](https://img.shields.io/github/languages/code-size/ddeutils/ddeutil-io)](https://github.com/ddeutils/ddeutil-io)\n[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![type check: mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n\nAn **input/output data transport** utility objects 🚅 was created for full managed\nobject of configuration file that include `load` from any file\nformat like `.yaml`, `.json`, or `.toml`, and manage retention and version of\nconfig files lifecycle ♻️.\n\nThe core part of this project is **Files** module that is an open file object\nwith specific file format.\n\n## 📦 Installation\n\n```shell\npip install -U ddeutil-io\n```\n\n**Python version supported**:\n\n| Python Version | Installation                | Support Fixed Bug  |\n|:---------------|:----------------------------|:------------------:|\n| `\u003e=3.9,\u003c3.14`  | `pip install -U ddeutil-io` | :heavy_check_mark: |\n\n\u003e [!NOTE]\n\u003e This package need to install `ddeutil` first to be core package namespace.\n\u003e You do not need to pip it because I include this package to the required list.\n\u003e\n\u003e For optional dependencies that should to additional installation;\n\u003e\n\u003e | Module      | Installation           | Additional dependencies                        |\n\u003e |-------------|------------------------|------------------------------------------------|\n\u003e | `YamlFl`    | `ddeutil-io[yaml]`     | `pip install PyYaml`                           |\n\u003e | `TomlFl`    | `ddeutil-io[toml]`     | `pip install toml`                             |\n\u003e | `MsgpackFl` | `ddeutil-io[msgpack]`  | `pip install msgpack`                          |\n\u003e | `Register`  | `ddeutil-io[register]` | `pip install python-dateutil deepdiff fmtutil` |\n\n## 🎯 Features\n\nThe features of this package is Input/Output data transport utility objects.\n\n| Module   |      Name       | Description                                                                                                                               | Remark   |\n|:---------|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------|----------|\n| paths    |   PathSearch    | Path Search object that use to search path tree from an input root path.                                                                  |          |\n|          |       ls        | List files in a directory, applying ignore-style filtering.                                                                               |          |\n| files    |       Fl        | Open File object that use to open any normal or compression file from current local file system                                           |          |\n|          |   EnvFlMixin    | Environment Mapping to read method of open file object mixin.                                                                             |          |\n|          |      EnvFl      | Dot env open file object which mapping search engine to data context that reading from dot env file format (.env).                        |          |\n|          |    YamlEnvFl    | Yaml open file object which mapping search environment variable.                                                                          |          |\n|          |     YamlFl      | Yaml open file object that read data context from Yaml file format (.yml, or .yaml).                                                      |          |\n|          |  YamlFlResolve  | Yaml open file object with resolve boolean convert value problem such as convert 'on' value to true instead a string of 'on' value.       |          |\n|          |    JsonEnvFl    | Json open file object which mapping search environment variable before parsing with json package.                                         |          |\n|          |   JsonLineFl    | Json open file object that read data context from Json file format (.json) with a newline seperator.                                      |          |\n|          |     JsonFl      | Json open file object that read data context from Json file format (.json).                                                               |          |\n|          |      CsvFl      | CSV open file object with comma (`,`) seperator charactor.                                                                                |          |\n|          |    CsvPipeFl    | CSV open file object with pipe (`\\|`) seperator charactor.                                                                                |          |\n|          |    TomlEnvFl    | TOML open file object which mapping search environment variable before parsing with toml package from TOML file format (.toml).           |          |\n|          |     TomlFl      | TOML open file object that read data context from TOML file format (.toml).                                                               |          |\n|          |    PickleFl     | Pickle open file object that read data context from Pickle file format (.pickle).                                                         | no cover |\n|          |    MarshalFl    | Marshal open file object that read data context from Marshal file format.                                                                 | no cover |\n|          |    MsgpackFl    | Msgpack open file object that read data context from Msgpack file format.                                                                 | no cover |\n| stores   |      Store      | Store File Loading Object for get data from configuration and stage.                                                                      |          |\n|          | StoreJsonToCsv  | Store object that getting the Json context data and save it to stage with CSV file format.                                                |          |\n|          | StoreToJsonLine | Store object that getting the YAML context data and save it to stage with Json line file format.                                          |          |\n| register |    Register     | Register Object that contain configuration loading methods and metadata management.                                                       |          |\n|          | ArchiveRegister | Archiving Register object that implement archiving management on the Register object such as ``self.purge``, and ``self.remove`` methods. |          |\n| utils    |       rm        | Remove a file or dir from an input path.                                                                                                  |          |\n|          |      touch      | Create an empty file with specific name and modified time of path it an input times was set.                                              |          |\n\n## 💡 Usages\n\nI will show some usage example of function in this package. If you want to use\ncomplex or adjust some parameter, please see doc-string or real source code\n(I think it does not complex, and you can see how that function work).\n\n### ⭕ Files\n\nFor example, I will represent `YamlEnvFl` object that passing environment variable\nto reading content before passing to the Yaml loader.\n\n```yaml\ndata:\n  get: HELLO ${HELLO}\n```\n\n```python\nimport os\nfrom ddeutil.io import YamlEnvFl\n\nos.environ[\"HELLO\"] = \"WORLD\"\ncontent = YamlEnvFl('./source.yaml').read(safe=True)\nassert content['data']['get'] == \"HELLO WORLD\"\n```\n\n\u003e [!NOTE]\n\u003e This module do not implement special function on IO like the build-in ``open``\n\u003e function. It also makes standard ``read`` and ``write`` file objects.\n\n### ❌ Dirs\n\n\u003e [!WARNING]\n\u003e This module should not use on production.\n\n### ⭕ Store\n\nStore object is the storing dir system handler object that manage any files in\nthat dir path with `get`, `move`, `load`, `save`, or `ls` operations.\n\n```python\nfrom ddeutil.io import Store\n\nstore: Store = Store(path='./conf', compress=\"gzip\")\n\ndata = store.get(name='config_file.yaml')\nstore.save('./stage/file.json', data)\n```\n\n```text\nconf/\n ├─ examples/\n │   ╰─ config_file.yaml\n ╰─ stage/\n     ╰─ file.json\n```\n\n### ⭕ Register\n\nThe **Register Object** is the metadata generator object for the config data.\nIf you passing name and configs to this object, it will find the config name\nin any stage storage and generate its metadata to you.\n\n```python\nfrom ddeutil.io.register import Register\nfrom ddeutil.io import Params\n\nregistry: Register = Register(\n    name='examples:conn_data_local_file',\n    params=Params(**{\n        \"stages\": {\n            \"raw\": {\"format\": \"{naming:%s}.{timestamp:%Y%m%d_%H%M%S}\"},\n        },\n    }),\n)\nregistry.move(stage=\"raw\")\n```\n\nThe raw data of this config was written in `conn_file.yaml` file.\n\n```text\nconf/\n ╰─ examples/\n     ╰─ conn_file.yaml\n```\n\nWhen call `move` method, it will transfer data from `.yaml` file to `json` file\nwith the data hashing algorithm.\n\n```text\ndata/\n ├─ __METADATA/\n │   ├─ exampleconn_data_local_file.base.json\n │   ╰─ exampleconn_data_local_file.raw.json\n ╰─ raw/\n     ╰─ conn_file_20240101_000000.json\n```\n\n## 💬 Contribute\n\nI do not think this project will go around the world because it has specific propose,\nand you can create by your coding without this project dependency for long term\nsolution. So, on this time, you can open [the GitHub issue on this project 🙌](https://github.com/ddeutils/ddeutil-io/issues)\nfor fix bug or request new feature if you want it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddeutils%2Fddeutil-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddeutils%2Fddeutil-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddeutils%2Fddeutil-io/lists"}