Name | dirlay JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Directory layout object for testing and documentation |
upload_time | 2025-02-20 22:40:30 |
maintainer | None |
docs_url | None |
author | None |
requires_python | !=3.0,!=3.1,!=3.2,!=3.3,!=3.4,>=2.7 |
license | MIT |
keywords |
directory
layout
structure
tree
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# dirlay
<!-- docsub: begin -->
<!-- docsub: include docs/desc.md -->
> *Directory layout object for testing and documentation*
<!-- docsub: end -->
<!-- docsub: begin -->
<!-- docsub: include docs/badges.md -->
[](https://github.com/makukha/dirlay/blob/main/LICENSE)
[](https://pypi.python.org/pypi/dirlay)
[](https://pypi.org/project/dirlay)
[](https://github.com/makukha/dirlay)
[](https://github.com/makukha/dirlay)
[](https://github.com/makukha/multipython)
[](https://github.com/makukha/docsub)
[](http://mypy.readthedocs.io)
[](https://github.com/astral-sh/ruff)
[](https://github.com/astral-sh/ruff)
<!-- docsub: end -->
<!-- docsub: begin -->
<!-- docsub: include docs/features.md -->
# Features
- Create and remove directory tree with files
- Chdir to layout subdirectories
- Display as rich tree for docs
- Uses [pathlib2](https://github.com/jazzband/pathlib2) for Python 2
<!-- docsub: end -->
# Installation
```shell
$ pip install dirlay[rich]
```
# Usage
<!-- docsub: begin #usage.md -->
<!-- docsub: include docs/usage.md -->
<!-- docsub: begin -->
<!-- docsub: x toc tests/test_usage.py 'Usage.*' -->
* [Create directory layout tree](#create-directory-layout-tree)
* [Chdir to subdirectory](#chdir-to-subdirectory)
* [Print as tree](#print-as-tree)
<!-- docsub: end -->
```pycon
>>> from dirlay import DirectoryLayout, to_tree
```
<!-- docsub: begin -->
<!-- docsub: x cases tests/test_usage.py 'Usage.*' -->
## Create directory layout tree
```pycon
>>> layout = DirLayout({'a': {'b/c.txt': 'ccc', 'd.txt': 'ddd'}})
>>> layout.basedir is None
True
>>> layout.mktree()
>>> layout.basedir
PosixPath('/tmp/...')
```
And remove when not needed anymore:
```pycon
>>> layout.rmtree()
```
## Chdir to subdirectory
```pycon
>>> import os
>>> os.chdir('/tmp')
```
When layout is instantiated, current directory remains unchanged:
```pycon
>>> layout = DirLayout({'a': {'b/c.txt': 'ccc'}})
>>> layout.mktree()
>>> layout.getcwd()
PosixPath('/tmp')
```
On first `chdir`, initial working directory is stored internally, and will be
restored on `rmtree`. Without argument, `chdir` sets current directory to
`layout.basedir`.
```pycon
>>> layout.basedir
PosixPath('/tmp/...')
>>> layout.chdir()
>>> layout.getcwd()
PosixPath('/tmp/...')
```
If `chdir` has argument, it must be a path relative to `basedir`.
```pycon
>>> layout.chdir('a/b')
>>> layout.getcwd()
PosixPath('/tmp/.../a/b')
```
When directory is removed, current directory is restored:
```pycon
>>> layout.rmtree()
>>> layout.getcwd()
PosixPath('/tmp')
```
## Print as tree
```pycon
>>> layout = DirLayout({'a': {'b/c.txt': 'ccc', 'd.txt': 'ddd'}})
>>> layout.print_tree()
📂 .
└── 📂 a
├── 📂 b
│ └── 📄 c.txt
└── 📄 d.txt
>>> layout.mktree()
>>> layout.print_tree(show_basedir=True, show_content=True)
📂 /tmp/...
└── 📂 a
├── 📂 b
│ └── 📄 c.txt
│ â•â”€â”€â”€â”€â”€â•®
│ │ ccc │
│ ╰─────╯
└── 📄 d.txt
â•â”€â”€â”€â”€â”€â•®
│ ddd │
╰─────╯
```
<!-- docsub: end -->
<!-- docsub: end #usage.md -->
# See also
* [API Reference](https://dirlay.readthedocs.io/en/latest/api.html)
* [Project Documentation](https://dirlay.readthedocs.io/en/latest)
* [Project Changelog](https://github.com/makukha/dirlay/tree/main/CHANGELOG.md)
Raw data
{
"_id": null,
"home_page": null,
"name": "dirlay",
"maintainer": null,
"docs_url": null,
"requires_python": "!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,>=2.7",
"maintainer_email": null,
"keywords": "directory, layout, structure, tree",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c6/48/1f4a86c390794183dd31ee7ffe9df50cf4c12e67e721555311f7710c568e/dirlay-0.1.0.tar.gz",
"platform": null,
"description": "# dirlay\n<!-- docsub: begin -->\n<!-- docsub: include docs/desc.md -->\n> *Directory layout object for testing and documentation*\n<!-- docsub: end -->\n\n<!-- docsub: begin -->\n<!-- docsub: include docs/badges.md -->\n[](https://github.com/makukha/dirlay/blob/main/LICENSE)\n[](https://pypi.python.org/pypi/dirlay)\n[](https://pypi.org/project/dirlay)\n[](https://github.com/makukha/dirlay)\n[](https://github.com/makukha/dirlay)\n[](https://github.com/makukha/multipython)\n[](https://github.com/makukha/docsub)\n[](http://mypy.readthedocs.io)\n[](https://github.com/astral-sh/ruff)\n[](https://github.com/astral-sh/ruff)\n<!-- docsub: end -->\n\n\n<!-- docsub: begin -->\n<!-- docsub: include docs/features.md -->\n# Features\n\n- Create and remove directory tree with files\n- Chdir to layout subdirectories\n- Display as rich tree for docs\n- Uses [pathlib2](https://github.com/jazzband/pathlib2) for Python 2\n<!-- docsub: end -->\n\n\n\n# Installation\n\n```shell\n$ pip install dirlay[rich]\n```\n\n\n# Usage\n\n<!-- docsub: begin #usage.md -->\n<!-- docsub: include docs/usage.md -->\n<!-- docsub: begin -->\n<!-- docsub: x toc tests/test_usage.py 'Usage.*' -->\n* [Create directory layout tree](#create-directory-layout-tree)\n* [Chdir to subdirectory](#chdir-to-subdirectory)\n* [Print as tree](#print-as-tree)\n<!-- docsub: end -->\n\n```pycon\n>>> from dirlay import DirectoryLayout, to_tree\n```\n\n<!-- docsub: begin -->\n<!-- docsub: x cases tests/test_usage.py 'Usage.*' -->\n## Create directory layout tree\n\n```pycon\n>>> layout = DirLayout({'a': {'b/c.txt': 'ccc', 'd.txt': 'ddd'}})\n>>> layout.basedir is None\nTrue\n>>> layout.mktree()\n>>> layout.basedir\nPosixPath('/tmp/...')\n```\n\nAnd remove when not needed anymore:\n\n```pycon\n>>> layout.rmtree()\n```\n\n## Chdir to subdirectory\n\n```pycon\n>>> import os\n>>> os.chdir('/tmp')\n```\n\nWhen layout is instantiated, current directory remains unchanged:\n\n```pycon\n>>> layout = DirLayout({'a': {'b/c.txt': 'ccc'}})\n>>> layout.mktree()\n>>> layout.getcwd()\nPosixPath('/tmp')\n```\n\nOn first `chdir`, initial working directory is stored internally, and will be\nrestored on `rmtree`. Without argument, `chdir` sets current directory to\n`layout.basedir`.\n\n```pycon\n>>> layout.basedir\nPosixPath('/tmp/...')\n>>> layout.chdir()\n>>> layout.getcwd()\nPosixPath('/tmp/...')\n```\n\nIf `chdir` has argument, it must be a path relative to `basedir`.\n\n```pycon\n>>> layout.chdir('a/b')\n>>> layout.getcwd()\nPosixPath('/tmp/.../a/b')\n```\n\nWhen directory is removed, current directory is restored:\n\n```pycon\n>>> layout.rmtree()\n>>> layout.getcwd()\nPosixPath('/tmp')\n```\n\n## Print as tree\n\n```pycon\n>>> layout = DirLayout({'a': {'b/c.txt': 'ccc', 'd.txt': 'ddd'}})\n>>> layout.print_tree()\n\ud83d\udcc2 .\n\u2514\u2500\u2500 \ud83d\udcc2 a\n \u251c\u2500\u2500 \ud83d\udcc2 b\n \u2502 \u2514\u2500\u2500 \ud83d\udcc4 c.txt\n \u2514\u2500\u2500 \ud83d\udcc4 d.txt\n\n>>> layout.mktree()\n>>> layout.print_tree(show_basedir=True, show_content=True)\n\ud83d\udcc2 /tmp/...\n\u2514\u2500\u2500 \ud83d\udcc2 a\n \u251c\u2500\u2500 \ud83d\udcc2 b\n \u2502 \u2514\u2500\u2500 \ud83d\udcc4 c.txt\n \u2502 \u256d\u2500\u2500\u2500\u2500\u2500\u256e\n \u2502 \u2502 ccc \u2502\n \u2502 \u2570\u2500\u2500\u2500\u2500\u2500\u256f\n \u2514\u2500\u2500 \ud83d\udcc4 d.txt\n \u256d\u2500\u2500\u2500\u2500\u2500\u256e\n \u2502 ddd \u2502\n \u2570\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\n<!-- docsub: end -->\n<!-- docsub: end #usage.md -->\n\n\n# See also\n\n* [API Reference](https://dirlay.readthedocs.io/en/latest/api.html)\n* [Project Documentation](https://dirlay.readthedocs.io/en/latest)\n* [Project Changelog](https://github.com/makukha/dirlay/tree/main/CHANGELOG.md)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Directory layout object for testing and documentation",
"version": "0.1.0",
"project_urls": {
"Changelog": "https://github.com/makukha/dirlay",
"Documentation": "https://dirlay.readthedocs.io",
"Homepage": "https://github.com/makukha/dirlay",
"Issues": "https://github.com/makukha/dirlay",
"Repository": "https://github.com/makukha/dirlay"
},
"split_keywords": [
"directory",
" layout",
" structure",
" tree"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "229f629980be1b92963a3ef545985653dabbb410e331cd9e42fcc1701ec11fe4",
"md5": "1bb95d95360c2144c6ae930706b4f75b",
"sha256": "bc583b9f57c9f4d6eda0da306965c552bb9479ce439643aec7198c336621633b"
},
"downloads": -1,
"filename": "dirlay-0.1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "1bb95d95360c2144c6ae930706b4f75b",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,>=2.7",
"size": 8807,
"upload_time": "2025-02-20T22:40:29",
"upload_time_iso_8601": "2025-02-20T22:40:29.249405Z",
"url": "https://files.pythonhosted.org/packages/22/9f/629980be1b92963a3ef545985653dabbb410e331cd9e42fcc1701ec11fe4/dirlay-0.1.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c6481f4a86c390794183dd31ee7ffe9df50cf4c12e67e721555311f7710c568e",
"md5": "ae71ba8ff96ff6d0b1fcb4701fb87b33",
"sha256": "abf46b7e823706439e842f16d928b010002cb6f605d5549b0b64aca4ebb24e99"
},
"downloads": -1,
"filename": "dirlay-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ae71ba8ff96ff6d0b1fcb4701fb87b33",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,>=2.7",
"size": 92588,
"upload_time": "2025-02-20T22:40:30",
"upload_time_iso_8601": "2025-02-20T22:40:30.740865Z",
"url": "https://files.pythonhosted.org/packages/c6/48/1f4a86c390794183dd31ee7ffe9df50cf4c12e67e721555311f7710c568e/dirlay-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-20 22:40:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "makukha",
"github_project": "dirlay",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "dirlay"
}