prompit


Nameprompit JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/oliveirabruno01/prompit
SummaryPrompit
upload_time2024-03-17 21:42:32
maintainer
docs_urlNone
authoroliveirabruno01
requires_python>=3.8.0
licenseMIT
keywords ai engineering prompt engineering
VCS
bugtrack_url
requirements setuptools pathspec pytest pytest-cov pathlib
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # prompit [![Common Changelog](https://common-changelog.org/badge.svg)](CHANGELOG.md) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/oliveirabruno01/prompit)

`prompit` is a Python package and a Command Line Interface (CLI) tool designed to transform repositories, directories, and files into promptable texts for use with large language models. It's an invaluable tool for quickly understanding the structure of a new project and preparing it for interaction with AI models.

## Features

- List all files in your project, considering .gitignore files.
- Print the directory structure of your project.
- Transform your repository into a promptable text.

## Installation

To install `prompit` from source, clone this repository and run the following command:

```shell
cd prompit
python -m pip install -e .
```

Alternatively you can install `prompit` with `pip install prompit`

## Usage

### As a CLI tool

You can use `prompit` to list all non-ignored files in your project:

```shell
prompit --list
```

To print the directory structure:

```shell
prompit --structure
```

To print the current directory or repo as a prompt:

```shell
prompit
```

This will promptfy your repo ignoring files under your .gitignore file. You can also append an instruction message on the prompt:

```shell
prompit --message "Your instruction here"
```

### As a Python module

You can also use `prompit` as a Python module in your scripts. Here's an example:

```python
from prompit import list_files, get_promptified_repo, get_repo_structure

# List all non-ignored files in the current directory
filepaths = list_files()

# Get the repository's structure, excluding all .svg files
structure = get_repo_structure(ignore_files="*.svg")

# Print the promptified repository
print(get_promptified_repo())
```

## Examples

Here are some advanced examples of how you can use `prompit`:

- To get a single file:

```shell
prompit -i * -a single_file.py
```

Note that the exact behavior may depend on your environment. `*` it will work on Windows but on unix-like systems it will probably fail. The exact reason can be explained by your favorite LLM.

> In Unix-like systems, wildcard characters like `*` are expanded by the shell before being passed to commands, which can lead to unexpected behavior. However, in Windows Command Prompt or PowerShell, these characters are passed as-is to the command. To ensure consistent behavior across different systems, you can prevent the shell from expanding the wildcard by quoting it, like so: `prompit -i '*'`. This allows the command itself to handle the wildcard expansion.

- To ignore a specific file and print the structure to the clipboard. This example uses Windows's clip.exe:

```shell
prompit -i src/languages.json -s | clip
```

- For Node.js projects, you might want to ignore `package-lock.json`:

```shell
prompit -i package-lock.json
```

Note: `.gitignore` and `.git` specs are the only ones automatically ignored.

## Contributing

