minidir


Nameminidir JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryMinimal directory interface and some implementations
upload_time2024-06-07 03:11:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords directory fake filesystem testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # minidir: Minimal directory interface and implementation

The minimal interface for directories and files and
two implementations: in-memory and real file system versions.

It's a good choice when we want to separate file-access side effects from
pure functional part of our code base.

## Installation

Already published on Pypi

```shell
pip install minidir
```

## Usage

- Interface: `Directory` -> `Path`, `File`
    - `Directory` is the container where we access `File` by `Path`
- Implementation
    - `SystemDirectory`: a `Directory` backed by real file system.
    - `FakeDirectory`: a `Directory` only exists in-memory.

Some error like `NameCollision` and `NotFound` will be raised in corresponding situations.

Example:

```python
import minidir

class SomeClass:
    folder: minidir.Directory

    def __init__(self, folder: minidir.Directory) -> None:
        # inject directory to separate side effect from core logic
        pass

def main():
    # use actual file system during production
    instance = SomeClass(minidir.SystemDirectory("/path/to/root"))

def test_some_class():
    # use in-memory implementation during test
    instance = SomeClass(minidir.FakeDirectory())
```

## Future Work

- Implementations for network-oriented storage, e.g. WebDAV, S3, Dropbox ...
- Stream based file read / write interface.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "minidir",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "directory, fake, filesystem, testing",
    "author": null,
    "author_email": "Weida Hong <wdhongtw@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a7/38/10f2ccedbd8cc9b5d7f8f8366944472da640e55f8bccb10eeae39879e324/minidir-0.1.3.tar.gz",
    "platform": null,
    "description": "# minidir: Minimal directory interface and implementation\n\nThe minimal interface for directories and files and\ntwo implementations: in-memory and real file system versions.\n\nIt's a good choice when we want to separate file-access side effects from\npure functional part of our code base.\n\n## Installation\n\nAlready published on Pypi\n\n```shell\npip install minidir\n```\n\n## Usage\n\n- Interface: `Directory` -> `Path`, `File`\n    - `Directory` is the container where we access `File` by `Path`\n- Implementation\n    - `SystemDirectory`: a `Directory` backed by real file system.\n    - `FakeDirectory`: a `Directory` only exists in-memory.\n\nSome error like `NameCollision` and `NotFound` will be raised in corresponding situations.\n\nExample:\n\n```python\nimport minidir\n\nclass SomeClass:\n    folder: minidir.Directory\n\n    def __init__(self, folder: minidir.Directory) -> None:\n        # inject directory to separate side effect from core logic\n        pass\n\ndef main():\n    # use actual file system during production\n    instance = SomeClass(minidir.SystemDirectory(\"/path/to/root\"))\n\ndef test_some_class():\n    # use in-memory implementation during test\n    instance = SomeClass(minidir.FakeDirectory())\n```\n\n## Future Work\n\n- Implementations for network-oriented storage, e.g. WebDAV, S3, Dropbox ...\n- Stream based file read / write interface.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Minimal directory interface and some implementations",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/wdhongtw/minidir"
    },
    "split_keywords": [
        "directory",
        " fake",
        " filesystem",
        " testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c757a5244323c0208e7437ef05093e7a3acc7cbce0747d6ff72ccd9bbd7ec6af",
                "md5": "c01dbbbf2ca9136a31ee6eaec67d0c14",
                "sha256": "558f64b1967f4a674039491b4f719e7f400d0c541026dd156f0d6ea4602c4c20"
            },
            "downloads": -1,
            "filename": "minidir-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c01dbbbf2ca9136a31ee6eaec67d0c14",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3088,
            "upload_time": "2024-06-07T03:10:59",
            "upload_time_iso_8601": "2024-06-07T03:10:59.644359Z",
            "url": "https://files.pythonhosted.org/packages/c7/57/a5244323c0208e7437ef05093e7a3acc7cbce0747d6ff72ccd9bbd7ec6af/minidir-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a73810f2ccedbd8cc9b5d7f8f8366944472da640e55f8bccb10eeae39879e324",
                "md5": "244e27044078fb7e67d6efd2ff96d93e",
                "sha256": "072fb532bdca0d9a85dac111eac74cb8657d74de65a79f023ce0fbcfc3496e8a"
            },
            "downloads": -1,
            "filename": "minidir-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "244e27044078fb7e67d6efd2ff96d93e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4493,
            "upload_time": "2024-06-07T03:11:00",
            "upload_time_iso_8601": "2024-06-07T03:11:00.867222Z",
            "url": "https://files.pythonhosted.org/packages/a7/38/10f2ccedbd8cc9b5d7f8f8366944472da640e55f8bccb10eeae39879e324/minidir-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-07 03:11:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wdhongtw",
    "github_project": "minidir",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "minidir"
}
        
Elapsed time: 0.28340s