treeignore


Nametreeignore JSON
Version 0.5.3 PyPI version JSON
download
home_pageNone
SummaryA tree view command-line utility that filters files/folders based on a .gitignore
upload_time2025-03-31 11:06:23
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseNone
keywords gitignore tree directory visualization cli ai llm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TreeIgnore

[![PyPI version](https://badge.fury.io/py/treeignore.svg)](https://pypi.org/project/treeignore/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

TreeIgnore is a Python command-line utility that prints a tree-style view of the current directory while ignoring files and folders specified in a `.gitignore` file located at the base folder.

## Features

- **Recursive Listing:** Displays the directory tree recursively.
- **Gitignore Filtering:** Reads the `.gitignore` file from the base folder to filter out files and folders.
- **Easy to Use:** A simple command-line tool that can be executed from any directory.
- **AI-Friendly Output:** Perfect for AI tools and LLMs by providing clean project structure without noise from build artifacts, dependencies, or cache files that would unnecessarily consume context windows.

## Why TreeIgnore?

TreeIgnore is particularly valuable when working with AI tools and Large Language Models (LLMs). By respecting `.gitignore` patterns, it provides a clean, focused view of your project's actual source code and important files, filtering out:

- Build artifacts and cache directories
- Dependencies and virtual environments
- IDE configuration files
- System-specific files

This focused output helps prevent context window bloat when sharing project structures with AI tools, ensuring they can focus on the relevant code and documentation rather than getting distracted by temporary or generated files.

## Installation

Install from PyPI:

```bash
pip install treeignore
```

For development, install directly from the repository:

```bash
git clone https://gitlab.com/CochainComplex/treeignore.git
cd treeignore
pip install -e .
```

## Usage

Navigate to the base folder (the folder containing your `.gitignore` file) and run:

```bash
treeignore [path] [options]
```

The tool will display a tree-style view of the specified directory (or the current directory if none is provided), filtering out any files or folders that match the patterns in the `.gitignore` files.

### Command-line Options

| Option          | Alias | Description                                         |
|-----------------|-------|-----------------------------------------------------|
| `--level <num>` | `-L`  | Descend only `<num>` directories deep.              |
| `--dirs-only`   | `-d`  | List directories only.                              |
| `--full-path`   | `-f`  | Print the full path prefix for each file.           |
| `--all`         | `-a`  | List all files, including hidden ones (dotfiles).   |
| `--show-perms`  | `-p`  | Print file permissions (Unix-like systems).         |
| `--show-size`   | `-s`  | Print file size in bytes.                           |
| `--no-indent`   | `-i`  | Don't print indentation lines.                      |
| `--noreport`    |       | Omit the final file/directory count report.         |
| `--no-ignore`   |       | Disable `.gitignore` filtering (show all files).    |
| `--version`     |       | Show version information and exit.                  |
| `path`          |       | Optional directory path to list (default: current). |

### Examples

**Basic Usage (Current Directory):**
```bash
treeignore
```

**List only directories, up to 2 levels deep:**
```bash
treeignore -L 2 -d
```

**Show all files (including hidden) with full paths:**
```bash
treeignore -a -f
```

**Show files in a specific directory, ignoring gitignore rules:**
```bash
treeignore path/to/your/project --no-ignore
```

### Example Comparison (Standard `tree` vs `treeignore`)

Here's how a typical Python project looks with the standard `tree` command:

```
myproject/
├── .git/
│   ├── HEAD
│   ├── config
│   └── ... (many more files)
├── .pytest_cache/
│   └── ... (cache files)
├── __pycache__/
│   └── main.cpython-39.pyc
├── venv/
│   ├── bin/
│   ├── lib/
│   └── ... (hundreds of files)
├── .gitignore
├── main.py
├── requirements.txt
└── tests/
    ├── __pycache__/
    │   └── test_main.cpython-39-pytest.pyc
    └── test_main.py
```

And here's the same project with `treeignore`:

```
myproject/
├── .gitignore
├── main.py
├── requirements.txt
└── tests/
    └── test_main.py
```

As you can see, `treeignore` provides a clean view focusing only on the essential project files, making it perfect for documentation, project sharing, and AI tool interactions.

## Development

This project uses modern Python tooling:
- `black` for code formatting
- `isort` for import sorting
- `mypy` for type checking

To set up the development environment:

1. Create a virtual environment:
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

2. Install development dependencies:
```bash
pip install -e ".[dev]"
```

3. Build the package:
```bash
python -m build
```

4. Run tests:
```bash
python -m pytest
```

## Publishing to PyPI

1. Build the distribution:
```bash
python -m build
```

2. Upload to PyPI:
```bash
python -m twine upload dist/*
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. (Current version: 0.5.0)

## Author

Alexander Warth - [warth.ai](https://warth.ai)

## Links

- [GitLab Repository](https://gitlab.com/CochainComplex/treeignore)
- [Issue Tracker](https://gitlab.com/CochainComplex/treeignore/-/issues)
- [PyPI Package](https://pypi.org/project/treeignore/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "treeignore",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "gitignore, tree, directory, visualization, CLI, AI, LLM",
    "author": null,
    "author_email": "Alexander Warth <alexander.warth@mailbox.org>",
    "download_url": "https://files.pythonhosted.org/packages/22/5a/a8b64fee5a3c50cfbc8cb4879b76f3e73b908f3b0646fc95aace5c3f74a8/treeignore-0.5.3.tar.gz",
    "platform": null,
    "description": "# TreeIgnore\n\n[![PyPI version](https://badge.fury.io/py/treeignore.svg)](https://pypi.org/project/treeignore/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nTreeIgnore is a Python command-line utility that prints a tree-style view of the current directory while ignoring files and folders specified in a `.gitignore` file located at the base folder.\n\n## Features\n\n- **Recursive Listing:** Displays the directory tree recursively.\n- **Gitignore Filtering:** Reads the `.gitignore` file from the base folder to filter out files and folders.\n- **Easy to Use:** A simple command-line tool that can be executed from any directory.\n- **AI-Friendly Output:** Perfect for AI tools and LLMs by providing clean project structure without noise from build artifacts, dependencies, or cache files that would unnecessarily consume context windows.\n\n## Why TreeIgnore?\n\nTreeIgnore is particularly valuable when working with AI tools and Large Language Models (LLMs). By respecting `.gitignore` patterns, it provides a clean, focused view of your project's actual source code and important files, filtering out:\n\n- Build artifacts and cache directories\n- Dependencies and virtual environments\n- IDE configuration files\n- System-specific files\n\nThis focused output helps prevent context window bloat when sharing project structures with AI tools, ensuring they can focus on the relevant code and documentation rather than getting distracted by temporary or generated files.\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install treeignore\n```\n\nFor development, install directly from the repository:\n\n```bash\ngit clone https://gitlab.com/CochainComplex/treeignore.git\ncd treeignore\npip install -e .\n```\n\n## Usage\n\nNavigate to the base folder (the folder containing your `.gitignore` file) and run:\n\n```bash\ntreeignore [path] [options]\n```\n\nThe tool will display a tree-style view of the specified directory (or the current directory if none is provided), filtering out any files or folders that match the patterns in the `.gitignore` files.\n\n### Command-line Options\n\n| Option          | Alias | Description                                         |\n|-----------------|-------|-----------------------------------------------------|\n| `--level <num>` | `-L`  | Descend only `<num>` directories deep.              |\n| `--dirs-only`   | `-d`  | List directories only.                              |\n| `--full-path`   | `-f`  | Print the full path prefix for each file.           |\n| `--all`         | `-a`  | List all files, including hidden ones (dotfiles).   |\n| `--show-perms`  | `-p`  | Print file permissions (Unix-like systems).         |\n| `--show-size`   | `-s`  | Print file size in bytes.                           |\n| `--no-indent`   | `-i`  | Don't print indentation lines.                      |\n| `--noreport`    |       | Omit the final file/directory count report.         |\n| `--no-ignore`   |       | Disable `.gitignore` filtering (show all files).    |\n| `--version`     |       | Show version information and exit.                  |\n| `path`          |       | Optional directory path to list (default: current). |\n\n### Examples\n\n**Basic Usage (Current Directory):**\n```bash\ntreeignore\n```\n\n**List only directories, up to 2 levels deep:**\n```bash\ntreeignore -L 2 -d\n```\n\n**Show all files (including hidden) with full paths:**\n```bash\ntreeignore -a -f\n```\n\n**Show files in a specific directory, ignoring gitignore rules:**\n```bash\ntreeignore path/to/your/project --no-ignore\n```\n\n### Example Comparison (Standard `tree` vs `treeignore`)\n\nHere's how a typical Python project looks with the standard `tree` command:\n\n```\nmyproject/\n\u251c\u2500\u2500 .git/\n\u2502   \u251c\u2500\u2500 HEAD\n\u2502   \u251c\u2500\u2500 config\n\u2502   \u2514\u2500\u2500 ... (many more files)\n\u251c\u2500\u2500 .pytest_cache/\n\u2502   \u2514\u2500\u2500 ... (cache files)\n\u251c\u2500\u2500 __pycache__/\n\u2502   \u2514\u2500\u2500 main.cpython-39.pyc\n\u251c\u2500\u2500 venv/\n\u2502   \u251c\u2500\u2500 bin/\n\u2502   \u251c\u2500\u2500 lib/\n\u2502   \u2514\u2500\u2500 ... (hundreds of files)\n\u251c\u2500\u2500 .gitignore\n\u251c\u2500\u2500 main.py\n\u251c\u2500\u2500 requirements.txt\n\u2514\u2500\u2500 tests/\n    \u251c\u2500\u2500 __pycache__/\n    \u2502   \u2514\u2500\u2500 test_main.cpython-39-pytest.pyc\n    \u2514\u2500\u2500 test_main.py\n```\n\nAnd here's the same project with `treeignore`:\n\n```\nmyproject/\n\u251c\u2500\u2500 .gitignore\n\u251c\u2500\u2500 main.py\n\u251c\u2500\u2500 requirements.txt\n\u2514\u2500\u2500 tests/\n    \u2514\u2500\u2500 test_main.py\n```\n\nAs you can see, `treeignore` provides a clean view focusing only on the essential project files, making it perfect for documentation, project sharing, and AI tool interactions.\n\n## Development\n\nThis project uses modern Python tooling:\n- `black` for code formatting\n- `isort` for import sorting\n- `mypy` for type checking\n\nTo set up the development environment:\n\n1. Create a virtual environment:\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n2. Install development dependencies:\n```bash\npip install -e \".[dev]\"\n```\n\n3. Build the package:\n```bash\npython -m build\n```\n\n4. Run tests:\n```bash\npython -m pytest\n```\n\n## Publishing to PyPI\n\n1. Build the distribution:\n```bash\npython -m build\n```\n\n2. Upload to PyPI:\n```bash\npython -m twine upload dist/*\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. (Current version: 0.5.0)\n\n## Author\n\nAlexander Warth - [warth.ai](https://warth.ai)\n\n## Links\n\n- [GitLab Repository](https://gitlab.com/CochainComplex/treeignore)\n- [Issue Tracker](https://gitlab.com/CochainComplex/treeignore/-/issues)\n- [PyPI Package](https://pypi.org/project/treeignore/)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tree view command-line utility that filters files/folders based on a .gitignore",
    "version": "0.5.3",
    "project_urls": {
        "Author Website": "https://warth.ai",
        "Bug Tracker": "https://gitlab.com/CochainComplex/treeignore/-/issues",
        "Homepage": "https://gitlab.com/CochainComplex/treeignore",
        "Repository": "https://gitlab.com/CochainComplex/treeignore"
    },
    "split_keywords": [
        "gitignore",
        " tree",
        " directory",
        " visualization",
        " cli",
        " ai",
        " llm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c5d83175536a22e0a7970c7e408686a25dd5b8ce8535da61cdc290034bd575e4",
                "md5": "48e5abaf787eaf7c75f222d13c9c73b4",
                "sha256": "99074747710ffc7d8c343cf5c2b2e52c0c85cb9872ff946c6d826dd89b3a0934"
            },
            "downloads": -1,
            "filename": "treeignore-0.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48e5abaf787eaf7c75f222d13c9c73b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8667,
            "upload_time": "2025-03-31T11:06:22",
            "upload_time_iso_8601": "2025-03-31T11:06:22.924640Z",
            "url": "https://files.pythonhosted.org/packages/c5/d8/3175536a22e0a7970c7e408686a25dd5b8ce8535da61cdc290034bd575e4/treeignore-0.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "225aa8b64fee5a3c50cfbc8cb4879b76f3e73b908f3b0646fc95aace5c3f74a8",
                "md5": "778f36a446473902630256aa9d986854",
                "sha256": "936582eee3491bdb05c37c25d3ea0a139f338113c69432bb165f81db5cda4178"
            },
            "downloads": -1,
            "filename": "treeignore-0.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "778f36a446473902630256aa9d986854",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 12733,
            "upload_time": "2025-03-31T11:06:23",
            "upload_time_iso_8601": "2025-03-31T11:06:23.974104Z",
            "url": "https://files.pythonhosted.org/packages/22/5a/a8b64fee5a3c50cfbc8cb4879b76f3e73b908f3b0646fc95aace5c3f74a8/treeignore-0.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-31 11:06:23",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "CochainComplex",
    "gitlab_project": "treeignore",
    "lcname": "treeignore"
}
        
Elapsed time: 0.42179s