We welcome contributions! Please see our [CONTRIBUTING.md](#CONTRIBUTING.md) for details on how to contribute to this project.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/oliveirabruno01/prompit",
    "name": "prompit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": "",
    "keywords": "AI engineering,prompt engineering",
    "author": "oliveirabruno01",
    "author_email": "brunocabeludo321@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/72/08/db981a1d444f8f91aeb5b4c72e860eb509c9de5d36375eb2073b145d19b7/prompit-0.3.3.tar.gz",
    "platform": null,
    "description": "\ufeff# prompit [![Common Changelog](https://common-changelog.org/badge.svg)](CHANGELOG.md) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/oliveirabruno01/prompit)\r\n\r\n`prompit` is a Python package and a Command Line Interface (CLI) tool designed to transform repositories, directories, and files into promptable texts for use with large language models. It's an invaluable tool for quickly understanding the structure of a new project and preparing it for interaction with AI models.\r\n\r\n## Features\r\n\r\n- List all files in your project, considering .gitignore files.\r\n- Print the directory structure of your project.\r\n- Transform your repository into a promptable text.\r\n\r\n## Installation\r\n\r\nTo install `prompit` from source, clone this repository and run the following command:\r\n\r\n```shell\r\ncd prompit\r\npython -m pip install -e .\r\n```\r\n\r\nAlternatively you can install `prompit` with `pip install prompit`\r\n\r\n## Usage\r\n\r\n### As a CLI tool\r\n\r\nYou can use `prompit` to list all non-ignored files in your project:\r\n\r\n```shell\r\nprompit --list\r\n```\r\n\r\nTo print the directory structure:\r\n\r\n```shell\r\nprompit --structure\r\n```\r\n\r\nTo print the current directory or repo as a prompt:\r\n\r\n```shell\r\nprompit\r\n```\r\n\r\nThis will promptfy your repo ignoring files under your .gitignore file. You can also append an instruction message on the prompt:\r\n\r\n```shell\r\nprompit --message \"Your instruction here\"\r\n```\r\n\r\n### As a Python module\r\n\r\nYou can also use `prompit` as a Python module in your scripts. Here's an example:\r\n\r\n```python\r\nfrom prompit import list_files, get_promptified_repo, get_repo_structure\r\n\r\n# List all non-ignored files in the current directory\r\nfilepaths = list_files()\r\n\r\n# Get the repository's structure, excluding all .svg files\r\nstructure = get_repo_structure(ignore_files=\"*.svg\")\r\n\r\n# Print the promptified repository\r\nprint(get_promptified_repo())\r\n```\r\n\r\n## Examples\r\n\r\nHere are some advanced examples of how you can use `prompit`:\r\n\r\n- To get a single file:\r\n\r\n```shell\r\nprompit -i * -a single_file.py\r\n```\r\n\r\nNote that the exact behavior may depend on your environment. `*` it will work on Windows but on unix-like systems it will probably fail. The exact reason can be explained by your favorite LLM.\r\n\r\n> In Unix-like systems, wildcard characters like `*` are expanded by the shell before being passed to commands, which can lead to unexpected behavior. However, in Windows Command Prompt or PowerShell, these characters are passed as-is to the command. To ensure consistent behavior across different systems, you can prevent the shell from expanding the wildcard by quoting it, like so: `prompit -i '*'`. This allows the command itself to handle the wildcard expansion.\r\n\r\n- To ignore a specific file and print the structure to the clipboard. This example uses Windows's clip.exe:\r\n\r\n```shell\r\nprompit -i src/languages.json -s | clip\r\n```\r\n\r\n- For Node.js projects, you might want to ignore `package-lock.json`:\r\n\r\n```shell\r\nprompit -i package-lock.json\r\n```\r\n\r\nNote: `.gitignore` and `.git` specs are the only ones automatically ignored.\r\n\r\n## Contributing\r\n\r\nWe welcome contributions! Please see our [CONTRIBUTING.md](#CONTRIBUTING.md) for details on how to contribute to this project.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Prompit",
    "version": "0.3.3",
    "project_urls": {
        "Homepage": "https://github.com/oliveirabruno01/prompit"
    },
    "split_keywords": [
        "ai engineering",
        "prompt engineering"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e3f6c752adf55099bff9e66e4b17828e8149915bbc4c17890b133c9d466c45de",
                "md5": "8c85f2af4c1aa3a683b17e044f2f2bba",
                "sha256": "45f01e3fd048f53c61f8d93d15d8777dd4dbf7d73df5bf5d0a763f5742bff7a5"
            },
            "downloads": -1,
            "filename": "prompit-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c85f2af4c1aa3a683b17e044f2f2bba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 12015,
            "upload_time": "2024-03-17T21:42:31",
            "upload_time_iso_8601": "2024-03-17T21:42:31.873052Z",
            "url": "https://files.pythonhosted.org/packages/e3/f6/c752adf55099bff9e66e4b17828e8149915bbc4c17890b133c9d466c45de/prompit-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7208db981a1d444f8f91aeb5b4c72e860eb509c9de5d36375eb2073b145d19b7",
                "md5": "9daccc7211af3a93a989974f6107f16f",
                "sha256": "e539fe94a9a2b0b4f0d7b8e4dc253893b884b15eb2f34bd0d72ce4f32569d91d"
            },
            "downloads": -1,
            "filename": "prompit-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "9daccc7211af3a93a989974f6107f16f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 13725,
            "upload_time": "2024-03-17T21:42:32",
            "upload_time_iso_8601": "2024-03-17T21:42:32.989034Z",
            "url": "https://files.pythonhosted.org/packages/72/08/db981a1d444f8f91aeb5b4c72e860eb509c9de5d36375eb2073b145d19b7/prompit-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-17 21:42:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "oliveirabruno01",
    "github_project": "prompit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "setuptools",
            "specs": [
                [
                    "==",
                    "69.2.0"
                ]
            ]
        },
        {
            "name": "pathspec",
            "specs": [
                [
                    "~=",
                    "0.12.1"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "~=",
                    "8.1.1"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": []
        },
        {
            "name": "pathlib",
            "specs": [
                [
                    "~=",
                    "1.0.1"
                ]
            ]
        }
    ],
    "lcname": "prompit"
}
        
Elapsed time: 3.17054s