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
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
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
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 05, 2023
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
Typical: Fast, simple, & correct data-validation using Python 3 typing.

typical: Python's Typing Toolkit Introduction Typical is a library devoted to runtime analysis, inference, validation, and enforcement of Python types

Sean 170 Dec 26, 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 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
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
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
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
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
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
fixup: Automatically add and remove python import statements

fixup: Automatically add and remove python import statements The goal is that running fixup my_file.py will automatically add or remove import stateme

2 May 08, 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
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) Β© 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 966 Dec 29, 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
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
Inspects Python source files and provides information about type and location of classes, methods etc

prospector About Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and comple

Python Code Quality Authority 1.7k Dec 31, 2022
A static type analyzer for Python code

pytype - ? βœ” Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022