Project tree extractor with ignore support, flexible includes, and multiple renderers (HTML/MD/JSON/ASCII).
Project description
prj-tree
Инструмент для извлечения структуры проекта (или отдельной директории) с учётом игноров и гибкими правилами включения файлов. Рендеры: HTML / Markdown / JSON / ASCII.
Установка
pip install prj-tree
CLI
prj-tree [ROOT] [--renderer html|md|json|ascii] \
[--no-git-root] [--no-gitignore] \
[--extra-ignore PATTERNS...] \
[--tree-include PATTERNS...] [--tree-exclude PATTERNS...] \
[--content-include PATTERNS...] \
[--content-exclude PATTERNS...] \
[--max-file-chars N] \
[--title TEXT] \
[--output OUTFILE]
- ROOT: корень проекта (по умолчанию — git root или CWD)
- --tree-include/--tree-exclude: фильтрация дерева по путям/именам/wildcard
- --content-include: какие файлы показывать с содержимым (имя, путь, расширение
.py, или wildcard**/*.py) - --content-exclude: исключить содержимое для совпадающих паттернов (файл останется в дереве)
- --no-gitignore: не учитывать
.gitignore - Также учитывается
.prjtreeignore(если есть) в корне
Примеры:
# HTML отчёт со всеми .py файлами
prj-tree --renderer html --content-include .py --output structure.html
# Markdown по папке src, исключая node_modules
prj-tree src --renderer md --tree-exclude node_modules --output tree.md
# JSON (можно парсить программно)
prj-tree --renderer json --content-include "src/**/*.ts" --output tree.json
# ASCII в stdout
prj-tree --renderer ascii
Python API
from prj_tree import generate, GenerateOptions
opts = GenerateOptions(
root_path="/path/to/project",
content_include=[".py", "README.md", "src/**/main.ts"],
tree_exclude=["node_modules", "dist"],
renderer="html",
title="Мой проект",
)
html = generate(opts)
Игноры
- Встроенные дефолтные игноры (например,
.git,node_modules,__pycache__и т.д.) - Паттерны из
.gitignore(если не отключено) - Паттерны из
.prjtreeignore(если файл существует) - Параметр
--extra-ignoreдля явных добавлений
Лицензия
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prj_tree-0.1.1.tar.gz
(18.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
prj_tree-0.1.1-py3-none-any.whl
(14.1 kB
view details)
File details
Details for the file prj_tree-0.1.1.tar.gz.
File metadata
- Download URL: prj_tree-0.1.1.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.2 Darwin/24.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00fb4672a684f29a5b1fc6ce1f29abf9f15033772a4ae0768e9065b80752af17
|
|
| MD5 |
88daf5a8bfadb0679d454e0563aa0872
|
|
| BLAKE2b-256 |
e603f84efad37efc8bdb7664fd231b6c6cfc3015915b45dcaf09ea880debfa2f
|
File details
Details for the file prj_tree-0.1.1-py3-none-any.whl.
File metadata
- Download URL: prj_tree-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.2 Darwin/24.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1df2936595604a76254ede5c8f99581434b2348338f4abcd123600f47c60af
|
|
| MD5 |
8779ada803516c00e6c815c0d970656e
|
|
| BLAKE2b-256 |
440fec0793e795890c9e2884f2145a6853372273d32c26e63a6e2fa04ee94bdb
|