damj


Namedamj JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
SummaryA tool for creating comprehensive prompts for language models by combining project files and applying custom processing options.
upload_time2024-09-01 16:20:13
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords llm prompts ai chatgpt damj damj python package prompt engineering prompt creation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![background](https://raw.githubusercontent.com/baselhusam/damj/main/assets/background.png)

<p align="center">
  <img alt="Damj Logo" style="width: 200px; max-width: 100%; height: auto;" src="https://raw.githubusercontent.com/baselhusam/damj/main/assets/logo.png"/>
  <h1 align="center">✨ <b> Damj </b> ✨</h1>
  <p align="center"> <b> damj </b> is a tool for creating comprehensive prompts for language models by combining project files and applying custom processing options.
</p>

[![PyPI](https://img.shields.io/pypi/v/damj)](https://pypi.org/project/damj/)
<!-- [![Downloads](https://static.pepy.tech/badge/damj)](https://pepy.tech/project/damj) -->


## Introduction
`damj` is designed to help developers create effective prompts for large language models (LLMs) such as ChatGPT. By combining different project files and applying customizable processing options, `damj` simplifies the process of generating prompts tailored to specific project contexts.

## Features
- Combine multiple project files into a single prompt.
- Apply customizable processing options to include/exclude comments, imports, and docstrings for python scripts.
- Support for processing Jupyter notebooks and including cell outputs.
- Easy integration and usage within Python projects.

## Installation

### From PyPI
You can install the latest release from PyPI:
```sh
pip install damj
```

### From Source
```sh
git clone https://github.com/baselhusam/damj.git
cd damj
pip install .
```

## Usage

### Basic Example

```python
import os
from damj import Damj

cwd = os.getcwd()
damj = Damj(cwd)

damj.project_info(
    project_overview="This is a sample project.",
    add_project_structure=True,
)

prompt = damj.create_prompt(
    question="What is the purpose of this project?",
)

print(prompt)
```

Output:
```
# Project Overview
This is a sample project.


# Project Structure
|   ├── LICENSE
|   ├── README.md
|   ├── pyproject.toml
|   ├── requirements.txt
├── assets/
|   ├── background.png
|   ├── logo.png
├── damj/
|   ├── __init__.py
|   ├── damj.py
|   ├── utils.py



# Question
What is the purpose of this project?
```

### Another Detailed Exmaple
```python
import os
from damj import Damj

cwd = os.getcwd()

damj = Damj(
    cwd=cwd,
    whitelist_files=["*.py"],
    blacklist_files=[".venv", "__pycache__"],
    snippet_marker="```"
)

damj.project_info(
    project_overview="This is a sample project.",
    add_project_structure=True,
    add_files_content=True,
    py_options={
        "add_imports": True,
        "add_comments": True,
        "add_docstrings": False,
        "ipynb_output": False
    }
)

prompt = damj.create_prompt(
    question="What is the purpose of this project?",
    copy_to_clipboard=True,
    to_markdown=False
)

print(prompt)
```

### Use damj Utils Components
damj also provides several utility functions that can be used independently. These utilities include functions to get the project structure, get file content, and more.

#### Get Project Structure
The `get_project_structure` function generates a markdown representation of the directory structure, excluding blacklisted files and directories.

```python
from damj.utils import get_project_structure

# Get the project structure excluding .venv and __pycache__ directories
cwd = os.getcwd()
blacklist = [".venv", "__pycache__"]
project_structure = get_project_structure(cwd, blacklist)
print(project_structure)
```

#### Get File Content
The `get_file_content` function retrieves the content of a file, applying the specified `py_options`.

```python
from damj.utils import get_file_content

py_options = {
    "add_comments": True,
    "add_imports": True,
    "add_docstrings": False,
    "ipynb_output": False
}

# Get the content of a Python file with the specified options
file_content = get_file_content("example.py", py_options)
print(file_content)
```

<br>

## License
This project is licensed under the Apache Software License. See the LICENSE file for details.

<br>

## Contributors
Basel Mather (baselmathar@gmail.com)

<br>

## Contributing
Contributions are welcome! Please fork the repository and open a pull request with your changes.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "damj",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "LLM, prompts, AI, ChatGPT, damj, Damj, Python Package, Prompt Engineering, Prompt Creation",
    "author": null,
    "author_email": "Basel Mather <baselmathar@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cd/87/aa835e7074418dfa771a288d89538345f5c8ce582e0fcb10998934d91fbc/damj-0.1.4.tar.gz",
    "platform": null,
    "description": "![background](https://raw.githubusercontent.com/baselhusam/damj/main/assets/background.png)\n\n<p align=\"center\">\n  <img alt=\"Damj Logo\" style=\"width: 200px; max-width: 100%; height: auto;\" src=\"https://raw.githubusercontent.com/baselhusam/damj/main/assets/logo.png\"/>\n  <h1 align=\"center\">\u2728 <b> Damj </b> \u2728</h1>\n  <p align=\"center\"> <b> damj </b> is a tool for creating comprehensive prompts for language models by combining project files and applying custom processing options.\n</p>\n\n[![PyPI](https://img.shields.io/pypi/v/damj)](https://pypi.org/project/damj/)\n<!-- [![Downloads](https://static.pepy.tech/badge/damj)](https://pepy.tech/project/damj) -->\n\n\n## Introduction\n`damj` is designed to help developers create effective prompts for large language models (LLMs) such as ChatGPT. By combining different project files and applying customizable processing options, `damj` simplifies the process of generating prompts tailored to specific project contexts.\n\n## Features\n- Combine multiple project files into a single prompt.\n- Apply customizable processing options to include/exclude comments, imports, and docstrings for python scripts.\n- Support for processing Jupyter notebooks and including cell outputs.\n- Easy integration and usage within Python projects.\n\n## Installation\n\n### From PyPI\nYou can install the latest release from PyPI:\n```sh\npip install damj\n```\n\n### From Source\n```sh\ngit clone https://github.com/baselhusam/damj.git\ncd damj\npip install .\n```\n\n## Usage\n\n### Basic Example\n\n```python\nimport os\nfrom damj import Damj\n\ncwd = os.getcwd()\ndamj = Damj(cwd)\n\ndamj.project_info(\n    project_overview=\"This is a sample project.\",\n    add_project_structure=True,\n)\n\nprompt = damj.create_prompt(\n    question=\"What is the purpose of this project?\",\n)\n\nprint(prompt)\n```\n\nOutput:\n```\n# Project Overview\nThis is a sample project.\n\n\n# Project Structure\n|   \u251c\u2500\u2500 LICENSE\n|   \u251c\u2500\u2500 README.md\n|   \u251c\u2500\u2500 pyproject.toml\n|   \u251c\u2500\u2500 requirements.txt\n\u251c\u2500\u2500 assets/\n|   \u251c\u2500\u2500 background.png\n|   \u251c\u2500\u2500 logo.png\n\u251c\u2500\u2500 damj/\n|   \u251c\u2500\u2500 __init__.py\n|   \u251c\u2500\u2500 damj.py\n|   \u251c\u2500\u2500 utils.py\n\n\n\n# Question\nWhat is the purpose of this project?\n```\n\n### Another Detailed Exmaple\n```python\nimport os\nfrom damj import Damj\n\ncwd = os.getcwd()\n\ndamj = Damj(\n    cwd=cwd,\n    whitelist_files=[\"*.py\"],\n    blacklist_files=[\".venv\", \"__pycache__\"],\n    snippet_marker=\"```\"\n)\n\ndamj.project_info(\n    project_overview=\"This is a sample project.\",\n    add_project_structure=True,\n    add_files_content=True,\n    py_options={\n        \"add_imports\": True,\n        \"add_comments\": True,\n        \"add_docstrings\": False,\n        \"ipynb_output\": False\n    }\n)\n\nprompt = damj.create_prompt(\n    question=\"What is the purpose of this project?\",\n    copy_to_clipboard=True,\n    to_markdown=False\n)\n\nprint(prompt)\n```\n\n### Use damj Utils Components\ndamj also provides several utility functions that can be used independently. These utilities include functions to get the project structure, get file content, and more.\n\n#### Get Project Structure\nThe `get_project_structure` function generates a markdown representation of the directory structure, excluding blacklisted files and directories.\n\n```python\nfrom damj.utils import get_project_structure\n\n# Get the project structure excluding .venv and __pycache__ directories\ncwd = os.getcwd()\nblacklist = [\".venv\", \"__pycache__\"]\nproject_structure = get_project_structure(cwd, blacklist)\nprint(project_structure)\n```\n\n#### Get File Content\nThe `get_file_content` function retrieves the content of a file, applying the specified `py_options`.\n\n```python\nfrom damj.utils import get_file_content\n\npy_options = {\n    \"add_comments\": True,\n    \"add_imports\": True,\n    \"add_docstrings\": False,\n    \"ipynb_output\": False\n}\n\n# Get the content of a Python file with the specified options\nfile_content = get_file_content(\"example.py\", py_options)\nprint(file_content)\n```\n\n<br>\n\n## License\nThis project is licensed under the Apache Software License. See the LICENSE file for details.\n\n<br>\n\n## Contributors\nBasel Mather (baselmathar@gmail.com)\n\n<br>\n\n## Contributing\nContributions are welcome! Please fork the repository and open a pull request with your changes.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tool for creating comprehensive prompts for language models by combining project files and applying custom processing options.",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/baselhusam/damj"
    },
    "split_keywords": [
        "llm",
        " prompts",
        " ai",
        " chatgpt",
        " damj",
        " damj",
        " python package",
        " prompt engineering",
        " prompt creation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5702cbf9f6c2816a12b5d40ad7d11297daded02979d1e276d01a7fd2d1fa216b",
                "md5": "15c6c880a8589e096f7262b502d33477",
                "sha256": "fd52665853846c137916c33ff1189d142c3b1c6db2aa527d7dc702141c44ded3"
            },
            "downloads": -1,
            "filename": "damj-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "15c6c880a8589e096f7262b502d33477",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12164,
            "upload_time": "2024-09-01T16:20:12",
            "upload_time_iso_8601": "2024-09-01T16:20:12.152901Z",
            "url": "https://files.pythonhosted.org/packages/57/02/cbf9f6c2816a12b5d40ad7d11297daded02979d1e276d01a7fd2d1fa216b/damj-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd87aa835e7074418dfa771a288d89538345f5c8ce582e0fcb10998934d91fbc",
                "md5": "c41b69e53a61b833d00739649744e25f",
                "sha256": "19742a49e01c7f5b41979a38c26b6576de8132e3c111c98465f21eb92f42814c"
            },
            "downloads": -1,
            "filename": "damj-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "c41b69e53a61b833d00739649744e25f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 388376,
            "upload_time": "2024-09-01T16:20:13",
            "upload_time_iso_8601": "2024-09-01T16:20:13.714029Z",
            "url": "https://files.pythonhosted.org/packages/cd/87/aa835e7074418dfa771a288d89538345f5c8ce582e0fcb10998934d91fbc/damj-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-01 16:20:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "baselhusam",
    "github_project": "damj",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "damj"
}
        
Elapsed time: 0.39520s