route 2025.2.23.1


pip install route

  Latest version

Released: Feb 24, 2025

Project Links

Meta
Author: Idin K
Requires Python: >=3.6

Classifiers

Programming Language
  • Python :: 3

License
  • Other/Proprietary License

Operating System
  • OS Independent

Route

Route is a Python package for generating directory tree, especially in any python project or package.

Installation

pip install route

Usage

from route import directory_tree

directory_tree(path=".", save_to_file=True, display_output=True)

Output:

๐Ÿ›ธ route
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ run_me.py
โ”œโ”€โ”€ setup.py
โ””โ”€โ”€ ๐Ÿš€ route
    โ”œโ”€โ”€ dir.py
    โ”œโ”€โ”€ directory_tree.py
    โ”œโ”€โ”€ emoji.py
    โ”œโ”€โ”€ generate_get_dir_prefix.py
    โ”œโ”€โ”€ setup_utils.py
    โ””โ”€โ”€ starts_with.py

How to Use Route in Your Python Package

  • Use the following code at the top of your setup.py file (Script 1)
  • Add post_install_command and post_develop_command to the cmdclass argument in the setup function (Script 2)
  • See the setup.py file for an example.

Script 1

from route import get_post_develop_command, get_post_install_command
import os

# Define the arguments for the dir function
dir_path = os.getcwd()
ignore_ends_with={'.pyc', '.egg-info', '.ipynb'}
ignore_exact_match={
    '__init__.py', '__pycache__', '.git', '.idea', '.pytest_cache', '.ipynb_checkpoints', 
    'dist', 'build', '.gitignore'
}
specific_prefixes = {
    '* is_root': '๐Ÿ›ธ',
    '* is_module': '๐Ÿš€',
    '* is_test_dir': '๐Ÿงช',
    'test': '๐Ÿงช',
    'tests': '๐Ÿงช'
}

dir_args = {
    'path': dir_path,
    'ignore_ends_with': ignore_ends_with,
    'ignore_exact_match': ignore_exact_match,
    'specific_prefixes': specific_prefixes,
    'save_to_file': True,           # This creates a Markdown file
    'output_file': 'DIRECTORY.md'   # This is the name of the file that will be created
}

post_develop_command = get_post_develop_command(dir_args=dir_args)
post_install_command = get_post_install_command(dir_args=dir_args)

Script 2

setup(
    ...
    cmdclass={
        "install": post_install_command,
        "develop": post_develop_command,
    },
    ...
)

Wheel compatibility matrix

Platform Python 3
any

Files in release

No dependencies