Skip to main content

No project description provided

Project description

Wildered

wildered is a personal, over-engineered, toy project for autocompleting your Python code using OpenAI GPT-3.5.

Installation

You can install wildered with pip. You need to have Python version of 3.10 or above to use wildered.

pip install wildered

Basic usage

Suppose that you have two Python scripts:

test.py:

from pydantic import BaseModel
from models import Point

def find_y_intercept(point_1: Point, point_2: Point) -> Point:
    """
    Given two points, find and return the y intercept as Point object
    """
    pass

models.py:

from typing import Any, NamedTuple, TypeAlias
import numpy.typing as npt
import numpy as np

class Point(NamedTuple):
    x: int
    y: int
    
    def as_ndarray(self) -> npt.NDArray:
        return np.array([self.x, self.y])

We wish to implement find_y_intercept in test.py. However, we cannot just copy paste the whole script, as the function depends on the definition of Point object, which is in models.py.

Lets see what wildered can do.

First, we add directives to the test.py.

New test.py:

from pydantic import BaseModel
import wildered # You can choose not to import wildered if you want
from models import Point

@wildered.hint([Point])
@wildered.autocomplete()
def find_y_intercept(point_1: Point, point_2: Point) -> Point:
    """
    Given two points, find and return the y intercept as POint object
    """
    pass

Now we run the wildered cli command:

wildered test.py

wildered will format a prompt for you ready to be used for code completion LLM:

I am writing a Python project and I need your help as a code assistant.
Below are the functions or classes that I am working on:

```python
def find_y_intercept(point_1: Point, point_2: Point) -> Point:
    """
    Given two points, find and return the y intercept as POint object
    """
    pass
```

Below are the tasks you need to accomplish:
'''
## Task 1
Implement find_y_intercept function. Follow instruction from docstrings and comments on how to implement the function. Ensure that your answer has type annotations. 

'''
Below are snippets of code in the current project that you may find useful:
```python
from typing import Any, NamedTuple, TypeAlias
import numpy.typing as npt
import numpy as np

class Point(NamedTuple):
    x: int
    y: int

    def as_ndarray(self) -> npt.NDArray:
        return np.array([self.x, self.y])
```

Your answer should only have the functions or class that you are told to implement. Do not repeat other code in your answer

Note: Actual output may differ as prompt template changes over time.

A more detailed documentation is still under development. Meanwhile you can learn more by running wildered --help

Future works

  • Automatically detect dependencies instead of specifying all of them manually. Also detect the dependencies of the dependencies.
  • Improving automatic integration of the LLM response into your project code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wildered-0.2.4.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

wildered-0.2.4-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file wildered-0.2.4.tar.gz.

File metadata

  • Download URL: wildered-0.2.4.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.1 Windows/10

File hashes

Hashes for wildered-0.2.4.tar.gz
Algorithm Hash digest
SHA256 22f0489e37be51156d60f310acd44d8ae7ff1089f360eda6f9398ea23efc6f8c
MD5 0212cc77b0485723c9f6902d2083ef8d
BLAKE2b-256 d17c5a1ef4767ff47fd277d134c70d9c4458bdfed84e0cc1ebe7f22008ca25d2

See more details on using hashes here.

File details

Details for the file wildered-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: wildered-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.1 Windows/10

File hashes

Hashes for wildered-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 21089a698ee30bb0575d5860da502ca61b94fbaff26585222b7d8950256b4fdc
MD5 9cba5aa487c56d792f9f637003c9ee1d
BLAKE2b-256 84d37b3a63c49901567e14a0d1bb5dd3ba4038daf9a1557e0d6ab6f6c4db007a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page