DTY (Directory-to-YAML)
Overview
DTY (Directory-to-YAML) is a Python command-line tool designed for quickly generating representations of directory structures and their contents in YAML format. This tool is especially useful for structuring directory data in a token-efficient manner, making it ideal for interactions with language models like ChatGPT.
Example output
dty
my_project:
__init__.py: ""
main.py: |
# Main application file
import app
app.run()
app.py: |
# App module
def run():
print('Running the app')
utils:
helper.py: |
# Utility functions
def helper():
return 'Helper function'
Features
- Convert directory contents to YAML format.
- Include or exclude files using patterns (supports fnmatch style, e.g.,
*.py,data*). - Recursive directory parsing.
- Options for output: printing to console, saving to a file, or copying to the clipboard.
Installation
pip install dty
Usage
Run DTY from the command line with the following options:
dty <target-directory> [options]
If no target directory is specified, DTY will default to the current working directory.
Options:
-tor--target-file: Target a single file. This option is mutually exclusive with-i,-e, and-r.-ior--include: Patterns to include files. Enclose patterns in quotes to avoid shell expansion (e.g.,'*.py','data*').-eor--exclude: Patterns to exclude files. Enclose patterns in quotes to avoid shell expansion (e.g.,'*.xml','temp*').-oor--output-file: Set the output YAML file name.-ror--recursive: Enable recursive search in directories. Not valid when targeting a single file.-por--print: Print the output using rich formatting.-cor--clipboard: Copy the output to the clipboard.
Example
dty myfolder -i '*.py' '*.html' -o output.yaml -r
This command will parse all .py and .html files in myfolder recursively and save the YAML output to output.yaml.
Authors
- Adrian Galilea - Initial work
Acknowledgments
- Hat tip to ChatGPT for assistance with project setup and documentation.
Metadata
Release files for dty 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dty-0.1.1.tar.gz | 4.4 kB | Without provenance | Details for dty-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dty-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for dty-0.1.1-py3-none-any.whl |
Total release size: 9.3 kB
Release files / dty-0.1.1.tar.gz
| Download URL | dty-0.1.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c08e5c7aaf2aad5ffa4f4951e2bb1072181496da6790270e3708f9353ecb361d
|
|
BLAKE2b-256 checksum How to use checksums |
315be908afb1d5303441ff2dfd3a21690f8fad30334040082b94214d6ae04892
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / dty-0.1.1-py3-none-any.whl
| Download URL | dty-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1b82eb5bfb12af771487e3934932ff2047d19a107b0d7b009f97c11e2210f24
|
|
BLAKE2b-256 checksum How to use checksums |
47c98dab2c7273c5bb17e5b57778be27fad2f253bcfe655c3845f23c07a02263
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for dty 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.