Takes a folder path and outputs a text outline of the code, supports ignore files.
Project description
Python Code Structure Report Generator
This Python script generates a text-based report of the code structure for all Python files in a given folder. It's useful for getting a quick overview of the code structure of a Python project. This can be particularly helpful for ChatGPT/Large Language Model (LLM) applications where you need to ask high-level questions about your codebase.
Usage
To use this script, run the python_report_generator.py
file and provide the path to the folder containing the Python files you want to analyze. You can also optionally specify a name for the report file, which defaults to report.txt
if not provided, and a path to the ignore file. The ignore file should be a .gitignore
file or a file with the same format as a .gitignore
file. If provided, the script will parse the ignore patterns from the file and exclude the matching files and folders from the report.
python python_code_outline/python_report_generator.py /path/to/folder --report_file_path custom_report.txt --ignore_file_path /path/to/folder/.gitignore
If the --report_file_path
option is not specified, the report will be written to report.txt
by default.
python python_report_generator.py /path/to/folder
Output
The script will generate a text-based report of the code structure for each Python file in the specified folder. The report includes information about imports, classes, functions, and variables in each file.
Optional Parameters
--report_file_path
: The name of the report file. Defaults toreport.txt
if not provided.--ignore_file_path
: The path to the ignore file. If provided, the script will parse the ignore patterns from the file and exclude the matching files and folders from the report.
Requirements
This script requires Python 3.x to run.
Installation
This project uses Poetry for dependency management. To install the dependencies, first install Poetry by following the official installation guide, and then run the following command in the project directory:
poetry install
This will create a virtual environment and install the required dependencies.
Running Tests
This project uses pytest
for testing. To run the tests, first activate the virtual environment created by Poetry:
poetry shell
Then, run the tests using the following command:
pytest
Checking Test Coverage
This project uses the coverage
package to generate test coverage reports. To check the test coverage, run the following command:
coverage run -m pytest
This will generate a .coverage
file with the coverage data. To view the coverage report, run:
coverage report
To generate an HTML report, run:
coverage html
This will create an htmlcov
directory containing the HTML report.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_code_outline-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 535fa6746e5031811b5993497d4f6f1f0fb1a398e73bd2e894c654e0d3eceeff |
|
MD5 | 2d8e89cb8f93ff0423fb311d70646c79 |
|
BLAKE2b-256 | aaa93772aca5274b1e9a55eaf16c8d78e326e0bd0880da1c04fc3eaa7f9674fe |
Hashes for python_code_outline-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41134fd903ea13bf7d8a83e32365fe6791454f8aff5bcf63bc5097fddc98e55e |
|
MD5 | 64d56a964b0e5b7ad341f04a86285313 |
|
BLAKE2b-256 | 065e76a899259f83d19e9d1263122b72a64d7b188fcea1c56f9c0d7930ad7642 |