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...] \
[--max-file-chars N] \
[--title TEXT] \
[--output OUTFILE]
- ROOT: корень проекта (по умолчанию — git root или CWD)
- --tree-include/--tree-exclude: фильтрация дерева по путям/именам/wildcard
- --content-include: какие файлы показывать с содержимым (имя, путь, расширение
.py, или wildcard**/*.py) - --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.0.tar.gz
(18.5 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.0-py3-none-any.whl
(14.0 kB
view details)
File details
Details for the file prj_tree-0.1.0.tar.gz.
File metadata
- Download URL: prj_tree-0.1.0.tar.gz
- Upload date:
- Size: 18.5 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 |
82f538b9414985a340ec269401ef9d58d7cb2a3ec61df2b1729e5909f8aa6ce3
|
|
| MD5 |
c034417082c6e82c362c09ac36f5013e
|
|
| BLAKE2b-256 |
e63443a08814d80fdf7bbbbd864ee1b6118aeb24ea5eb7e69fb3f6c3cf602d0c
|
File details
Details for the file prj_tree-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prj_tree-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.0 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 |
76af0ba24f78921dffc068da67715265502cb4385cf079a62a3a761fe48a7506
|
|
| MD5 |
8c39eaa656dc36b6c029fa8e57facbe3
|
|
| BLAKE2b-256 |
8be2b18aa4efe0641e6a97fe1e5934ae52c790e8a34572ea1e528889e299b42c
|