One-Codebase is a Python library designed to help developers generate structured codebase outputs, visualize directory structures, and easily locate files within a project. Whether you're working on a small script or a large-scale project, this library simplifies codebase management and exploration.
- Directory Structure Visualization: Generate a clean and readable tree structure of your project's directory.
- File Content Extraction: Extract and display the content of files within your project.
- Customizable Ignore Lists: Exclude specific files or directories (e.g.,
.git
,__pycache__
) from the output. - File Path Search: Quickly locate and copy the relative path of a specific file within your project.
- Unicode Support: Handles file reading with proper encoding (UTF-8 and fallback to Latin-1).
You can install one-codebase
using pip:
pip install one-codebase
Use the Prompter
class to generate a structured output of your project's directory and file contents.
from one_codebase import Prompter
# Initialize the Prompter with your project name
prompter = Prompter(project_name="your_project_name")
# Generate the codebase string
codebase_output = prompter.generate_codebase_string()
print(codebase_output)
For a more detailed guide on how to use this library, including advanced features and examples, please refer to the official documentation.
The Prompter
class and other functions support the following parameters:
include_git
: Include.git
directories in the output (default:False
).include_pycache
: Include__pycache__
directories in the output (default:False
).ignore_items
: A set of file or directory names to exclude from the output.
We welcome contributions! If you'd like to contribute to one-codebase
, please follow these steps:
- Fork the repository on GitHub.
- Create a new branch for your feature or bugfix.
- Submit a pull request with a detailed description of your changes.
Please ensure your code adheres to our Code of Conduct.
This project is licensed under the Personal Use License Agreement. See the LICENSE file for details.
Please read our Code of Conduct to understand the expectations for behavior within our community.
If you have any questions, issues, or feedback, please open an issue on the GitHub repository or contact us at [email protected].
- Inspired by the need for better codebase management tools.
- Thanks to the Contributor Covenant for the Code of Conduct template.
Happy coding! 🎉