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
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
A formatter for Python files

YAPF Introduction Most of the current formatters for Python --- e.g., autopep8, and pep8ify --- are made to remove lint errors from code. This has som

Google 13k Dec 31, 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
Collects all accepted (partial and full scored) codes submitted within the given timeframe and saves them locally for plagiarism check.

Collects all accepted (partial and full scored) codes submitted within the given timeframe of any contest.

ARITRA BELEL 2 Dec 28, 2021
An analysis tool for Python that blurs the line between testing and type systems.

CrossHair An analysis tool for Python that blurs the line between testing and type systems. THE LATEST NEWS: Check out the new crosshair cover command

Phillip Schanely 836 Jan 08, 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
coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." ― John F. Woods coala provides a

coala development group 3.4k Jan 02, 2023
A Python utility / library to sort imports.

Read Latest Documentation - Browse GitHub Code Repository isort your imports, so you don't have to. isort is a Python utility / library to sort import

Python Code Quality Authority 5.5k Jan 06, 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
C/C++ Dependency Analyzer: a rewrite of John Lakos' dep_utils (adep/cdep/ldep) from

Version bΓͺta d'un systΓ¨me pour suivre les prix des livres chez Books to Scrape, un revendeur de livres en ligne. En pratique, dans cette version bΓͺta, le programme n'effectuera pas une vΓ©ritable surv

Olzhas Rakhimov 125 Sep 21, 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
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
Run-time type checker for Python

This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations. Four principal ways to do type

Alex GrΓΆnholm 1.1k Dec 19, 2022
Print a directory tree structure in your Python code.

directory-structure Print a directory tree structure in your Python code. Download You can simply: pip install directory-structure Or you can also: Cl

Gabriel Stork 45 Dec 19, 2022
A static analysis tool for Python

pyanalyze Pyanalyze is a tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some catego

Quora 212 Jan 07, 2023
This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

Nipuna Weerasekara 2 Mar 10, 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
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
Guesslang detects the programming language of a given source code

Detect the programming language of a source code

Y. SOMDA 618 Dec 29, 2022