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
๐Ÿฆ” PostHog is developer-friendly, open-source product analytics.

PostHog provides open-source product analytics, built for developers. Automate the collection of every event on your website or app, with no need to send data to 3rd parties. With just 1 click you ca

PostHog 10.3k Jan 01, 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
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
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
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
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 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
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
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
A very minimalistic python module that lets you track the time your code snippets take to run.

Clock Keeper A very minimalistic python module that lets you track the time your code snippets take to run. This package is available on PyPI! Run the

Rajdeep Biswas 1 Jan 19, 2022
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
Guesslang detects the programming language of a given source code

Detect the programming language of a source code

Y. SOMDA 618 Dec 29, 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
Performant type-checking for python.

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally โ€“ providi

Facebook 6.2k Jan 07, 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
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
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
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
Data parsing and validation using Python type hints

pydantic Data validation and settings management using Python type hinting. Fast and extensible, pydantic plays nicely with your linters/IDE/brain. De

Samuel Colvin 12.1k Jan 05, 2023