Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

absolutely πŸ”

Automatically generate absolute Python imports and relative file paths from a project directory.


πŸš€ What is it?

absolutely is a lightweight Python script that walks through your project directory and generates:

  • 🐍 Absolute import paths for all Python modules (excluding __init__.py and __pycache__)
  • πŸ“ Relative paths to all non-Python files (e.g., configs, data, assets)

Perfect for large projects where import statements or file references are hard to track manually.


πŸ“‚ Example Use Case

You have a project folder like this:

project/ 
β”œβ”€β”€ utils/ 
β”‚ └── tools.py 
β”œβ”€β”€ data/ 
β”‚ └── sample.json 
β”œβ”€β”€ main.py 
  └── init.py

Running absolutely will generate a file like this:

=== ABSOLUTE IMPORTS (Python Modules) === from utils.tools import * from main import *

=== RELATIVE FILE PATHS (Non-Python Files) === data/sample.json


βš™οΈ How to Use

1. Set Your Base Path

Edit the script and point base_path to the root of your project:

base_path = Path(r"C:\Users\USER\Documents\pythonscripts")

  1. Run the Script Just run the script with Python: python absolutely.py

  1. Output It creates an absolute_imports.txt file in your project root with two sections: βœ… Absolute Python imports πŸ“„ Relative file links (non-.py)

πŸ“¦ Output Example

=== ABSOLUTE IMPORTS (Python Modules) ===

from shadowbrief.utils.tools import * from shadowbrief.main import *

=== RELATIVE FILE PATHS (Non-Python Files) ===

data/sample.json assets/config.yaml

🧠 Why? Simplify refactoring in large Python codebases Generate boilerplate imports for tools, scripts, or test runners Track non-Python assets for packaging or processing

πŸ› οΈ Dependencies Only built-in modules are used: pathlib

πŸ“„ License MIT β€” do what you want, just don't blame me if it explodes. πŸ’₯

About

πŸ” Automatically generate absolute Python imports and relative file paths from a project directory.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages