Print a directory tree structure in your Python code.

Overview

directory-structure

PyPI PyPI - Downloads PyPI - License GitHub watchers GitHub Repo stars GitHub forks

Print a directory tree structure in your Python code.

Download

You can simply:

pip install directory-structure

Or you can also:

  1. Clone the repository to your local machine.
  2. Enter the directory.
  3. Download necessary modules/libraries.
git clone https://github.com/gabrielstork/directory-structure.git
cd directory-structure
pip install -r requirements.txt

Examples

from directory_structure import Tree

Using absolute path as an argument.

path = Tree('C:/Users/User/Desktop/directory-structure', absolute=True)
print(path)
📂 C:
|_📂 Users
  |_📂 User
    |_📂 Desktop
      |_📂 directory-structure
        |_📁 .git
        |_📁 directory_structure
        |_📄 .gitignore
        |_📄 LICENSE
        |_📄 pyproject.toml
        |_📄 README.md
        |_📄 requirements.txt
        |_📄 setup.py
path = Tree('C:/Users/User/Desktop/directory-structure', absolute=False)
print(path)
📂 directory-structure
|_📁 .git
|_📁 directory_structure
|_📄 .gitignore
|_📄 LICENSE
|_📄 pyproject.toml
|_📄 README.md
|_📄 requirements.txt
|_📄 setup.py

Accessing a folder in current working directory.

path = Tree('./directory_structure', absolute=True)
print(path)
📂 C:
|_📂 Users
  |_📂 User
    |_📂 Desktop
      |_📂 directory-structure
        |_📂 directory_structure
          |_📄 tree.py
          |_📄 __init__.py
path = Tree('./directory_structure', absolute=False)
print(path)
📂 directory_structure
|_📄 tree.py
|_📄 __init__.py

Getting all from the directory where your current working directory is.

path = Tree('../', absolute=True)
print(path)
📂 C:
|_📂 Users
  |_📂 User
    |_📂 Desktop
      |_📁 directory-structure
      |_📄 Discord.lnk
      |_📄 Spotify.lnk
      |_📄 Steam.lnk
      |_📄 Telegram.lnk
      |_📄 Visual Studio Code.lnk
      |_📄 WhatsApp.lnk
path = Tree('../', absolute=False)
print(path)
📂 Desktop
|_📁 directory-structure
|_📄 Discord.lnk
|_📄 Spotify.lnk
|_📄 Steam.lnk
|_📄 Telegram.lnk
|_📄 Visual Studio Code.lnk
|_📄 WhatsApp.lnk

forthebadge forthebadge

Owner
Gabriel Stork
Python
Gabriel Stork
Find usage statistics (imports, function calls, attribute access) for Python code-bases

Python Library stats This is a small library that allows you to query some useful statistics for Python code-bases. We currently report library import

Francisco Massa 13 May 02, 2022
The uncompromising Python code formatter

The Uncompromising Code Formatter “Any color you like.” Black is the uncompromising Python code formatter. By using it, you agree to cede control over

Python Software Foundation 30.7k Dec 28, 2022
Python package to parse and generate C/C++ code as context aware preprocessor.

Devana Devana is a python tool that make it easy to parsing, format, transform and generate C++ (or C) code. This tool uses libclang to parse the code

5 Dec 28, 2022
Optional static typing for Python 3 and 2 (PEP 484)

Mypy: Optional Static Typing for Python Got a question? Join us on Gitter! We don't have a mailing list; but we are always happy to answer questions o

Python 14.4k Jan 05, 2023
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

1.4k Dec 29, 2022
Pymwp is a tool for automatically performing static analysis on programs written in C

pymwp: MWP analysis in Python pymwp is a tool for automatically performing static analysis on programs written in C, inspired by "A Flow Calculus of m

Static Analyses of Program Flows: Types and Certificate for Complexity 2 Dec 02, 2022
A bytecode vm written in python.

CHex A bytecode vm written in python. hex command meaning note: the first two hex values of a CHex program are the magic number 0x01 (offset in memory

1 Aug 26, 2022
Checkov is a static code analysis tool for infrastructure-as-code.

Checkov - Prevent cloud misconfigurations during build-time for Terraform, Cloudformation, Kubernetes, Serverless framework and other infrastructure-as-code-languages with Checkov by Bridgecrew.

Bridgecrew 5.1k Jan 03, 2023
Typing-toolbox for Python 3 _and_ 2.7 w.r.t. PEP 484.

Welcome to the pytypes project pytypes is a typing toolbox w.r.t. PEP 484 (PEP 526 on the road map, later also 544 if it gets accepted). Its main feat

Stefan Richthofer 188 Dec 29, 2022
A simple stopwatch for measuring code performance with static typing.

A simple stopwatch for measuring code performance. This is a fork from python-stopwatch, which adds static typing and a few other things.

Rafael 2 Feb 18, 2022
An interpreter for the X1 bytecode.

X1 Bytecode Interpreter The X1 Bytecode is bytecode designed for simplicity in programming design and compilation. Bytecode Instructions push

Thanasis Tzimas 1 Jan 15, 2022
Metrinome is an all-purpose tool for working with code complexity metrics.

Overview Metrinome is an all-purpose tool for working with code complexity metrics. It can be used as both a REPL and API, and includes: Converters to

26 Dec 26, 2022
CodeAnalysis - Static Code Analysis: a code comprehensive analysis platform

TCA, Tencent Cloud Code Analysis English | 简体中文 What is TCA Tencent Cloud Code A

Tencent 1.3k Jan 07, 2023
pycallgraph is a Python module that creates call graphs for Python programs.

Project Abandoned Many apologies. I've stopped maintaining this project due to personal time constraints. Blog post with more information. I'm happy t

gak 1.7k Jan 01, 2023
Robocop is a tool that performs static code analysis of Robot Framework code.

Robocop Introduction Documentation Values Requirements Installation Usage Example Robotidy FAQ Watch our talk from RoboCon 2021 about Robocop and Robo

marketsquare 132 Dec 29, 2022
Turn your Python and Javascript code into DOT flowcharts

Notes from 2017 This is an older project which I am no longer working on. It was built before ES6 existed and before Python 3 had much usage. While it

Scott Rogowski 3k Jan 09, 2023
Learning source code review, spot vulnerability, find some ways how to fix it.

Learn Source Code Review Learning source code review, spot vulnerability, find some ways how to fix it. WordPress Plugin Authenticated Stored XSS on C

Shan 24 Dec 31, 2022
Guesslang detects the programming language of a given source code

Detect the programming language of a source code

Y. SOMDA 618 Dec 29, 2022
Calculator Python Package

Calculator Python Package This is a Calculator Package of Python. How To Install The Package? Install packagearinjoyn with pip (Package Installer Of P

Arinjoy_Programmer 1 Nov 21, 2021
Collection of library stubs for Python, with static types

typeshed About Typeshed contains external type annotations for the Python standard library and Python builtins, as well as third party packages as con

Python 3.3k Jan 02, 2023