Skip to main content

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] [--no-truncate] \
  [--title TEXT] \
  [--output OUTFILE]
  • ROOT: корень проекта (по умолчанию — git root или CWD)
  • --tree-include/--tree-exclude: фильтрация дерева по путям/именам/wildcard
  • --content-include: какие файлы показывать с содержимым (имя, путь, расширение .py, или wildcard **/*.py)
  • --content-exclude: исключить содержимое для совпадающих паттернов (файл останется в дереве)
  • --no-gitignore: не учитывать .gitignore
  • По умолчанию обрезка содержимого отключена. Включить можно --max-file-chars N.
  • Также учитывается .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


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.2.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prj_tree-0.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file prj_tree-0.1.2.tar.gz.

File metadata

  • Download URL: prj_tree-0.1.2.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.2 Darwin/24.0.0

File hashes

Hashes for prj_tree-0.1.2.tar.gz
Algorithm Hash digest
SHA256 920e917cb9843b5b5bd9b2abca805020859458535742d412582abcbe8cc990a7
MD5 54aaa62d143fe116d939199776b923a8
BLAKE2b-256 11ffbbded137aa073dc3161c39acd44f27e0843dc6182cb9805672c9ec1c46c7

See more details on using hashes here.

File details

Details for the file prj_tree-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: prj_tree-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 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

Hashes for prj_tree-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 34cae75b9170da9b107346443940f10774e611ccc9796f0ab4788389cf8270d8
MD5 95454c7b4da97dca3be4cf3b6ce22ce6
BLAKE2b-256 dd82cbb9ed5db58b81cc7b393c64de377e56dd612cf51e09e07bddce0aa3024b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page